Checkpointing

Save state. Resume cleanly.

The execution state is persisted at well-defined boundaries (per node or super-step) so an interrupted or failed run resumes from the last checkpoint instead of restarting — the durable-execution substrate that also enables human-in-the-loop pauses.

In practiceA multi-hour data-migration agent checkpoints after each table, so a network blip resumes from the last table instead of restarting.

Level
04 · Production
Subdomain
Runtime Architecture
Also known as
State Checkpointing, Resume from State, Persistent Run State
Trade-off
Higher fault tolerance is gained against storage, privacy, and consistency overhead.
Native in
LangGraph, Microsoft Agent Framework, AWS Strands, Google ADK, Temporal, Restate, Inngest
The mechanism

How it works.

After every finished step the state of the run is written to a store. A run that stops, for whatever reason, starts again from the last entry and not from the beginning.

1 · While the run is healthy

  1. Run a stepOne node or one super-step
  2. Save the stateUnder the thread ID, with the step number
  3. ContinueWith the next step

2 · After an interruption

  1. Start with the same thread IDAfter a crash, a restart or an approval
  2. Load the last checkpointThe state and the step number
  3. Skip what is doneFinished steps are not repeated
  4. Run onFrom the step after the checkpoint
Checkpoint
The saved state of a run at the end of one step, enough to continue from there.
Thread ID
The key under which the checkpoints of one run are stored. The same ID means: continue this run.
Idempotent step
A step that can run twice without harm. The step that was running at the moment of the crash runs again.
Walk it through

A real run, step by step.

TaskAn agent migrates five tables, one step per table. The network fails during the third:
Illustrative run.
TableFirst runAfter the restart
customersMigrated, checkpoint 1Skipped
ordersMigrated, checkpoint 2Skipped
invoicesThe network fails halfway. No checkpointRuns again from its start
paymentsNot reachedMigrated, checkpoint 4
audit_logNot reachedMigrated, checkpoint 5
What this shows: the restart cost one table, not three. The third table is the catch. It was half done when the network failed, and a checkpoint only marks steps that finished, so that step runs a second time. If it is not idempotent, half of its rows are written twice. The store has a price too: the saved state may hold personal data that now sits on disk.
In code

The pattern in code.

Plain Pythonpython
def run(steps, thread_id, state=None):
    saved = store.latest(thread_id)  # a checkpoint exists: resume
    start = saved.step + 1 if saved else 0
    state = saved.state if saved else state
    for index in range(start, len(steps)):
        state = steps[index](state)  # may fail: network, timeout, crash
        # a checkpoint after every finished step
        store.save(thread_id, step=index, state=state)
    return state
Fit

Use it, or not.

When to reach for it

  • Agent runs are lengthy or expensive.
  • External systems might temporarily fail.
  • Manual review between steps is required.

When it backfires

  • Steps are atomic and cheaply repeatable.
  • The state unnecessarily persists sensitive data.
  • Resuming makes no business sense.
Pitfalls

Two ways this pattern will hurt you.

Checkpoints hold secrets

The checkpoint serializes the full state including API keys and user PII. A resumed run leaks sensitive data to logs.

Countermeasure

Redact secrets before serialization. Store sensitive fields in a vault and reference them by handle in the checkpoint.

Resumption with stale tool state

The agent resumes from a checkpoint but the external world has changed. The tool state in the checkpoint is now invalid.

Countermeasure

Invalidate tool-related state on resume. Re-run discovery or validation before continuing tool-dependent branches.

EU law

Regulation

Duties from EU law that this pattern helps meet, or that land on it. A reading aid, not legal advice.

  • GDPR Art. 17Personal data is erased without undue delay when a ground for erasure applies.Controllers · since 25 May 2018

An engineer's reading aid, not legal advice. The legal texts and their interpretation are authoritative.

Framework support

Where Checkpointing is native.

LangGraphfirst-class CheckpointersNative
Microsoft Agent Frameworkdurable run stateNative
AWS StrandsAWS Strands WorkflowNative
Google ADKresumable sessionsNative
Temporalevent history and replayNative
Restatedurable journalNative
Inngestmemoized stepsNative
Deep Agents SDKLangGraph checkpointerAdaptable
Sources

Where this pattern comes from.

  1. LangGraph — Persistence & CheckpointingIn the source list

Search

Search patterns, frameworks, and pages.