We use cookies

We use cookies to ensure you get the best experience on our website. For more information on how we use cookies, please see our cookie policy.

By clicking "Accept", you agree to our use of cookies.
Learn more.

ReferencePython SDKFeature ClientsScheduled

Scheduled Client

Bases: BaseRestClient

The scheduled client is a client for managing scheduled workflows within Hatchet.

Methods:

NameDescription
aio_bulk_deleteBulk delete scheduled workflow runs.
aio_bulk_updateBulk reschedule scheduled workflow runs.
aio_createCreates a new scheduled workflow run.
aio_deleteDeletes a scheduled workflow run by its ID.
aio_getRetrieves a specific scheduled workflow by scheduled run trigger ID.
aio_listRetrieves a list of scheduled workflows based on provided filters.
aio_updateReschedule a scheduled workflow run by its ID.
bulk_deleteBulk delete scheduled workflow runs.
bulk_updateBulk reschedule scheduled workflow runs.
createCreates a new scheduled workflow run.
deleteDeletes a scheduled workflow run by its ID.
getRetrieves a specific scheduled workflow by scheduled run trigger ID.
listRetrieves a list of scheduled workflows based on provided filters.
updateReschedule a scheduled workflow run by its ID.

Functions

aio_bulk_delete

Bulk delete scheduled workflow runs.

Parameters:

NameTypeDescriptionDefault
scheduled_idslist[str] | NoneExplicit list of scheduled workflow run IDs to delete.None
workflow_idstr | NoneFilter by workflow ID.None
parent_workflow_run_idstr | NoneFilter by parent workflow run ID.None
parent_step_run_idstr | NoneFilter by parent step run ID.None
statuseslist[ScheduledRunStatus] | NoneFilter by scheduled run statuses.None
additional_metadataJSONSerializableMapping | NoneFilter by additional metadata key/value pairs.None

Returns:

TypeDescription
ScheduledWorkflowsBulkDeleteResponseThe bulk delete response containing deleted IDs and per-item errors.

Raises:

TypeDescription
ValueErrorIf neither scheduled_ids nor any filter field is provided.

aio_bulk_update

Bulk reschedule scheduled workflow runs.

See bulk_update for parameter details.

aio_create

Creates a new scheduled workflow run.

IMPORTANT: It’s preferable to use Workflow.run (and similar) to trigger workflows if possible. This method is intended to be an escape hatch. For more details, see the documentation.

Parameters:

NameTypeDescriptionDefault
workflow_namestrThe name of the workflow to schedule.required
trigger_atdatetimeThe datetime when the run should be triggered.required
inputJSONSerializableMappingThe input data for the scheduled workflow.required
additional_metadataJSONSerializableMappingAdditional metadata associated with the future run as a key-value pair.required

Returns:

TypeDescription
ScheduledWorkflowsThe created scheduled workflow instance.

aio_delete

Deletes a scheduled workflow run by its ID.

Parameters:

NameTypeDescriptionDefault
scheduled_idstrThe ID of the scheduled workflow run to delete.required

Returns:

TypeDescription
NoneNone

aio_get

Retrieves a specific scheduled workflow by scheduled run trigger ID.

Parameters:

NameTypeDescriptionDefault
scheduled_idstrThe scheduled workflow trigger ID to retrieve.required

Returns:

TypeDescription
ScheduledWorkflowsThe requested scheduled workflow instance.

aio_list

Retrieves a list of scheduled workflows based on provided filters.

Parameters:

NameTypeDescriptionDefault
offsetint | NoneThe offset to use in pagination.None
limitint | NoneThe maximum number of scheduled workflows to return.None
workflow_idstr | NoneThe ID of the workflow to filter by.None
parent_workflow_run_idstr | NoneThe ID of the parent workflow run to filter by.None
statuseslist[ScheduledRunStatus] | NoneA list of statuses to filter by.None
additional_metadataJSONSerializableMapping | NoneAdditional metadata to filter by.None
order_by_fieldScheduledWorkflowsOrderByField | NoneThe field to order the results by.None
order_by_directionWorkflowRunOrderByDirection | NoneThe direction to order the results by.None

Returns:

TypeDescription
ScheduledWorkflowsListA list of scheduled workflows matching the provided filters.

aio_update

Reschedule a scheduled workflow run by its ID.

Parameters:

NameTypeDescriptionDefault
scheduled_idstrThe ID of the scheduled workflow run to reschedule.required
trigger_atdatetimeThe datetime when the run should be triggered.required

Returns:

TypeDescription
ScheduledWorkflowsThe updated scheduled workflow instance.

bulk_delete

Bulk delete scheduled workflow runs.

Provide either:

  • scheduled_ids (explicit list of scheduled run IDs), or
  • one or more filter fields (workflow_id, parent_workflow_run_id, parent_step_run_id, statuses, additional_metadata)

Parameters:

NameTypeDescriptionDefault
scheduled_idslist[str] | NoneExplicit list of scheduled workflow run IDs to delete.None
workflow_idstr | NoneFilter by workflow ID.None
parent_workflow_run_idstr | NoneFilter by parent workflow run ID.None
parent_step_run_idstr | NoneFilter by parent step run ID.None
statuseslist[ScheduledRunStatus] | NoneFilter by scheduled run statuses.None
additional_metadataJSONSerializableMapping | NoneFilter by additional metadata key/value pairs.None

Returns:

TypeDescription
ScheduledWorkflowsBulkDeleteResponseThe bulk delete response containing deleted IDs and per-item errors.

Raises:

TypeDescription
ValueErrorIf neither scheduled_ids nor any filter field is provided.

bulk_update

Bulk reschedule scheduled workflow runs.

Parameters:

NameTypeDescriptionDefault
updateslist[ScheduledWorkflowsBulkUpdateItem] | list[tuple[str, datetime]]Either: - a list of (scheduled_id, trigger_at) tuples, or - a list of ScheduledWorkflowsBulkUpdateItem objectsrequired

Returns:

TypeDescription
ScheduledWorkflowsBulkUpdateResponseThe bulk update response containing updated IDs and per-item errors.

create

Creates a new scheduled workflow run.

IMPORTANT: It’s preferable to use Workflow.run (and similar) to trigger workflows if possible. This method is intended to be an escape hatch. For more details, see the documentation.

Parameters:

NameTypeDescriptionDefault
workflow_namestrThe name of the workflow to schedule.required
trigger_atdatetimeThe datetime when the run should be triggered.required
inputJSONSerializableMappingThe input data for the scheduled workflow.required
additional_metadataJSONSerializableMappingAdditional metadata associated with the future run as a key-value pair.required

Returns:

TypeDescription
ScheduledWorkflowsThe created scheduled workflow instance.

delete

Deletes a scheduled workflow run by its ID.

Parameters:

NameTypeDescriptionDefault
scheduled_idstrThe ID of the scheduled workflow run to delete.required

Returns:

TypeDescription
NoneNone

get

Retrieves a specific scheduled workflow by scheduled run trigger ID.

Parameters:

NameTypeDescriptionDefault
scheduled_idstrThe scheduled workflow trigger ID to retrieve.required

Returns:

TypeDescription
ScheduledWorkflowsThe requested scheduled workflow instance.

list

Retrieves a list of scheduled workflows based on provided filters.

Parameters:

NameTypeDescriptionDefault
offsetint | NoneThe offset to use in pagination.None
limitint | NoneThe maximum number of scheduled workflows to return.None
workflow_idstr | NoneThe ID of the workflow to filter by.None
parent_workflow_run_idstr | NoneThe ID of the parent workflow run to filter by.None
statuseslist[ScheduledRunStatus] | NoneA list of statuses to filter by.None
additional_metadataJSONSerializableMapping | NoneAdditional metadata to filter by.None
order_by_fieldScheduledWorkflowsOrderByField | NoneThe field to order the results by.None
order_by_directionWorkflowRunOrderByDirection | NoneThe direction to order the results by.None

Returns:

TypeDescription
ScheduledWorkflowsListA list of scheduled workflows matching the provided filters.

update

Reschedule a scheduled workflow run by its ID.

Note: the server may reject rescheduling if the scheduled run has already triggered, or if it was created via code definition (not via API).

Parameters:

NameTypeDescriptionDefault
scheduled_idstrThe ID of the scheduled workflow run to reschedule.required
trigger_atdatetimeThe datetime when the run should be triggered.required

Returns:

TypeDescription
ScheduledWorkflowsThe updated scheduled workflow instance.