Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Heuristic:Langchain ai Langgraph Durability Mode Selection

From Leeroopedia
Knowledge Sources
Domains Persistence, Performance, Architecture
Last Updated 2026-02-11 14:00 GMT

Overview

Guidance on selecting between sync, async, and exit durability modes to balance checkpoint persistence guarantees against execution performance.

Description

LangGraph v1.0 introduced durability modes (replacing the deprecated `checkpoint_during` flag) that control when graph state is persisted to the checkpoint backend. The three modes trade off between data safety and execution speed. This setting is configured at the graph compilation level and affects all nodes in the graph.

Usage

Use this heuristic when tuning performance of a deployed LangGraph application or when deciding how much data loss risk is acceptable during graph execution failures.

The Insight (Rule of Thumb)

  • `sync` (Synchronous): Checkpoints are written before the next step starts. Slowest mode but guarantees no data loss on crash. Use for critical workflows where every step must be recoverable (e.g., financial transactions, human-in-the-loop reviews).
  • `async` (Asynchronous): Checkpoints are written concurrently while the next step executes. Balanced performance and safety. Use as the default for production workloads.
  • `exit` (On Exit): Checkpoints are written only when the graph completes. Fastest mode but intermediate state is lost on crash. Use for high-throughput, non-critical workloads where re-execution is acceptable.
  • Trade-off: `sync` adds latency proportional to checkpoint write time. `exit` risks losing all intermediate state. `async` is the sweet spot for most applications.

Reasoning

Checkpoint persistence is often the performance bottleneck in LangGraph execution, especially with database-backed savers (PostgreSQL, SQLite). Writing a checkpoint after every step (`sync`) ensures perfect recoverability but doubles the time per step when the checkpoint write is as slow as the node execution. The `async` mode overlaps checkpoint writes with the next node's execution, hiding the latency in most cases. The `exit` mode eliminates all intermediate checkpoint overhead but means a crash mid-execution loses all progress.

The durability mode replaces the older `checkpoint_during` parameter, which was deprecated in LangGraph v1.0.

Code Evidence

Durability type definition from `libs/langgraph/langgraph/types.py:62-68`:

Durability = Literal["sync", "async", "exit"]
"""Durability mode for the graph execution.

- `'sync'`: Changes are persisted synchronously before the next step starts.
- `'async'`: Changes are persisted asynchronously while the next step executes.
- `'exit'`: Changes are persisted only when the graph exits.
"""

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment