- Create a new thread with the specified assistant
- Send the specified input to that thread
Crons client. To schedule a graph job, you need to pass a cron expression to inform the client when you want to run the graph. Cron jobs are run in the background and do not interfere with normal invocations of the graph.
All cron schedules are interpreted in UTC. Make sure to convert your desired execution time to UTC when specifying the schedule.
Setup
First, let’s set up our SDK client, assistant, and thread:- Python
- Javascript
- CURL
Cron job on a thread
To create a cron job associated with a specific thread, you can write:- Python
- Javascript
- CURL
Cron jobs that are no longer useful. Otherwise you could rack up unwanted API charges to the LLM! You can delete a Cron job using the following code:
- Python
- Javascript
- CURL
Cron job stateless
You can also create stateless cron jobs by using the following code. Stateless cron jobs create a new thread for each execution:- Python
- Javascript
- CURL
- Python
- Javascript
- CURL
Thread cleanup for stateless crons
This feature requires LangGraph API version 0.5.18 or later and Python SDK 0.3.2 or later, or JavaScript SDK 1.4.0 or later.
on_run_completed parameter:
"delete"(default): Automatically deletes the thread after the run completes."keep": Preserves the thread for later retrieval. You are responsible for cleaning up these threads. See how to add TTLs to your application for the recommended approach.
Example: Keeping threads for later retrieval
- Python
- Javascript
- CURL
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

