Skip to main content

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:
Interrupts require a checkpointer. Without one, the graph cannot save state to resume later.

Using Interrupts

Basic Workflow

Streaming with Interrupts

Dynamic Interrupts

Trigger interrupts programmatically from within nodes:

Using interrupt()

The interrupt() function:
  1. First call: Raises GraphInterrupt, pausing execution
  2. Surfaces the interrupt value to the client
  3. Resume with value: On next invocation, returns the resume value
  4. 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

Be cautious with loops in interrupt logic. Each iteration re-executes the node from the start.

Error Handling

Retry After Human Review

Building HITL UIs

CLI Interface

Web API

Best Practices

  • 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
  • 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
  • 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
  • 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

  • Verify checkpointer is configured
  • Check interrupt_before/after configuration
  • Ensure node names are correct
  • For dynamic interrupts, verify interrupt() is called
  • Confirm thread_id matches
  • Check Command(resume=…) syntax
  • Verify interrupt ID for multi-interrupt nodes
  • Review node re-execution logic
  • 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