langchain-middleware

Configure human-in-the-loop approval middleware for LangChain agents.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

LangChain agents often require guarded decision points to prevent dangerous tool usage; this skill provides a structured HITL middleware framework and hooks to manage human approvals and output shaping.

Core Features & Use Cases

  • HumanInTheLoopMiddleware for pausing before dangerous tool calls and collecting human decisions
  • Custom middleware hooks (wrap_tool_call, before_model, after_agent) to intercept and modify tool/model behavior
  • Command resume patterns to continue execution after human input, including edits and feedback
  • Per-tool HITL policies and thread_id-based state tracking for robust auditability
  • Language-agnostic examples (Python and TypeScript) illustrating integration with common LangChain tooling

Quick Start

Configure an agent with HITL middleware (and a MemorySaver checkpointer), then run an interrupt/resume workflow.

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 to LangChain agents?

Add human-in-the-loop approval to LangChain agents by configuring HumanInTheLoopMiddleware to pause execution before dangerous tool calls, collect human decisions, and resume the workflow using command patterns.

What are LangChain middleware hooks for intercepting tool calls?

LangChain middleware hooks intercept and modify tool or model behavior during agent execution. Supported configurable hooks include wrap_tool_call, before_model, and after_agent to shape inputs and outputs dynamically.

How do I resume a LangChain agent workflow after a human decision?

Resume a LangChain agent workflow after a human decision by using command resume patterns, which continue execution from the interruption point while supporting argument edits and human feedback integration.

Does human-in-the-loop middleware require a checkpointer for state tracking?

Yes, human-in-the-loop middleware requires a checkpointer for persistence and thread_id tracking to maintain robust auditability and state management across interruption and resume cycles.

Can I apply per-tool human approval policies in LangChain agent workflows?

Yes, you can apply per-tool human approval policies in LangChain workflows to enforce guarded decision points and prevent dangerous tool usage on specific tools within the same agent.

Does this human-in-the-loop LangChain middleware work with TypeScript?

Yes, this human-in-the-loop LangChain middleware works with TypeScript and Python, providing language-agnostic examples that illustrate integration with common LangChain tooling.