Skip to main content
Start freeBook a walkthrough

1,000 credits to start. No credit card.

All guides

LangGraph
Human-in-the-Loop
AI Agents
Durable Execution

LangGraph Human-in-the-Loop: interrupt() in Production

LangGraph's interrupt() pauses a node and Command(resume=...) continues it. Production also needs Postgres, safe re-runs, routing, reminders and timeouts.

By Hagai Cohen and Maksim Markov

November 28, 2026

12 min read


The short answer

In LangGraph, a node calls interrupt(payload) to stop and ask for input. The graph saves its state through a checkpointer, and the caller gets the payload back. When the answer arrives, you call the graph again with the same thread_id and Command(resume=answer). The node restarts from its first line, and this time interrupt() returns the answer instead of pausing.

That primitive is all LangGraph gives you, and it is a good one. Getting it into production takes six more things you build yourself: a persistent checkpointer (Postgres, not InMemorySaver), nodes that are safe to re-run, a way to decide who to ask, a notification that reaches them, a mapping from their reply back to the thread, and a policy for deadlines, reminders and silence. Then you need to be able to see which runs are waiting and why.

This guide walks through the primitive with a working example, then each of those production pieces, and ends with a checklist. If you'd rather not build them, a platform such as Fruxon ships all six; the guide to human-in-the-loop AI agent platforms compares the options.

How interrupt() and Command(resume=...) work

Here is a minimal approval step for a refund that falls outside policy. The imports and calls follow the LangGraph interrupts docs:

from typing_extensions import TypedDict
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.graph import START, END, StateGraph
from langgraph.types import Command, interrupt


class State(TypedDict):
    order_id: str
    amount: float
    decision: str | None


def review_refund(state: State):
    # Pauses here on the first pass; returns the resume value on the second.
    decision = interrupt({
        "question": f"Refund ${state['amount']} on order {state['order_id']}? "
                    "Delivery was 9 days late; policy covers 7.",
        "options": ["full", "half", "decline"],
    })
    return {"decision": decision}


builder = StateGraph(State)
builder.add_node("review_refund", review_refund)
builder.add_edge(START, "review_refund")
builder.add_edge("review_refund", END)
graph = builder.compile(checkpointer=InMemorySaver())

config = {"configurable": {"thread_id": "refund-4471"}}

result = graph.invoke(
    {"order_id": "4471", "amount": 640.0, "decision": None}, config=config
)
print(result["__interrupt__"])  # the payload passed to interrupt()

# Later, possibly in another process, once someone answers:
graph.invoke(Command(resume="half"), config=config)

Three details matter:

  • A checkpointer is required. Without one there is nowhere to save the paused state.
  • The thread_id is the run's address. Whatever resumes the run must know it.
  • Payload location depends on the call style. The docs say plain invoke surfaces interrupts under result["__interrupt__"]; with version="v2" they come back on an interrupts field instead, and streaming has its own accessors. Check the docs for the version you run.

The docs also set a few rules worth reading before you write a real node: don't wrap interrupt() in a bare try/except (it works by raising, so you would swallow it), don't skip interrupt calls conditionally, keep several interrupts in a node in a stable order because resume values are matched by index, and prefer a conditional edge over a while True loop around interrupt().

Step 1: Use a checkpointer that survives a restart

InMemorySaver keeps checkpoints in RAM. The persistence docs say plainly that all checkpoints are lost when the process restarts. In a human-in-the-loop system that means every question waiting on a person disappears on your next deploy. SqliteSaver is described as local file storage for development.

For production, use Postgres:

# pip install -U "psycopg[binary,pool]" langgraph langgraph-checkpoint-postgres
from langgraph.checkpoint.postgres import PostgresSaver

DB_URI = "postgresql://user:pass@db:5432/agents"

with PostgresSaver.from_conn_string(DB_URI) as checkpointer:
    checkpointer.setup()  # first run only: creates the tables
    graph = builder.compile(checkpointer=checkpointer)

There is an async variant, AsyncPostgresSaver, in langgraph.checkpoint.postgres.aio. Two operational notes from the docs: the thread_id is stored in a column of limited length, so don't build it from long strings, and checkpoints accumulate, so plan a cleanup job for old threads. If you deploy on LangSmith Agent Server, persistence is handled for you.

Step 2: Make the node safe to run twice

This is the detail that causes real incidents. On resume, the node does not continue from the interrupt() line; it runs again from the top. Anything before the interrupt happens twice.

Picture an invoice agent that creates a draft credit note, then asks a person to approve it:

def bad_node(state):
    note = erp.create_credit_note(state["invoice_id"], state["amount"])  # runs twice
    ok = interrupt({"question": "Approve credit note?", "note_id": note.id})
    ...

On resume you get a second credit note. Three ways to fix it, in order of preference:

  1. Put side effects after the interrupt. Ask first, then act on the answer.
  2. Split the work into separate nodes. A node that only asks, followed by a node that acts. Completed nodes are not re-run.
  3. Make the effect idempotent. Use an idempotency key derived from the thread and step, or check whether the record exists before creating it. The docs recommend exactly this for anything that must sit before an interrupt.

The same applies to LLM calls before the interrupt. They cost money and may return a different answer the second time, so the question the person sees could differ from the one they answered. Compute the question in an earlier node and store it in state.

Step 3: Decide who gets asked

interrupt() returns a payload to whoever called the graph. It has no idea who should answer. That decision is yours, and it decides whether the question gets answered at all.

The common shortcut is posting every question to one Slack channel. A question addressed to everyone is owned by no one. Instead, keep a small table of people and the decisions they own, and include the area in the interrupt payload so your code can route on it:

AreaOwnerNext contact
Refunds above policyDanaRefunds team lead
Invoice vs PO mismatchPriyaAP manager
Vendor bank-detail changeFinance controllerCFO

Keep that table on the people, not hard-coded in each graph, so a role change is one edit. Also check availability before sending: someone on leave should be skipped, not waited on. More on this in how to make an AI agent ask a human.

Step 4: Notify them and map the reply back to the thread

After invoke returns with an interrupt, your service sends the question where the person works: a Slack message with buttons, an email with answer links, a Teams card. The hard part is the return trip. When Priya clicks "Approve" two hours later, a webhook arrives with a Slack message ID or an email token, not a thread_id.

So store a mapping when you send:

# your own table, not a LangGraph API
pending_questions.insert({
    "question_id": new_id(),          # goes into button values / answer links
    "thread_id": config["configurable"]["thread_id"],
    "asked": "priya@example.com",
    "channel": "slack",
    "message_ref": slack_ts,
    "status": "open",
    "asked_at": now(),
})

# in the Slack/email webhook handler
q = pending_questions.get(question_id_from_payload)
if q and q["status"] == "open" and reply_is_from(q["asked"]):
    pending_questions.close(q["question_id"])
    graph.invoke(Command(resume=decision),
                 config={"configurable": {"thread_id": q["thread_id"]}})

Notice what this has to handle: checking that the reply comes from the person you asked (in a shared channel anyone can click), ignoring a second click, and closing the question so it can't be resumed twice. Resume in a worker, not in the webhook request, because the graph may run for a while after it wakes.

Step 5: Set deadlines, reminders and a plan for silence

The interrupt docs describe no timeout. A paused thread waits in Postgres until something resumes it. That is the right primitive, but it means "nobody answered" is invisible unless you build a scheduler:

  • Reminders. If the question is still open after a few hours, nudge the same person, ideally in the same thread.
  • Next contact. If the owner is away or unreachable, ask the next person in the table.
  • Deadline and default. When the deadline passes, resume the run yourself with a value the graph understands, for example Command(resume={"decision": "timeout"}), and let the graph take a safe path: hold the refund, flag the invoice, tell the customer when they'll hear back.
  • Never treat silence as approval for anything irreversible.

Designing that ladder is a topic of its own, covered in what an AI agent should do when nobody answers.

Step 6: Make the wait visible

Once questions can wait for hours, someone will ask "why hasn't order 4471 gone out?" You need to answer from data, not from grepping logs:

  • An operator view of open questions: who was asked, when, how many reminders went out. Your pending_questions table is most of it.
  • Thread state on demand. graph.get_state(config) shows where a thread stands.
  • Traces that include the wait. If you use LangSmith or Langfuse, record the question, the person, the time to answer and the answer on the trace, so a slow run shows a human step, not a mystery gap. See AI agent observability.

Production checklist

  • Persistent checkpointer (PostgresSaver / AsyncPostgresSaver), setup() run once, cleanup job for old threads
  • thread_id short and unique per job, stored with every outbound question
  • No non-idempotent side effects or LLM calls before interrupt() in the same node
  • No bare try/except around interrupt(); stable interrupt order within a node
  • Interrupt payload carries the question, context, options and decision area
  • Routing table of owners and next contacts, with availability checks
  • Notifications on the channels people already use
  • Reply handler that verifies the sender, rejects duplicates and resumes in a worker
  • Reminders, next contact, a deadline and a safe default resume value
  • Operator view of open questions, and the wait recorded on the trace
  • Answers stored with who decided and when, for audit

When LangGraph is the right choice

Be fair to it: LangGraph is a good choice when you want code-level control of the agent's control flow and state, an MIT-licensed runtime with no lock-in, and a team ready to build and run the database, notification, routing and operator pieces around it. Its pause and resume primitive is well designed, and if you later want managed hosting, LangSmith Agent Server takes care of persistence. What it deliberately doesn't do is decide who to ask, reach them, chase them or give up on them. That part is yours.

How Fruxon does it

Fruxon ships that whole loop as part of the platform. When an agent hits something it doesn't know, it calls its ask tool. The question is routed to a named person matched by expertise from your Directory (expertise is set once on the person, not in each agent) and sent where they work: Slack, Teams, Telegram, WhatsApp, SMS or email. The run is parked durably in Postgres, survives restarts, and waits hours or days, up to two weeks. On resume, the step is replayed with the tool results it already recorded, so tool calls made before the question are not executed again.

The person gets nudged if they go quiet. If they can't be reached, the next contact is asked, and if the wait runs out the question lands in the operator queue for someone to pick up. The wait shows up in the run's trace as a step like any other. Fruxon doesn't run agents built in other frameworks, so it is a replacement for a LangGraph runtime, not a layer on top of one. The exact defaults are in the Fruxon docs, and a side-by-side is on Fruxon vs LangGraph.

Frequently asked questions

How does interrupt() work in LangGraph?

Calling interrupt() inside a node pauses the graph, saves its state through the checkpointer and returns the payload you passed to the caller. You resume by invoking the graph again with the same thread_id and Command(resume=value). The node then runs again from its first line, and this time interrupt() returns the resume value.

Why does my LangGraph node run twice after resuming?

Because that is how resuming works: the runtime restarts the whole node from the beginning, not from the interrupt line. Any code before interrupt() runs a second time. Move side effects after the interrupt, split them into their own node, or make them idempotent so running them twice changes nothing.

Which LangGraph checkpointer should I use in production?

A persistent one, and for most teams that means PostgresSaver or AsyncPostgresSaver from the langgraph-checkpoint-postgres package. InMemorySaver keeps checkpoints in RAM, so every paused run is lost when the process restarts. SqliteSaver is local file storage meant for development.

Does LangGraph notify a person or time out an interrupt?

No. The interrupt docs cover pausing and resuming, not choosing a person, sending them a Slack message or email, reminding them, or giving up after a deadline. Those are application code you write around the primitive, along with mapping the reply back to the right thread_id.

Is LangGraph a good choice for human-in-the-loop agents?

Yes, when your team wants code-level control of the agent's control flow and is ready to build and run the surrounding pieces. LangGraph is MIT licensed and its pause and resume primitive is solid. The work is in everything around it: storage, routing, notifications, deadlines and an operator view.

Related: AI agent escalation patterns, n8n human-in-the-loop, human-in-the-loop AI, durable execution and Fruxon vs LangGraph.


All guides