sameeh07/agent-skills/langchain-middleware
Claude Code and agent skill by sameeh07/agent-skills
- community
Checking that the SKILL.md file is still in the repository.
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.
Install
npx vskill@latest install sameeh07/agent-skills/langchain-middlewareSKILL.md
The same SKILL.md was published earlier as sameeh07/agent-skills/langchain-middleware.
<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> <typescript> Set up an agent with HITL that pauses before sending emails for human approval.
</typescript> </ex-basic-hitl-setup>
<ex-running-with-interrupts> <python> Run the agent, detect an interrupt, then resume execution after human approval.
</python> <typescript> Run the agent, detect an interrupt, then resume execution after human approval.
</typescript> </ex-running-with-interrupts>
<ex-editing-tool-arguments> <python> Edit the tool arguments before approving when the original values need correction.
</python> <typescript> Edit the tool arguments before approving when the original values need correction.
</typescript> </ex-editing-tool-arguments>
<ex-rejecting-with-feedback> <python> Reject a tool call and provide feedback explaining why it was rejected.
</python> </ex-rejecting-with-feedback>
<ex-multiple-tools-different-policies> <python> Configure different HITL policies for each tool based on risk level.
</python> </ex-multiple-tools-different-policies>
<boundaries>
What You CAN Configure
- Which tools require approval (per-tool policies)
- Allowed decisions per tool (approve, edit, reject)
- Custom middleware hooks:
before_model,after_model,wrap_tool_call,before_agent,after_agent - Tool-specific middleware (apply only to certain tools)
What You CANNOT Configure
- Interrupt after tool execution (must be before)
- Skip checkpointer requirement for HITL
</boundaries>
<fix-missing-checkpointer> <python> HITL middleware requires a checkpointer to persist state.
</python> <typescript> HITL requires a checkpointer to persist state.
</typescript> </fix-missing-checkpointer>
<fix-no-thread-id> <python> Always provide thread_id when using HITL to track conversation state.
</python> </fix-no-thread-id>
<fix-wrong-resume-syntax> <python> Use Command class to resume execution after an interrupt.
</python> <typescript> Use Command class to resume execution after an interrupt.
</typescript> </fix-wrong-resume-syntax>
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/langchain-middleware/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/sameeh07/agent-skills/langchain-middleware)