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

AI Agents · Function

interrupt

Pauses execution of a graph node and exposes a value to the caller. When the graph is re-invoked with Command({ resume }), interrupt returns that resume value inside the node.

How it works

interrupt pauses a graph node and exposes its payload to the caller. Re-invoking the graph with Command({ resume }) supplies the value returned by interrupt, allowing the node to continue.

Syntax

interrupt<R>(value: unknown): R

Parameters

NameTypeDescription
valueunknownValue presented to the caller when execution is interrupted; it is available in task.interrupts[].value.

Returns

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

Key points

  • Use interrupt to pause execution at a chosen point in a node.
  • The call eventually evaluates to the resume value supplied when execution continues.
  • Without an available resume value, interrupt suspends the graph by raising a GraphInterrupt carrying the payload.
  • Continue a paused run by invoking the graph again with Command and resume.
  • The payload supplied to interrupt is exposed to the task's interrupt records.

Common mistakes

  • Do not swallow the control-flow exception: avoid try/catch around interrupt, or rethrow the GraphInterrupt from the catch block.
  • Multiple calls in one node are processed in order, so keep their sequence stable across resumption.

Example: Pause for human approval

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

const review = async () => {
  const approved = interrupt({
    message: "Approve this action?",
    action: "send_email"
  });
  return { approved };
};

// Resume the paused graph with:
new Command({ resume: true });

Call interrupt with a JSON-serializable payload to pause the node; invoke the graph again with Command and a resume value, which becomes the call's return value.

When to use it

Human approval

Pause before sending an email, making a tool call, or performing another consequential action.

External input

Wait for an external decision or edited content before continuing a workflow.

Sequential checkpoints

Place several checkpoints in one node and handle their responses in order.

  • Command
  • GraphInterrupt
  • Runtime.interrupt
  • task.interrupts

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