All Agent Engineering

Pause a LangGraph task and resume it after human approval

Check an approval node by interrupt payload, Command resume, and resume order.

AINavWritten / Updated
On this page

At a glance

The hard part of an approval node is resuming, not pausing. The same thread ID, the value written back into the node, and the fact that the node restarts from its beginning decide whether an approval result can be trusted. This walkthrough takes one graph node that needs human confirmation and organizes the interrupt payload design, the Command resume call, and the checks on resume order. It relies only on the supplied LangGraph interrupts documentation.

Runtime and applicability

Article type
Engineering practice
Verified
Applies to
  • LangGraph Pause a LangGraph task and resume it after human approval

Execution locations and responsibilities

  • LangGraph graph runtime and application host Use the workflow below to distinguish responsibilities of the caller, runtime, and external actions.
Engineering workflow order
Engineering workflow order1. Confirm the approval node, checkpointer, and thread ID → 2. Design the interrupt payload → 3. Review the code before interrupt → 4. Run once and read the payload → 5. Resume with Command resume → 6. Check the order after resume. Arrows show the order of checks in the guide. Follow each step’s prerequisites, branches and stop conditions; unexecuted steps are not completed work.1. Confirm the approval node, checkpointer, and thread ID2. Design the interrupt payload3. Review the code before interrupt4. Run once and read the payload5. Resume with Command resume6. Check the order after resume

Arrows show the order of checks in the guide. Follow each step’s prerequisites, branches and stop conditions; unexecuted steps are not completed work.

When to use

  • Calling interrupt() inside a node suspends the graph and saves state through the checkpointer. The documentation says the value passed must be JSON-serializable and is returned to the caller. With event streaming the payload appears on stream.interrupts, and stream.interrupted being true means the run paused. With the default invoke() the payload is under __interrupt__ in the result. The position to resume from is identified by thread_id in config, and production use calls for a durable checkpointer.

When not to use

  • This does not cover static breakpoints set with interrupt_before or interrupt_after; the documentation says static interrupts are not recommended for human-in-the-loop workflows and are meant for debugging.
  • InMemorySaver and MemorySaver appear only in documentation examples, so they do not justify a production persistence choice; production needs a durable checkpointer.
  • The flow does not replace deduplication in the external system; a side effect after approval can still repeat if the node fails and is retried.

Prerequisites and input

  • You have identified the graph node that needs human approval and know its upstream and downstream nodes.
  • The graph can be compiled with a checkpointer, and the caller can supply a stable thread_id for each approval task.
  • The caller (the application host) can show the interrupt payload and turn the person's decision into a JSON-serializable value.

Engineering checks

Pause contract: payload, persistence, and thread pointer — Calling interrupt() inside a node suspends the graph and saves state through the checkpointer. The documentation says the value passed must be JSON-serializable and is returned to the caller. With event streaming the payload appears on stream.interrupts, and stream.interrupted being true means the run paused. With the default invoke() the payload is under __interrupt__ in the result. The position to resume from is identified by thread_id in config, and production use calls for a durable checkpointer.

Resume contract: Command resume and the return value — To resume, call the graph again with Command(resume=...). The value becomes the return value of interrupt() inside the node, and the thread_id must match the one used when the pause happened; a new value gives a new thread with empty state. The documentation stresses that Command(resume=...) is the only Command pattern meant as input, while update, goto, and graph are for node returns. When several parallel interrupts are pending, each interrupt id is paired with its resume value in one call. If response_schema is declared, a Pydantic validation failure raises pydantic.ValidationError, and you can retry on the same thread; the documentation notes this parameter needs langgraph>=1.2.12.

Replay order: the node runs from the start — Resuming does not continue from the interrupt() line. The whole node runs again from its start, so earlier code executes a second time. When one node has several interrupt() calls, matching is index-based, so they must not be skipped conditionally, driven by non-deterministic loops, or wrapped in a bare try/except. For input validation, the documentation recommends calling interrupt() once per node invocation, storing the re-prompt in state, and routing back with a conditional edge.

1. Confirm the approval node, checkpointer, and thread ID

Where: the graph compile and invoke code. Input: the name of the node to approve and the planned thread_id. Action: confirm the graph is compiled with a checkpointer and write down how the ID is stored with each approval task. Completion check: the record names the node, the checkpointer type, and where the ID comes from. Stop condition: if there is no checkpointer, or the ID is regenerated on every call, fix that before designing the payload.

2. Design the interrupt payload

Where: the body of the approval node. Input: what the reviewer needs to see. Action: shape the question and details as a string or a dictionary of simple values, and describe the expected reply with response_schema if useful. Completion check: the payload contains no functions, class instances, or other complex objects. Stop condition: if the content cannot be serialized, pass only an identifier and let the caller look up details itself.

3. Review the code before interrupt

Where: the statements before and around interrupt() in the same node. Input: the node source. Action: find external writes that would run again on replay and make them idempotent, move them after interrupt(), or split them into a separate node; also confirm no bare try/except wraps the call and that multiple calls keep a fixed order. Completion check: every pre-interrupt side effect has a written conclusion on whether repeating it is safe. Stop condition: if a record-creating or list-appending write sits before the pause with no deduplication, do not approve the design.

4. Run once and read the payload

Where: the caller. Input: the initial input and the chosen thread_id. Action: drive the run with graph.stream_events(..., version="v3") and read stream.interrupted and stream.interrupts; with invoke(), read __interrupt__ instead. Completion check: the payload read matches the design from step two. Stop condition: if the run should have paused but no payload appears, check the thread ID, the routing, and whether the node actually ran before looking elsewhere.

5. Resume with Command resume

Where: the caller's second call. Input: the approval decision and the same thread_id. Action: pass Command(resume=...); when several interrupts are pending, match each interrupt id to its own value; do not use Command(update=...) as input to continue a conversation. Completion check: the node receives the decision and takes the expected branch. Stop condition: on a validation error, retry on the same thread with a corrected value; if the thread ID turns out to have changed, stop and rebuild the mapping.

6. Check the order after resume

Where: the nodes after approval and the external systems. Input: logs or records from before and after the resume. Action: compare against the step-three list, confirm that repeated pre-interrupt code created no duplicate writes, and that post-approval side effects happen only on the approved branch. Completion check: the number of times each external action occurred matches what you expected. Stop condition: if a failure after a side effect is committed would make a retry write again, require deduplication in the external system before release.

Task example

This is a hypothetical manual walkthrough, not a test that has been executed. Imagine a node named refund_review that pauses before a refund is issued, with the thread ID demo-case-01. The payload is a dictionary with two simple fields, question and details. As the documentation describes it, the caller is expected to read that dictionary from stream.interrupts after the first run, and if the earlier write that marks the case as pending is an upsert, replaying it on resume should not add records. Passing Command(resume=True) is then expected to send the node down the approved branch, with the refund action appearing once. Every statement here is an expectation drawn from the documentation and still has to be verified in your own environment.

Completion checks

  • Pause stage: the payload is serializable, the checkpointer and thread_id are in place, and the caller actually read the payload.
  • Resume stage: Command(resume=...) was sent with the same thread_id, the node received the return value correctly, and with multiple interrupts each id is paired with its value.
  • Replay stage: when the node reruns from the start, pre-interrupt side effects are idempotent, and the number and order of interrupt() calls are fixed and not caught by a bare exception handler.

Verification scope

Only the supplied LangGraph interrupts documentation was read. Installation, login, API execution, and output were not tested, and the observations in the example are expectations based on the documentation, not verification results. The documentation gives no convention for connecting an approval interface to a specific front end, so that part is out of scope.

Sources

All links are official pages; verification dates are listed per source, and links point to the version checked.

  1. LangGraph · LangGraph documentation: langgraph-interrupts

Found an error? Tell us →