langchain-middleware

Installation
Summary

Human-in-the-loop approval, custom middleware, and structured output patterns for LangChain agents.

  • HumanInTheLoopMiddleware pauses execution before dangerous tool calls, allowing humans to approve, edit arguments, or reject with feedback
  • Per-tool interrupt policies let you configure different approval rules based on risk level; requires a checkpointer and thread_id for state persistence
  • Command resume pattern continues execution after human decisions, with support for editing tool arguments before approval or providing rejection feedback
  • Custom middleware hooks (before_model, after_model, wrap_tool_call, before_agent, after_agent) enable error handling, logging, and retry logic across the agent lifecycle
SKILL.md
  • HumanInTheLoopMiddleware / humanInTheLoopMiddleware: Pause before dangerous tool calls for human approval
  • Custom middleware: Intercept tool calls for error handling, logging, retry logic
  • Command resume: Continue execution after human decisions (approve, edit, reject)

Requirements: Checkpointer + thread_id config for all HITL workflows.


Human-in-the-Loop

Related skills
Installs
6.1K
GitHub Stars
678
First Seen
Mar 4, 2026