Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

AI Agents · Const

Interrupt

interrupt pauses a graph node and exposes a value to the caller. Re-invoking the graph with Command and a resume value makes that value available as interrupt's result.

How it works

Call interrupt inside a graph node to suspend execution and expose a payload to the caller. With persistence and a thread ID, re-invoke the graph using Command({ resume }); that resume value becomes the return value of interrupt. Avoid catching the interruption unless the special graph interruption is rethrown.

Syntax

interrupt<R>(value: R): R

Parameters

NameTypeDescription
valueRThe value supplied to the caller when execution pauses; it must be JSON-serializable.

Returns

The resume value provided when the graph is re-invoked with a Command.

Key points

  • interrupt is a function for pausing execution at a chosen point inside a graph node.
  • After resumption, interrupt evaluates to the value supplied through Command's resume input.
  • Without an available resume value, the call signals suspension by throwing GraphInterrupt and carries the supplied payload.
  • A node may request several pauses; LangGraph processes those interrupt calls in sequence.
  • Continue a suspended run by invoking the graph again with a Command that contains resume data.

Common mistakes

  • Do not swallow the special GraphInterrupt exception; wrapping interrupt in try/catch can prevent normal pause behavior unless the exception is rethrown.
  • Pass only JSON-serializable data as the interrupt payload.
  • Compile with a checkpointer so execution state can be restored when the graph resumes.
  • Use the same thread ID when resuming so LangGraph locates the paused execution.

Example: Pause and resume a graph node

import { Command, interrupt, MemorySaver, StateGraph, Annotation } from "@langchain/langgraph";

const State = Annotation.Root({ approved: Annotation<boolean | undefined>() });
const checkpointer = new MemorySaver();
const graph = new StateGraph(State)
  .addNode("review", () => ({ approved: interrupt({ question: "Approve?" }) }))
  .addEdge("__start__", "review")
  .addEdge("review", "__end__")
  .compile({ checkpointer });

const config = { configurable: { thread_id: "review-1" } };
await graph.invoke({}, config);
const result = await graph.invoke(new Command({ resume: true }), config);
console.log(result.approved);

The node pauses with a JSON-serializable review payload, then resumes on the same thread when invoked with a Command containing the resume value.

When to use it

Human review

Pause a workflow for a person to approve, reject, or edit proposed output before downstream nodes continue.

External input

Stop execution while waiting for external information, then continue the same persisted run when the information arrives.

Sequential checkpoints

Insert several approval or input checkpoints into one node and handle each response in order.

Interview questions

QHow does interrupt pause and resume execution?

interrupt pauses the current node by raising a special graph interruption when no resume value is available. The payload is surfaced to the caller, and a later Command resume value is returned from the interrupt call.

Follow-up: What happens if a resume value is already available? The function returns that value instead of raising a new interruption, allowing the node to continue.

QWhat infrastructure is required for a resumable interrupt?

The graph needs persistence through a checkpointer and a thread ID in its configuration. Resume by invoking the graph again with Command containing the resume value.

Follow-up: Why is the thread ID necessary? It identifies the persisted execution whose state should be continued.

QCan a node contain multiple interrupts?

Multiple interrupts may occur in one node, and LangGraph handles them sequentially. Each call can pause and later receive its corresponding resume value.

Follow-up: What design constraint follows from sequential handling? The node must preserve a stable interrupt call order across executions.

  • Command
  • GraphInterrupt
  • MemorySaver
  • checkpointer
  • thread_id

Source: interrupt | LangGraph.js API Reference. Checked 2026-10-15.