Human approval
Pause before sending an email, making a tool call, or performing another consequential action.
AI Agents · Function
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.
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.
interrupt<R>(value: unknown): R| Name | Type | Description |
|---|---|---|
value | unknown | Value presented to the caller when execution is interrupted; it is available in task.interrupts[].value. |
The resume value provided when the graph is re-invoked with a Command.
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.
Pause before sending an email, making a tool call, or performing another consequential action.
Wait for an external decision or edited content before continuing a workflow.
Place several checkpoints in one node and handle their responses in order.
CommandGraphInterruptRuntime.interrupttask.interrupts