Human-in-the-Loop
Some steps must not be autonomous. HITL is not a UI library — it is a first-class pause in the runtime so the graph can wait days.
A manager sign-off stamp on a purchase order. Work stops at the stamp. When the manager signs, the same order continues — it does not start a new order.
Visual Workflows
Start here — scroll inside each diagram frame to explore, then use + / − to zoom up to 200% if needed.
Overview
Scroll inside the frame to explore · use + / − to zoom up to 200%
Scroll inside the frame to explore · use + / − to zoom up to 200%
What to interrupt
Scroll inside the frame to explore · use + / − to zoom up to 200%
Interrupt writes and money. Do not interrupt every token — that is streaming, not HITL.
Approve, edit, or reject
Scroll inside the frame to explore · use + / − to zoom up to 200%
resume can be a boolean, edited state, or a reject that routes to Finish.
Key Takeaways
- 1.interrupt() pauses the graph inside a node and waits for a human value. You resume with Command(resume=value) on the same thread_id — that value becomes what interrupt() returns.
- 2.Use it before irreversible acts: refunds, emails, deletions, anything you cannot cheaply undo. A checkpointer is required. A pause with nowhere to save is just a crash.
- 3.Call interrupt(payload) inside the gate node. The payload is what your UI shows.
- 4.Resume with the same config thread_id and Command(resume=...). After resume, the node re-runs with determinism rules — keep the interrupt at a stable place in the function.
- 5.Static breakpoints exist too; interrupt() is the one you will actually ship.
Learn elsewhere
- →AG-UI — Phase 22
- →Checkpoints
Real Example
Scenario
Refund $480. Graph pauses with {amount: 480, order: 4411}. Agent shows a card. You click approve. Command(resume=True). create_refund runs once.
What you would do
Put interrupt in its own node (refund_gate), not buried in ToolNode. Show the payload in your UI. Never auto-resume in production for money.
Commands
Commands to Remember
interrupt(payload) # pause this threadCommand(resume=value) # same thread_idCheckpointer is mandatory for HITLGate money and email, not every token
Cheat Sheet
Quick recap
quick ref- •interrupt pauses
- •Command resumes
- •Same thread_id
- •Gate side effects
Common Mistakes
- ✕Calling interrupt without a checkpointer
- ✕Resuming on a new thread_id, which starts a blank graph
- ✕Interrupting inside a messy node so resume re-sends the email twice
