langchain-middleware

Insert human-in-the-loop approval before dangerous tool calls in LangGraph agents.

Updated May 29, 2026
One-click install
npx skills add https://github.com/patorn/langgraph-template --skill langchain-middleware-patorn
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: langchain-middleware
Source: https://github.com/patorn/langgraph-template/tree/main/.agents/skills/langchain-middleware
Command: npx skills add https://github.com/patorn/langgraph-template --skill langchain-middleware-patorn

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

LangGraph agents often require governance when invoking potentially dangerous tools. This Skill provides HumanInTheLoopMiddleware to pause, review, and approve or edit tool calls before they execute, ensuring safety and compliance in production workflows.

Core Features & Use Cases

  • HumanInTheLoopMiddleware for per-tool HITL gating and configurable allowed decisions
  • Custom middleware hooks: before_model, after_model, wrap_tool_call, before_agent, after_agent
  • Command resume patterns to continue after human decisions (approve, edit, reject)

Quick Start

Use this skill to insert a human-in-the-loop review step before dangerous tool calls in your LangGraph agents.

Frequently Asked Questions about langchain-middleware

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add human-in-the-loop approval for LangGraph tool calls?

You can implement human-in-the-loop approval for LangGraph tool calls using HumanInTheLoopMiddleware to pause execution, review arguments, and resume workflows after human decisions. It supports approve, edit, or reject actions.

What is human-in-the-loop middleware in LangGraph agents?

Human-in-the-loop middleware in LangGraph agents is a governance layer that intercepts dangerous tool calls before execution. It allows operators to review, edit, or reject tool arguments, ensuring safety and compliance in production workflows.

Can I customize hooks when pausing LangGraph agents for human review?

Yes, you can customize hooks when pausing LangGraph agents for human review. The middleware supports before_model, after_model, wrap_tool_call, before_agent, and after_agent hooks to intercept and modify agent behavior.

How do I resume a LangGraph agent after rejecting a tool call?

You resume a LangGraph agent after rejecting a tool call using command resume patterns. This mechanism continues the workflow by injecting human decisions, such as approve, edit, or reject, back into the agent graph.

Does LangGraph middleware work with checkpointer for state persistence?

Yes, LangGraph middleware works with checkpointer for state persistence. The human-in-the-loop middleware integrates with checkpointer and command resume patterns to maintain workflow state across human approval pauses.