interrupt()
Pauses the graph before a risky node. It resumes when the user approves.
Last updated
Analogy
A confirm() dialog that can wait days, because the state is saved in the meantime.
In an agent
The building block for human-in-the-loop approval on write actions.
Practice
Flashcards
- What is human-in-the-loop?The agent pauses for a person to approve an action before it runs.
- Interview: what does LangGraph add to LangChain?Explicit graphs with state, checkpoints, interrupts and routing, so complex agents are easier to control.
Questions people ask
What does interrupt do in LangGraph?
interrupt pauses the graph at a chosen point, usually just before a risky node such as sending an email or issuing a refund. The state is saved by the checkpointer, so the pause can last minutes or days. When the user approves, the graph resumes from that exact point.
How do I add human approval to a LangGraph agent?
Call interrupt in the node before the risky action, or interrupt before that node when compiling the graph, and use a checkpointer. Show the proposed action to a person. When they approve, invoke the graph again with the same thread_id and a resume command, and it continues from where it paused.