Overview
Human-in-the-loop (HITL) enables LangGraph agents to pause for human approval, input, or correction. This is critical for high-stakes decisions, quality control, and building trustworthy AI systems.Interrupt Points
The simplest HITL pattern: pause execution at specific nodes.Interrupt Before
Pause before a node executes:Interrupt After
Pause after a node completes:Interrupt All
Pause at every node:Using Interrupts
Basic Workflow
Streaming with Interrupts
Dynamic Interrupts
Trigger interrupts programmatically from within nodes:Using interrupt()
Theinterrupt() function:
- First call: Raises
GraphInterrupt, pausing execution - Surfaces the interrupt value to the client
- Resume with value: On next invocation, returns the resume value
- Node re-executes from the start with the resume value
Multiple Interrupts
A node can have multiple interrupt points:Resume values are matched to interrupts in the order they appear in the node’s execution.
Editing State During Interrupts
Modify state while paused:Update and Resume in One Step
Combine state update with resuming:Interrupt Metadata
Access detailed information about interrupts:Approval Workflows
Simple Approval
Multi-Level Approval
Review and Edit Workflows
Content Review
Interactive Editing
Error Handling
Retry After Human Review
Building HITL UIs
CLI Interface
Web API
Best Practices
When to Use HITL
When to Use HITL
- High-stakes decisions (financial, legal, medical)
- Quality control and content moderation
- Ambiguous situations requiring judgment
- Initial system deployment (reduce automation gradually)
- Compliance and audit requirements
- Training and validation scenarios
Interrupt Design
Interrupt Design
- Provide clear context in interrupt values
- Include relevant state data
- Offer specific action options
- Set appropriate timeout expectations
- Log all human decisions for audit
- Make interrupt points resumable
State Management
State Management
- Always use persistent checkpointers in production
- Test resume logic thoroughly
- Handle state updates gracefully
- Validate human input before resuming
- Consider versioning for long-running workflows
User Experience
User Experience
- Show progress before and after interrupts
- Provide clear instructions to humans
- Display relevant context efficiently
- Support undo/redo when possible
- Track and display approval history
Troubleshooting
Interrupts not triggering
Interrupts not triggering
- Verify checkpointer is configured
- Check interrupt_before/after configuration
- Ensure node names are correct
- For dynamic interrupts, verify interrupt() is called
Resume not working
Resume not working
- Confirm thread_id matches
- Check Command(resume=…) syntax
- Verify interrupt ID for multi-interrupt nodes
- Review node re-execution logic
State not persisting
State not persisting
- Use persistent checkpointer (not InMemorySaver in production)
- Verify database connectivity
- Check thread_id consistency
- Review checkpoint write logs
Next Steps
Checkpointing
Deep dive into state persistence for HITL
Streaming
Stream events to build responsive HITL UIs