langchain-middleware

Pause tool calls in LangChain-like agents until human approval is provided.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/Hanseooo/hanseo-opencode-workflows --skill langchain-middleware-hanseooo
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: langchain-middleware
Source: https://github.com/Hanseooo/hanseo-opencode-workflows/tree/main/skills/langchain-middleware
Command: npx skills add https://github.com/Hanseooo/hanseo-opencode-workflows --skill langchain-middleware-hanseooo

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides human-in-the-loop middleware to pause before dangerous tool calls and require human approval, preventing unsafe automation from executing harmful actions.

Core Features & Use Cases

  • HumanInTheLoopMiddleware integration to halt tool calls until a decision is provided.
  • Customizable decision flows (approve, edit, reject) and command-based resume.
  • Per-tool policies and hooks (before_model, after_model, wrap_tool_call) to orchestrate safe automation.

Quick Start

Attach the HITL middleware to an agent and run a workflow that pauses before sensitive 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 dangerous tool calls in LangChain?

You can add human-in-the-loop approval by attaching middleware to your LangChain agent that pauses execution before dangerous tool calls and requires a human decision to resume. It supports approve, edit, or reject flows.

What are human-in-the-loop hooks for pausing agent execution?

Human-in-the-loop hooks are middleware events like before_model, after_model, and wrap_tool_call that intercept agent execution to require human approval, enabling safe automation by preventing harmful actions.

Can I set per-tool policies to require approval only for sensitive agent actions?

Yes, you can configure per-tool policies within the middleware to selectively require human approval for specific dangerous tools, while allowing safe tools to execute automatically without pausing.

How do I resume a LangChain agent after a human approves or edits a tool call?

You resume a LangChain agent using a Command-based resume mechanism after a human provides a decision. The middleware supports approve, edit, or reject decisions to continue the paused execution flow.

Do I need a checkpointer to implement human-in-the-loop middleware for agents?

Yes, a checkpointer is required to satisfy the middleware requirements, ensuring the agent state is persisted correctly while execution pauses to wait for human approval before resuming.

What is the best way to prevent unsafe automation from executing harmful agent actions?

The best way to prevent unsafe automation is integrating human-in-the-loop middleware that halts dangerous tool calls until a human provides explicit approval, utilizing per-tool policies and hooks for orchestration.