Source: Human-in-the-loop middleware (LangChain docs)
LangChain's HumanInTheLoopMiddleware: per-tool interrupt policies, approve/edit/reject/respond decisions, batched vs per-call interrupts, and the checkpointer requirement.
Contents
- What: official open-source documentation (Python)
- Publisher: LangChain
- Date: accessed 2026-11-14
- Original: Human-in-the-loop
Summary
HumanInTheLoopMiddleware sits in a create_agent agent and raises a LangGraph interrupt whenever the model proposes a tool call that matches the policy. A reviewer answers with a decision per call, and the run resumes from the checkpoint.
Key claims
interrupt_onmaps tool name toTrue,False(auto-approve) or anInterruptOnConfigwithallowed_decisions,descriptionand awhenpredicate (langchain>=1.3.3; must evaluate the same on resume).- Decisions:
approve;edit(new name/args);reject(skip, optional message to the model);respond(return a message as the tool result without running it). Usereject, notrespond, to deny side-effecting tools, becauserespondlooks like success. - Batched mode (default): one interrupt carrying
action_requestsandreview_configs; resume withCommand(resume={"decisions": [...]})in the same order. - Per-call mode (
interrupt_mode="per_call",langchain>=1.4.6): one interrupt per gated call; resume with a dict keyed by interrupt ID. - A checkpointer and
thread_idare required;InMemorySaverfor prototypes, Postgres or MongoDB savers in production.