October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsClean PCRecommendedOne scan can reveal what keeps slowing WindowsLook for cleanup and repair opportunities.Run ScanOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

Handle Human Replies in LangGraph with `Command` Instead of Extra Routing Logic

Use LangGraph’s interrupt-and-resume flow to collect a human reply, then route from the handling node with Command(goto=...) and update state when needed.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To route a LangGraph workflow based on a person’s reply, have the node that collects the reply return a Command with goto rather than adding a separate conditional-edge function for that decision. The node can also use update to change graph state. The interaction is a pause-and-resume cycle: call interrupt(), present its payload to a person, then resume the same thread with Command(resume=reply).

How the pause-and-resume cycle works

Place interrupt(payload) inside the node that needs a human decision. The payload is application-defined and should be JSON-serializable—for example, a question together with the proposal being reviewed. LangGraph pauses the graph and saves its current state through the configured checkpointer.

As an Amazon Associate I earn from qualifying purchases.

As LangChain’s interrupt documentation puts it: “When you call interrupt within a node, LangGraph saves the current graph state using the checkpointer and waits for you to resume execution with input.” The application receives the interrupt payload, displays it to a person, and collects a reply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To continue, invoke the graph again with Command(resume=reply) and the same thread configuration. The value supplied as reply becomes the return value of the suspended interrupt() call in the node. The node can then interpret that value and choose its next step.

Route from the node that handles the reply

A node can return Command(goto=destination, update=state_changes). goto selects the next node; update applies changes to the graph state. Use a typed destination annotation, such as Command[Literal["apply", "revise"]], where appropriate to make the permitted destinations explicit.

from typing import Literal
from langgraph.types import Command, interrupt

def review_node(state) -> Command[Literal["apply", "revise"]]:
    reply = interrupt({"question": "Approve this change?", "change": state["proposal"]})
    if reply["approved"]:
        return Command(goto="apply", update={"approved": True})
    return Command(goto="revise", update={"review_note": reply.get("note", "")})

This is illustrative pseudocode, not a tested, drop-in implementation. Adapt the state type, payload validation, and node names to your graph. LangChain’s tool-call review tutorial demonstrates the same general pattern: a human-review node returns Command(goto=...) to proceed with approval, modification, or feedback.

Keep conditional edges for decisions that belong elsewhere

Command and conditional edges are not mutually exclusive. Use Command when the node processing a human reply should make the routing decision, especially when that decision also updates state. A conditional edge remains suitable when routing logic belongs in graph-level routing—for example, deciding whether a model produced a tool call.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The documented review example uses both: a conditional edge handles a separate model-output decision, while the human-review node uses Command to route based on the person’s response. In the LangGraph.js Command API reference, Command is likewise described in terms of combining control flow with state updates.

Question Use Command when… Use a conditional edge when…
Where is the decision made? The node handling the reply makes the routing choice. Routing logic is separate from that node, such as a condition based on model output.
Should routing and a state change happen together? Yes; return goto and update from the node. The condition is handled in graph routing rather than as a combined node return.
Are valid destinations constrained? A typed Command destination annotation can express allowed nodes. Choose the conditional-edge approach when the condition itself is the clearest place to express the branch.

Configure state persistence and resume the same thread

A resumable interrupt depends on saved graph state and a thread identifier. Compile the graph with a checkpointer, then use the same thread configuration when resuming so the new invocation continues the paused execution rather than starting a different one.

The review tutorial uses an in-memory saver as an example. The interrupt guide recommends a persistent checkpointer for production, where execution may need to survive beyond the lifetime of one process. Choose the checkpointer to suit your deployment; the example’s in-memory saver is not a substitute for production persistence.

  1. Compile with a checkpointer. Use a saver appropriate to the environment in which the graph runs.
  2. Invoke the graph with a thread identifier. Retain the thread configuration associated with the paused run.
  3. Present the interrupt payload. Collect the person’s response in your application.
  4. Resume with the same thread configuration. Invoke the graph with Command(resume=reply); the resumed node receives that value from interrupt().
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Validate replies by re-entering the node

For input validation, the current interrupt guidance recommends one interrupt() call per node invocation. If a reply is invalid, save a revised prompt in state and route back to the node so it can pause again with the corrected prompt.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Avoid calling interrupt() repeatedly inside a while loop in one node invocation. On resume, LangGraph replays the node from its beginning, so work performed before the interrupt can run again. Graph-level re-entry makes each validation attempt a distinct invocation and avoids treating one resumed interrupt as a continuation in the middle of a loop.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.