Skip to content
Goal: Proficient✓ Sources verified 2026-11-24LangGraphCheckpointerinterrupt

LangGraph: State Graphs, Checkpoints and Interrupts ​

Understanding what problem a framework solves matters more than knowing its API. A common interview question: "What's the difference between a hand-written loop and LangGraph?"

Core concepts ​

ConceptMeaning
StateThe shared state flowing through the graph (usually a TypedDict / Pydantic model)
NodeA function that reads state and returns an update to it
Edge / conditional edgeDetermines the next node; a conditional edge picks a branch based on state and can form a loop (the agent loop)
CheckpointerPersists state after every step, keyed by thread_id per conversation
interrupt()Pauses graph execution inside a node and waits for external input (human approval)
Command(resume=...)Resumes execution; the resume value becomes the return value of interrupt()

How it works: which pain points of a hand-written loop it solves ​

  1. Resuming after failure: every step is checkpointed, so after a process restart it can continue from the last state.
  2. Human intervention: interrupt() saves the current state and suspends; after a human acts, resume with the same thread_id.
  3. Observability: every change to state is recorded, which makes replay easy.

The official docs stress that interrupt requires a checkpointer, and that production should use a persistent checkpointer (such as Postgres) rather than the in-memory one.

One semantic to watch out for ​

When execution resumes, the interrupted node re-runs from the beginning, so the code before interrupt() runs again. Don't put side effects (sending email, writing to external systems) before interrupt(), or make sure they are idempotent.

In practice: an approval node ​

python
from typing import TypedDict
from langgraph.graph import StateGraph, START, END
from langgraph.types import interrupt, Command
from langgraph.checkpoint.memory import InMemorySaver   # use a Postgres checkpointer in production

class S(TypedDict):
    draft: dict
    approved: bool

def extract(state: S):
    return {"draft": {"amount": 120000, "payment_days": 120}}

def human_review(state: S):
    decision = interrupt({"question": "Payment term > 90 days. Approve?", "draft": state["draft"]})
    return {"approved": decision["approved"], "draft": decision.get("draft", state["draft"])}

g = StateGraph(S)
g.add_node("extract", extract)
g.add_node("human_review", human_review)
g.add_edge(START, "extract")
g.add_edge("extract", "human_review")
g.add_edge("human_review", END)
app = g.compile(checkpointer=InMemorySaver())

cfg = {"configurable": {"thread_id": "task-42"}}
app.invoke({"draft": {}, "approved": False}, cfg)          # runs until it pauses at interrupt
# ... after the reviewer acts in the frontend:
app.invoke(Command(resume={"approved": True}), cfg)          # resumes from where it paused

Common pitfalls ​

  1. Shipping the in-memory checkpointer to production: every suspended task is lost when the process restarts.
  2. Side effects before interrupt: they run again on resume.
  3. Poor thread_id design: it should map to a business entity (such as a task ID), so the frontend can find tasks awaiting approval.
  4. The API changes fast: LangGraph iterates frequently, so follow the current official docs for example code.

Common interview questions ​

  1. What problem does LangGraph's checkpoint mechanism solve?
  2. When interrupt() resumes, where does the node start executing? What does that require of your code?
  3. What are the trade-offs between a hand-written agent loop and LangGraph?
  4. Both LangGraph and Temporal can "pause and wait for a human". What's the difference? (See Temporal)

How it relates to my projects ​

To be verified / may go stale

  • The import paths above (langgraph.types, langgraph.checkpoint.memory) follow the official docs as of 2026-11. LangGraph releases often, so check against the current docs before use.

Sources ​

Vin Amory · AI development × content creation · Technical notes cite official docs in each page’s sources section