Interrupts, Resume and Human-in-the-Loop
`interrupt()` pauses a running graph, saves state through the checkpointer and hands a payload to the caller. `Command(resume=...)` on the same `thread_id` continues it. The interrupted node restarts from its first line, so most interview questions come down to re-execution, matching resume values to calls, and where side effects may safely go.
Key points
- 1
Requirements: a checkpointer passed to
compile()(durable, such asSqliteSaverorPostgresSaver, in production), athread_idinconfig["configurable"], and aninterrupt(payload)call with a JSON-serializable payload. Without a checkpointer the first run still returns__interrupt__, butCommand(resume=...)raisesRuntimeError. - 2
Where pauses show up: the default
invoke()result has a__interrupt__list ofInterrupt(value, id). Withversion="v2"you get aGraphOutputwhose.interruptsholds them, andstream_events(..., version="v3")exposesstream.interruptedandstream.interrupts.get_state(config).nextnames the paused node. - 3
Resume with
graph.invoke(Command(resume=value), config):valuebecomes the return value ofinterrupt().Command(resume=...)is the onlyCommandform meant as graph input. A plain dict sent to a paused thread starts a new run fromSTART, andinvoke(None, config)re-runs the node, which pauses again. - 4
On resume the whole interrupted node runs again from its first line. Code before
interrupt()repeats, so make it idempotent (for example an upsert), move side effects after the call, or put them in a separate later node. - 5
Several
interrupt()calls in one node are matched to resume values strictly by index. A node with N sequential interrupts starts N+1 times. Never skip, reorder or loop interrupt calls in ways that can differ between runs. - 6
Validation loops: call
interrupt()once per node run, keep the re-prompt text in state, and loop back with a conditional edge. Awhile Trueloop aroundinterrupt()replays every earlier iteration on each resume. - 7
Parallel interrupts (fan-out branches pausing in the same step) are resumed with a map,
Command(resume={interrupt.id: value}). A bare value with several pending interrupts raisesRuntimeError. A partial map finishes the answered branches, and the others pause again. - 8
Static breakpoints,
interrupt_before/interrupt_after, pause at node boundaries. You can set them oncompile()or pass them toinvoke()for one run, and you continue withinvoke(None, config). The docs recommend them for debugging, andinterrupt()for human-in-the-loop. You can edit state at a breakpoint withupdate_statebefore continuing. - 9
Subgraphs: interrupts propagate to the top-level graph however deep they are. If a subgraph is called inside a node, both the parent node and the subgraph node re-run from their tops on resume.
get_state(config, subgraphs=True).tasks[0].stateshows the paused subgraph's snapshot. - 10
Approval in tools: call
interrupt()at the top of the tool, before the side effect, and read edited arguments from the resume payload. To approve or reject, returnCommand(goto=...)from the node based on the decision, annotatedCommand[Literal[...]]. - 11
HumanInTheLoopMiddleware(increate_agent) is built oninterrupt(). In the defaultbatchedmode itsafter_modelhook raises one interrupt withaction_requestsandreview_configs, answered with{"decisions": [...]}in the same order.per_callmode raises one interrupt per gated call, answered by id. The decisions areapprove,edit,rejectandrespond. - 12
interrupt(payload, response_schema=Model)(langgraph>=1.2.12) validates the resume value with Pydantic, a TypedDict or a dataclass and returns the typed object. An invalid value raisesValidationErrorand the thread stays paused. A raw JSON Schema dict is only shown to clients and is not used for validation. In the Functional API, completed@taskresults are restored on resume rather than re-run.
Common traps
Wrapping
interrupt()intry/except ExceptionswallowsGraphInterrupt(anExceptionsubclass), so the graph never pauses.Branching on
if decision:when the resume value is a dict:{"approved": False}is truthy, so the action goes through.Resuming with a new
thread_iddoes not raise an error. It starts an empty thread that pauses again, and the original thread stays paused.InMemorySaverloses paused threads when the process restarts, so approvals that wait for hours need a database-backed saver.Renaming or removing the node a thread is paused in is not supported. In LangGraph 1.2 the resume silently does nothing (
next == ()).In batched HITL mode, even auto-approved tool calls from the same model turn wait for the review. A
whenpredicate runs again on resume, and if it flips toFalsearejectis ignored.Calling a node function that uses
interrupt()directly in a unit test raisesRuntimeError(no runnable context). Test through the compiled graph withInMemorySaver.
Read the source
Further reading
Suggest a resourceNo extra reading for Interrupts, Resume and Human-in-the-Loop yet. Found a guide, video or cheat sheet that made it click? Share it and help the next learner.
Test yourself on Interrupts, Resume and Human-in-the-Loop
Ten questions, with the answer and explanation after each one.