Pausing an agent mid-run: interrupt() and human approval in LangGraph
Some actions are too consequential to let an agent take unsupervised. LangGraph can pause a run at a sensitive step, wait for a human to approve or edit, and resume exactly where it left off. Here's how — and why the checkpointer makes it possible.
For anything irreversible — sending an email, issuing a refund, filing a document — you don't want the agent acting alone. You want it to stop, show a human what it's about to do, and continue only on approval. LangGraph makes this a first-class capability, and it rests on the same machinery as its persistence.
The checkpointer is what makes pausing possible
You can only pause and resume a run if its state was saved at the pause point — which is exactly what a checkpointer does after every step (the langgraph-internals post). Without persistence, 'pause' would mean holding a live process open indefinitely; with it, the run's full state is durably stored, the process can go away entirely, and a resume days later picks up from the saved checkpoint. Human-in-the-loop is persistence, used for approval.
interrupt() and interrupt_before
There are two ways to pause. interrupt_before at compile time stops the graph before a named sensitive node runs, surfacing the pending state to you. Or, inside a node, the interrupt() function pauses execution and surfaces a value — 'here's what I'm about to do' — for a human to see. Either way the run halts with its state checkpointed, waiting.
from langgraph.types import interrupt, Command
def act_node(state):
decision = interrupt({'about_to': state['pending_action']}) # pause, surface to a human
if decision == 'reject':
return {'status': 'cancelled'}
... # proceed on approve
# later — a human approves; resume the exact run via its thread_id
app.invoke(Command(resume='approve'), {'configurable': {'thread_id': tid}})Approve, edit, or reject
Resuming with Command(resume=value) isn't only a yes/no gate — the value you pass back becomes the result of the interrupt, so a human can approve, reject, or edit. Approve and it proceeds; reject and it takes the cancel path; pass a corrected value and the agent continues with the human's edit instead of its own proposal. That's the shape a real workflow needs: not just a kill switch, but a review step where a person can fix the agent's plan before it acts.
Human-in-the-loop isn't a feature bolted onto the agent — it's the checkpointer letting you freeze a run at the dangerous step, hand it to a person, and thaw it exactly where it stopped.