Creating threads
A client-provided
thread_id must be 1–255 non-blank characters. Omit the field (or send null) to let the server generate a UUID. Longer or blank values are rejected with 422 before they hit PostgreSQL’s btree key limit (~2704 bytes).Thread status
Threads have a status that reflects their current state:The snippets below assume you are inside an
async def function with an initialized client — see the example above.Getting thread state
The state contains the current values of all state fields, information about what nodes will execute next, and any pending interrupts.Updating thread state
You can modify thread state directly, for example to inject data or correct values:Checkpoint history
Every state change creates a checkpoint. You can browse the full history:Filtering history
Passmetadata to return only the checkpoints whose metadata contains every key-value pair you give. It combines with limit (default 10) and before:
step and a source ("input", "loop", "update", or "fork") on each checkpoint it writes, and checkpoints written during a run also carry the run’s run_id. Steps do not restart for each run, and a run started from an earlier checkpoint reuses step numbers, so a step filter can match more than one checkpoint. GET /threads/{thread_id}/history takes the same filter as a JSON-encoded metadata query parameter.
Get state at a specific checkpoint
Run from a specific checkpoint
Passcheckpoint_id (or the full checkpoint object) to start a run from an earlier checkpoint. input is optional: without it the run replays from that point, with it the run branches with new input.
checkpoint win over checkpoint_id. A checkpoint_id that is not a UUID returns 422.
Checkpoint durability
By default LangGraph writes a checkpoint after every step of a run, in the background. Setdurability on a run to change when checkpoints are written:
exit writes one checkpoint per run instead of one per step, which suits high-volume runs that never use time travel or mid-run recovery. It has two costs:
- With Redis workers, a run requeued after a worker crash or a shutdown drain starts over from the thread’s last checkpoint, so its steps run a second time. See worker architecture.
- The thread history holds one checkpoint per run, so you cannot inspect or fork from the steps inside it. Interrupts still write a checkpoint, so human-in-the-loop resumes work.
checkpoint_during is the deprecated form of the same setting: true means async and false means exit. If both are sent, durability wins. Creating a cron accepts both fields and updating one accepts durability; the cron applies them to every run it fires. An unknown value returns 422.
To change the default for runs that do not set a mode, set checkpointer.durability in aegra.json or the AEGRA_CHECKPOINT_DURABILITY environment variable. See the configuration reference.
Searching threads
Find threads by status or metadata:limit accepts 1 through MAX_SEARCH_LIMIT (default 1000, matching LangGraph Platform). Omitted or null limit uses min(20, MAX_SEARCH_LIMIT). Values above the cap return 422.
Response projection with select is not implemented yet. Sending a non-null
select value returns 422 instead of silently returning the default thread shape.
Listing threads
Deleting threads
Deleting a thread cancels any active runs and removes all state, including the checkpoint history stored in the graph backend:Thread TTL
Threads can expire automatically. Configure a server-wide default undercheckpointer.ttl in aegra.json (or the AEGRA_THREAD_TTL environment
variable) — see the configuration reference.
A background sweep then applies each thread’s policy:
delete— the thread, its runs and crons, and all checkpoint data are removed.keep_latest— checkpoint history is compacted down to the latest state; the thread stays usable and the TTL re-arms, so history is pruned periodically. Threads whose state uses a LangGraphDeltaChannel(Deep Agents uses one formessagesandfiles) are skipped for now, because their latest state is rebuilt from older checkpoints. The skip is logged.
Pruning threads by ID
To prune specific threads now, with or without a TTL, pass their IDs. The strategy applies to the listed threads only:keep_latest on DeltaChannel threads are skipped and not counted in
pruned_count.
Thread metadata
Threads automatically track metadata about their usage:owner: User identity at creation time (mirrorsuser_idon the Thread object, which is used for access control)assistant_id: Last assistant usedgraph_id: Last graph executed