Durability modes
Durability controls when checkpoint writes finish relative to graph execution. It matters only when the graph has a checkpointer.1
Three choices
Section titled “Three choices”| Mode | When persistence happens | Trade-off |
|---|---|---|
"sync" |
Finish the write before the next step starts | Strongest boundary, more latency |
"async" |
Write while the next step runs | Default; lower latency, small crash window |
"exit" |
Persist only when the graph exits | Fastest intermediate steps, no intermediate recovery point |
Tiny example
Section titled “Tiny example”result = graph.invoke( {"case_id": "104"}, config={"configurable": {"thread_id": "case-104"}}, durability="sync",)Use sync when the next step must never start before the previous checkpoint is stored. Use exit only when replaying the whole run is acceptable.
Failure note
Section titled “Failure note”Durability does not make external effects transactional. A checkpoint and a payment API are two separate systems; use an idempotency key and verify the remote result on retry.
Related
Section titled “Related”Footnotes
Section titled “Footnotes”-
LangChain,
Durabilityreference andinvokereference. ↩