LangChain & LangGraph for AI Agents
Back to LangGraph for Stateful Agents & Human-in-the-Loop

Human-in-the-Loop Breakpoints and Interrupts

Pause the agent. Get human approval. Resume. The pattern that makes high-stakes agents shippable. FIND_VIDEO: search 'LangGraph human in the loop interrupt approval' — recommended channel: LangChain / Sam Witteveen. Aim for 10 min or under.

12 minutesVideo LessonPDF notes
🎯 Free Guest Mode: You are learning for free. Sign in to save your completion progress and quiz answers.
Loading progress...

Key moments

  1. Tool Definition with Interrupt — Import the interrupt function and create a hotel booking tool that prompts the user for action confirmation.
  2. Conditional State Branching — Add conditional logic to process acceptance, parameter modifications, or invalid responses from the interrupt payload.
  3. Agent and Checkpointer Setup — Instantiate an in-memory checkpointer and configure a ReAct agent using GPT-4o with tool binding.
  4. Triggering Graph Interruption — Execute the agent workflow under a designated thread ID to observe execution pausing at the tool interrupt.
  5. Resuming with Command — Resume the paused agent using a Command object carrying an accept payload to complete the reservation.
  6. Mid-Flight Argument Modification — Pass edited arguments through the resume command to alter hotel booking parameters before tool execution finishes.
PDF notes

Frequently asked questions

Why does interrupt() throw an error if no checkpointer is provided?

LangGraph requires state persistence to serialize and pause the execution frame. Without a checkpointer, the graph cannot store the paused state to resume later.

How does LangGraph map the resume payload to the specific paused tool?

LangGraph uses the `thread_id` in the config dictionary to retrieve the checkpoint where the interrupt was triggered and passes the payload directly to the paused call.

Can I use interrupts across an asynchronous REST API?

Yes. Persist the `thread_id` in your session or database, pause the request, and invoke `Command(resume=...)` on that `thread_id` upon receiving the API callback.

How was this lesson?

Your feedback helps us refine explanations and catch bugs.