0
Phase 8

Checkpoints & Persistence

~2 min read

Concept & How It Works

    Why Does It Exist?

    Production agents run for minutes, call expensive tools, and wait for human approval. Without persistence, a server restart loses all progress and duplicates side effects.

    Real-World Analogy

    Checkpoints are save points in a video game — you can quit, come back later, or rewind to see what the agent was thinking at step 3.
    Loading diagram...

    Visual Workflows

    What is Checkpoints & Persistence?

    Loading diagram...

    Example

    Scenario

    Agent drafts a refund email, pauses at `human_review` checkpoint. Manager approves 2 hours later; graph resumes from exact state without re-running search.

    Solution

    In Agent Frameworks, apply Checkpoints & Persistence to this scenario: Agent drafts a refund email, pauses at `human_review` checkpoint. Identify the inputs, run the technique, validate the output, and note one thing you would monitor in production.

    Practice Task

    Do this before moving to the next module — reading alone is not enough.

    Open the Code Walkthrough below and run it locally. Change one parameter related to Checkpoints & Persistence (e.g. model, temperature, top_k, or tool name), observe the difference in output, and write 2–3 sentences explaining what changed.

    Code Walkthrough

    Highlighted lines show where Checkpoints & Persistence happens in the code.

    Checkpoints & Persistence
    1from langgraph.checkpoint.sqlite import SqliteSaver  # import dependencies2
    3memory = SqliteSaver.from_conn_string("checkpoints.db")  # key line for Checkpoints & Persistence4app = graph.compile(checkpointer=memory, interrupt_before=["human_review"])5
    6config = {"configurable": {"thread_id": "ticket-8842"}}7app.invoke({"messages": [{"role": "user", "content": "Refund request"}]}, config)

    Commands to Remember

    Commands to Remember

    • pip install langgraph langchain-openai # LangGraph agent framework
    • pip install openai-agents # OpenAI Agents SDK
    • pip install crewai # multi-agent CrewAI framework

    Common Mistakes

    • Treating Checkpoints & Persistence as a black box without evaluation
    • Ignoring cost and latency in production
    • Skipping error handling for langgraph checkpoints

    Cheat Sheet

    Quick recap — the most important points from this module.

    Cheat Sheet

    quick ref
    • Checkpoints & Persistence
    • thread_id
    • PostgresSaver
    • interrupt_before