| Name | Type | Description |
|---|---|---|
thread_id* | str | the thread ID to run the cron job on. |
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: None |
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 |
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 job for a thread.
client = get_sync_client(url="http://localhost:8123")
cron_run = client.crons.create_for_thread(
thread_id="my-thread-id",
assistant_id="agent",
schedule="27 15 * * *",
input={"messages": [{"role": "user", "content": "hello!"}]},
metadata={"name":"my_run"},
context={"model_name": "openai"},
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
)The input to the graph.
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.
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.