07 / 22IntermediateHuman-in-the-Loop

Human-in-the-Loop

Interrupt for human approval

The graph pauses mid-execution and surfaces the agent's proposed action to a human. Execution only continues after the human approves, modifies, or rejects the action.

Human-in-the-Loop (HitL) enables safe deployment of agentic systems by requiring a human to review the agent's proposed next action before any irreversible operation occurs. The `interrupt()` function pauses graph execution and returns the proposed action to the caller — no tool is run, no data is written.

LangGraph's `MemorySaver` checkpointer persists the full graph state while waiting for human input. When the human responds, the caller resumes execution with `Command(resume={"approved": True})` and a thread ID that identifies which paused run to continue.

This pattern is essential for any agent that writes to databases, sends emails, deploys infrastructure, or takes actions with real-world consequences. The cost of the added latency is far outweighed by the ability to catch and correct errors before they propagate.