langchain-middleware

langchain middleware

langchain-ai 952 ↓ 11k updated 26d ago
Claude Code
View source ↗

What it does

  • 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)
  • Which tools require approval (per-tool policies)
  • Allowed decisions per tool (approve, edit, reject)
  • Custom middleware hooks: beforemodel, aftermodel, wraptoolcall, beforeagent, afteragent
  • Tool-specific middleware (apply only to certain tools)

Requirements & configuration

  • Step 1: Agent runs until it needs to call tool
  • // Step 1: Agent runs until it needs to call tool
  • Edit the tool arguments before approving when the original values need correction.
  • Which tools require approval (per-tool policies)
  • HITL middleware requires a checkpointer to persist state.

Derived from the skill's own SKILL.md documentation · extracted 2026-07-23

langchain middleware

Source

Repository: https://github.com/langchain-ai/langchain-skills

langchain-middleware FAQ

What does the langchain-middleware skill do?

INVOKE THIS SKILL when you need human-in-the-loop approval, custom middleware, or structured output. Covers HumanInTheLoopMiddleware for human approval of dangerous tool calls, creating custom middleware with hooks, Command resume patterns, and structured output with Pydantic/Zod. HumanInTheLoopMiddleware / humanInTheLoopMiddleware: Pause before dangerous tool calls for human approval Custom middleware: Intercept tool calls for error handling, logging, retry logic

What does langchain-middleware require?

Step 1: Agent runs until it needs to call tool // Step 1: Agent runs until it needs to call tool Edit the tool arguments before approving when the original values need correction. Which tools require approval (per-tool policies) HITL middleware requires a checkpointer to persist state.

How do I install langchain-middleware?

Run: npx -y skills add https://github.com/langchain-ai/langchain-skills --skill langchain-middleware --agent claude-code — the source lives at github.com/langchain-ai/langchain-skills.

Maintain langchain-middleware?

Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.

langchain-middleware on getagentictools
[![langchain-middleware on getagentictools](https://getagentictools.com/badge/skills/langchain-ai-langchain-skills-langchain-middleware.svg)](https://getagentictools.com/skills/langchain-ai-langchain-skills-langchain-middleware?ref=badge)
npx agentictools info skills/langchain-ai-langchain-skills-langchain-middleware

The second line is the CLI lookup for this page — handy in READMEs and docs.