langchain-middleware

Coordinate human-in-the-loop approval and custom middleware for LangChain agents.

113|9|Updated Jan 24, 2026
One-click install
npx skills add https://github.com/langchain-ai/skills-benchmarks --skill langchain-middleware-langchain-ai
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: langchain-middleware
Source: https://github.com/langchain-ai/skills-benchmarks/tree/main/skills/main/langchain-middleware
Command: npx skills add https://github.com/langchain-ai/skills-benchmarks --skill langchain-middleware-langchain-ai

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Coordinate human-in-the-loop approval and custom middleware for LangChain agents.

Core Features & Use Cases

  • HITL middleware with per-tool policies and resume patterns
  • Custom middleware hooks and tool-call interception
  • Command resume and editing/reject flows for safe tool usage

Quick Start

Enable HITL middleware in your LangChain agent and specify per-tool decisions to control dangerous tool calls.

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 specific LangChain agent tool calls?

You can add human-in-the-loop (HITL) approval for specific LangChain agent tool calls by applying HITL middleware with per-tool policies. This allows you to configure custom middleware hooks to intercept, approve, edit, or reject dangerous tool calls before execution.

What is needed to persist state and resume LangChain agents after intercepting a tool call?

To persist state and resume LangChain agents after intercepting a tool call, you need a checkpointer for state persistence and Command-based resume semantics. These components enable safe tool usage by supporting interrupt, edit, and reject workflows across production agents.

Can I configure middleware hooks to intercept and reject dangerous tool calls in LangChain?

Yes, you can configure custom middleware hooks to intercept and reject dangerous tool calls in LangChain. The middleware supports per-tool configuration, enabling you to enforce safe tool usage policies through command resume, editing, and rejection flows.

Does LangChain human-in-the-loop middleware work with both Python and TypeScript implementations?

Yes, LangChain human-in-the-loop middleware works with both Python and TypeScript implementations. It enables per-tool HITL policies, hooks, and resume workflows across production agents in both languages, provided a checkpointer is used for state persistence.

How do Command-based resume semantics work for rejected LangChain agent tool calls?

Command-based resume semantics work for rejected LangChain agent tool calls by allowing the workflow to resume safely after human review. This mechanism integrates with the checkpointer to maintain state persistence during edit or reject flows for production agents.