| Name | Type | Description |
|---|---|---|
assistant_id* | str | The assistant ID or graph name to use for the cron job. If using graph name, will default to first assistant created from that graph. |
schedule* | str | The cron schedule to execute this job on. Schedules are interpreted in UTC unless a timezone is specified. |
input | Input | None | Default: NoneThe input to the graph. |
metadata | Mapping[str, Any] | None | Default: None |
config | Config | None | Default: None |
context | Context | None | Default: None |
checkpoint_during | bool | None | Default: None |
interrupt_before | All | list[str] | None | Default: None |
interrupt_after | All | list[str] | None | Default: None |
webhook | str | None | Default: None |
on_run_completed | OnCompletionBehavior | None | Default: None |
multitask_strategy | str | None | Default: None |
end_time | datetime | None | Default: None |
enabled | bool | None | Default: None |
timezone | str | tzinfo | None | Default: None |
stream_mode | StreamMode | Sequence[StreamMode] | None | Default: None |
stream_subgraphs | bool | None | Default: None |
stream_resumable | bool | None | Default: None |
durability | Durability | None | Default: None |
headers | Mapping[str, str] | None | Default: None |
Create a cron run.
client = get_sync_client(url="http://localhost:8123")
cron_run = client.crons.create(
assistant_id="agent",
schedule="27 15 * * *",
input={"messages": [{"role": "user", "content": "hello!"}]},
metadata={"name":"my_run"},
context={"model_name": "openai"},
checkpoint_during=True,
interrupt_before=["node_to_stop_before_1","node_to_stop_before_2"],
interrupt_after=["node_to_stop_after_1","node_to_stop_after_2"],
webhook="https://my.fake.webhook.com",
multitask_strategy="interrupt",
enabled=True
)Metadata to assign to the cron job runs.
The configuration for the assistant.
Static context to add to the assistant.
(deprecated) Whether to checkpoint during the run (or only at the end/interruption).
Nodes to interrupt immediately before they get executed.
Nodes to Nodes to interrupt immediately after they get executed.
Webhook to call after LangGraph API call is done.
What to do with the thread after the run completes. Must be one of 'delete' (default) or 'keep'. 'delete' removes the thread after execution. 'keep' creates a new thread for each execution but does not clean them up. Clients are responsible for cleaning up kept threads.
Multitask strategy to use. Must be one of 'reject', 'interrupt', 'rollback', or 'enqueue'.
The time to stop running the cron job. If not provided, the cron job will run indefinitely.
Whether the cron job is enabled. By default, it is considered enabled.
IANA timezone for the cron schedule. Accepts a string (e.g. 'America/New_York') or a datetime.tzinfo instance (e.g. ZoneInfo("America/New_York")).
The stream mode(s) to use.
Whether to stream output from subgraphs.
Whether to persist the stream chunks in order to resume the stream later.
Durability level for the run. Must be one of 'sync', 'async', or 'exit'. "async" means checkpoints are persisted async while next graph step executes, replaces checkpoint_during=True "sync" means checkpoints are persisted sync after graph step executes, replaces checkpoint_during=False "exit" means checkpoints are only persisted when the run exits, does not save intermediate steps
Optional custom headers to include with the request.