Skip to main content

Scheduled Jobs

Scheduled Jobs​

toothfairyai@latest…

Manager for scheduled jobs (cron jobs) operations.

This manager provides methods to create, update, and manage scheduled jobs.

Example:

>>> client = ToothFairyClient(api_key="...", workspace_id="...")
>>> scheduled_job = client.scheduled_jobs.create(
... name="Daily Report",
... agent_id="agent-123",
... schedule={"frequency": "DAILY", "hour": 9, "minute": 0},
... timezone="UTC",
... )

Accessed via client.scheduledJobs.

Methods​

MethodHTTPEndpoint
createPOSTPOST /scheduled_job/create
updatePOSTPOST /scheduled_job/update
deleteDELETEDELETE /scheduled_job/delete/{scheduled_job_id}
getGETGET /scheduled_job/get/{scheduled_job_id}
listGETGET /scheduled_job/list
get_active—derived
get_by_status—derived
get_by_agent—derived
pause—derived
resume—derived
search—derived

create​

Create a new scheduled job.

def create(
name: str,
agent_id: str,
custom_prompt_id: str,
timezone: str = 'UTC',
description: Optional[str] = None,
forced_prompt: Optional[str] = None,
schedule: Optional[Union[CronSchedule, Dict[str, Any]]] = None,
frequency: CronJobFrequency = 'DAILY',
interval: Optional[int] = None,
cron_expression: Optional[str] = None,
day_of_week: Optional[int] = None,
day_of_month: Optional[int] = None,
hour: Optional[int] = None,
minute: Optional[int] = None,
is_active: bool = True,
start_date: Optional[str] = None,
end_date: Optional[str] = None,
status: Optional[CronJobStatusRequest] = None,
execution_config: Optional[Union[CronExecutionConfig, Dict[str, Any]]] = None,
notification_config: Optional[Union[CronNotificationConfig, Dict[str, Any]]] = None,
retry_config: Optional[Union[CronRetryConfig, Dict[str, Any]]] = None,
metadata: Optional[Dict[str, Any]] = None,
cron_type: Optional[str] = None,
routine_config: Optional[Union[Dict[str, Any], Any]] = None
) -> ScheduledJob

Endpoint: POST /scheduled_job/create · API service

Request fields​

Python kwargWire fieldTypeRequiredDescription
ididstringnoUnique identifier
workspace_idworkspaceidstringyesUnique workspace identifier (UUID v4)
namenamestringyesName of the resource
descriptiondescriptionstringnoDetailed description of purpose and capabilities
forced_promptforcedPromptstringnoForced prompt text to use for the job (max 1024 chars)
agent_idagentIDstringyesID of the agent associated with this resource
typetypestringnoType classification (free-form string identifier)
routine_configroutineConfigstringnoConfiguration for routine jobs (maxPlannedActions)
custom_prompt_idcustomPromptIDstringnoID of a custom prompt to use
scheduleschedulestringnoSchedule configuration object (frequency, interval, cronExpression, etc.)
timezonetimezonestringnoTimezone for the schedule (e.g. UTC, America/New_York)
is_activeisActivebooleannoWhether the job is currently active
statusstatusstringnoCurrent status of the resource

Allowed: ACTIVE, PAUSED, PENDING, RUNNING, FAILED, COMPLETED | | last_run_at | lastRunAt | string | no | Timestamp of the last execution | | next_run_at | nextRunAt | string | no | Timestamp of the next scheduled execution | | start_date | startDate | string | no | Start date for the schedule | | end_date | endDate | string | no | End date for the schedule | | execution_config | executionConfig | string | no | JSON-encoded execution configuration | | notification_config | notificationConfig | string | no | JSON-encoded notification configuration | | retry_config | retryConfig | string | no | JSON-encoded retry policy configuration | | metadata | metadata | string | no | Arbitrary metadata key-value pairs (JSON) | | created_by | createdBy | string | no | ID of the user who created this resource | | updated_by | updatedBy | string | no | ID of the user who last updated this resource | | created_at | createdAt | string | no | Timestamp when this resource was created | | updated_at | updatedAt | string | no | Timestamp when this resource was last updated |

Always pass snake_case keyword arguments — the Python kwarg column shows the exact name to use for each wire field (as a named parameter where it appears in the method signature, otherwise via **kwargs). The SDK converts it deterministically to the camelCase wire key the API expects. Passing camelCase directly is deprecated: it emits a warning and converts to the same wire key.

Response fields​

FieldTypeDescription
idstringUnique identifier for the scheduled job
namestringName of the resource
descriptionstringDetailed description of purpose and capabilities
forcedPromptstringForced prompt override
typestringType classification (free-form string identifier)

Allowed: TASK, ROUTINE | | routineConfig | object | Configuration for routine jobs (maxPlannedActions) | | agentID | string | Agent to execute | | customPromptID | string | Custom prompt to use | | workspaceID | string | Unique workspace identifier (UUID v4) | | schedule | object | Schedule configuration | | timezone | string | Timezone for scheduling | | isActive | boolean | Whether the job is active | | lastRunAt | string | Timestamp of the last execution | | nextRunAt | string | Timestamp of the next scheduled execution | | status | string | Current job status

Allowed: ACTIVE, PAUSED, DISABLED, RUNNING, SENSING, PLANNING, ACTING, COMPLETED, FAILED, PENDING | | executionConfig | object | JSON-encoded execution configuration | | notificationConfig | object | JSON-encoded notification configuration | | retryConfig | object | JSON-encoded retry policy configuration | | metadata | object | Arbitrary metadata key-value pairs (JSON) | | startDate | string | Start date for the schedule | | endDate | string | End date for the schedule | | createdBy | string | ID of the user who created this resource | | updatedBy | string | ID of the user who last updated this resource | | createdAt | string | Timestamp when this resource was created | | updatedAt | string | Timestamp when this resource was last updated |

Example​

client.scheduledJobs.create(name="…", agent_id="agent-id", custom_prompt_id="agent-id")

update​

Update a scheduled_job.

def update(scheduled_job_id: str) -> ScheduledJob

Endpoint: POST /scheduled_job/update · API service

Request fields​

Python kwargWire fieldTypeRequiredDescription
ididstringyesUnique identifier
workspace_idworkspaceidstringnoUnique workspace identifier (UUID v4)
namenamestringnoName of the resource
descriptiondescriptionstringnoDetailed description of purpose and capabilities
forced_promptforcedPromptstringnoForced prompt text to use for the job (max 1024 chars)
agent_idagentIDstringnoID of the agent associated with this resource
typetypestringnoType classification (free-form string identifier)
routine_configroutineConfigstringnoConfiguration for routine jobs (maxPlannedActions)
custom_prompt_idcustomPromptIDstringnoID of a custom prompt to use
scheduleschedulestringnoSchedule configuration object (frequency, interval, cronExpression, etc.)
timezonetimezonestringnoTimezone for the schedule (e.g. UTC, America/New_York)
is_activeisActivebooleannoWhether the job is currently active
statusstatusstringnoCurrent status of the resource

Allowed: ACTIVE, PAUSED, PENDING, RUNNING, FAILED, COMPLETED | | last_run_at | lastRunAt | string | no | Timestamp of the last execution | | next_run_at | nextRunAt | string | no | Timestamp of the next scheduled execution | | start_date | startDate | string | no | Start date for the schedule | | end_date | endDate | string | no | End date for the schedule | | execution_config | executionConfig | string | no | JSON-encoded execution configuration | | notification_config | notificationConfig | string | no | JSON-encoded notification configuration | | retry_config | retryConfig | string | no | JSON-encoded retry policy configuration | | metadata | metadata | string | no | Arbitrary metadata key-value pairs (JSON) | | created_by | createdBy | string | no | ID of the user who created this resource | | updated_by | updatedBy | string | no | ID of the user who last updated this resource | | created_at | createdAt | string | no | Timestamp when this resource was created | | updated_at | updatedAt | string | no | Timestamp when this resource was last updated |

Always pass snake_case keyword arguments — the Python kwarg column shows the exact name to use for each wire field (as a named parameter where it appears in the method signature, otherwise via **kwargs). The SDK converts it deterministically to the camelCase wire key the API expects. Passing camelCase directly is deprecated: it emits a warning and converts to the same wire key.

Response​

Returns the ScheduledJob object — fields documented in the create section above.

Example​

client.scheduledJobs.update(scheduled_job_id="agent-id")

delete​

Delete a scheduled_job.

def delete(scheduled_job_id: str) -> Dict[str, bool]

Endpoint: DELETE /scheduled_job/delete/{scheduled_job_id} · API service

Example​

client.scheduledJobs.delete(scheduled_job_id="agent-id")

get​

Get a scheduled_job by ID.

def get(scheduled_job_id: str) -> ScheduledJob

Endpoint: GET /scheduled_job/get/{scheduled_job_id} · API service

Response​

Returns the ScheduledJob object — fields documented in the create section above.

Example​

client.scheduledJobs.get(scheduled_job_id="agent-id")

list​

List all scheduled jobs.

def list(
limit: Optional[int] = None,
offset: Optional[int] = None
) -> ListResponse

Endpoint: GET /scheduled_job/list · API service

Example​

client.scheduledJobs.list()

get_active​

Get all active scheduled jobs.

def get_active() -> List[ScheduledJob]

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example​

client.scheduledJobs.get_active()

get_by_status​

Get scheduled jobs by status.

def get_by_status(status: CronJobStatus) -> List[ScheduledJob]

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example​

client.scheduledJobs.get_by_status(status=…)

get_by_agent​

Get scheduled jobs by agent ID.

def get_by_agent(agent_id: str) -> List[ScheduledJob]

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example​

client.scheduledJobs.get_by_agent(agent_id="agent-id")

pause​

Pause a scheduled job.

def pause(scheduled_job_id: str) -> ScheduledJob

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example​

client.scheduledJobs.pause(scheduled_job_id="agent-id")

resume​

Resume a paused scheduled job.

def resume(scheduled_job_id: str) -> ScheduledJob

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example​

client.scheduledJobs.resume(scheduled_job_id="agent-id")

Search scheduled jobs by name.

def search(search_term: str) -> List[ScheduledJob]

Derived method — delegates to another SDK call and performs no direct HTTP request.

Example​

client.scheduledJobs.search(search_term="…")