langchain-middleware
仓库创建 2026年1月22日最近提交 7 小时前SkillHot 收录 1 小时前
▸ 精选理由
适合引入人类审查与自定义拦截钩子的生产环境。
这个 Skill 做什么
提供中间件模式:人类审批、拦截、重试与结构化输出。
给 LangChain 代理加中间件来拦截和控制工具调用:可以在敏感调用前暂停人工审批(HumanInTheLoopMiddleware)、做重试、记录日志或统一错误处理,并在人工决定后继续执行。需要可审计或有人介入的自动化流程时用。还支持把输出做成结构化 schema(Pydantic、Zod),方便验证和后续处理。
▸ 展开 SKILL.md 英文原文
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.
1.1k
Stars
85
Forks
22
仓库内 Skill
积累中
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/langchain-ai/langchain-skills/main/config/skills/langchain-middleware/SKILL.md或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/langchain-ai/langchain-skills/main/config/skills/langchain-middleware/SKILL.md"SKILL.MD 节选查看完整文件 ↗
<overview> Middleware patterns for production LangChain agents: - **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) **Requirements:** Checkpointer + thread_id config for all HITL workflows. </overview> --- ## Human-in-the-Loop <ex-basic-hitl-setup> <python> Set up an agent with HITL middleware that pauses before sending emails for approval. ```python from langchain.agents import create_agent from langchain.agents.middleware import HumanInTheLoopMiddlew
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有