Agentic AI Notebook
LangGraph
Phase 10Module 6 of 12

Checkpoints & Persistence

Without a snapshot, a refund that paused overnight is gone. Checkpoints are how graphs survive deploys, crashes, and humans who come back tomorrow.

A save file in a game. You do not replay the whole dungeon. You load the last checkpoint and keep going.

Visual Workflows

Start here — scroll inside each diagram frame to explore, then use + / to zoom up to 200% if needed.

Overview

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

Short-term vs long-term

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

Checkpointer = this thread's working memory. Store = facts across threads (user prefs). Different tools.

Why nodes should be safe to retry

100%
Loading diagram...

Scroll inside the frame to explore · use + / − to zoom up to 200%

Resume re-runs the node that was in flight. Side effects before the pause can fire twice — make them idempotent.

Key Takeaways

  • 1.A checkpointer snapshots state after each super-step so the same thread can resume later. thread_id is the name of that story. Same id = same ticket. New id = a blank run.
  • 2.Durable execution is not a second feature — it is this: crash, restart, invoke the same thread, continue. MemorySaver is for local learning. PostgresSaver (or similar) is for production. Pick one at compile time.
  • 3.compile(checkpointer=MemorySaver()) then config={'configurable': {'thread_id': 'ticket-4411'}}. Every invoke/stream with that config loads the latest checkpoint first.
  • 4.Durable execution in the docs is this mechanism plus retries. Time travel (later) reads the checkpoint history.
  • 5.HITL (next) requires a checkpointer or the pause has nowhere to sit.

Learn elsewhere

  • Time Travel & Replay
  • Human-in-the-Loop

Real Example

Scenario

Server dies after classify, before the assistant. Restart. Same thread_id. Graph loads ticket_type and continues at assistant. The user does not start over.

What you would do

One thread_id per conversation or ticket. Never reuse a thread for a different customer. In production, put checkpoints in Postgres, not process memory.

Commands

Commands to Remember

  • compile(checkpointer=MemorySaver()) # local
  • pip install langgraph-checkpoint-postgres # production
  • config = {configurable: {thread_id: '...'}}
  • Same thread_id resumes, new thread_id starts blank

Cheat Sheet

Quick recap

quick ref
  • Checkpointer saves
  • thread_id is the slot
  • Durable = resume
  • Postgres in prod

Common Mistakes

  • Invoking without thread_id while a checkpointer is attached — or the opposite, expecting resume with no checkpointer
  • MemorySaver in production (RAM dies with the process)
  • Non-idempotent refunds inside a node that can be retried