langchain-middleware
INVOKE THIS SKILL when you need human-in-the-loop approval, custom middleware, or structured output.
Skill by Harmeet10000
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/harmeet10000-langchain-middleware
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: ml
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/langchain-middleware
What's inside
- Skill name
langchain-middleware- Description
- 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.
- License
- MIT
- Instructions
- 299 lines in SKILL.md · view on GitHub
Files (1)
- SKILL.md
SKILL.md (first lines)
<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 HumanInTheLoopMiddleware
from langgraph.checkpoint.memory import MemorySaver
from langchain.tools import tool
@tool
def send_email(to: str, subject: str, body: str) -> str:
"""Send an email."""
return f"Email sent to {to}"
agent = create_agent(
model="gpt-4.1",
tools=[send_email],
checkpointer=MemorySaver(), # Required for HITL
middleware=[
HumanInTheLoopMiddleware(
interrupt_on={
"send_email": {"allowed_decisions": ["approve", "edit", "reject"]},
}
)
],
)
```
</python>
<typescript>
Set up an agent with HITL that pauses before sending emails for human approval.
```typescript
import { createAgent, humanInTheLoopMiddleware } from "langchain";
import { MemorySaver } from "@langchain/langgraph";
import { tool } from "@langchain/core/tools";
import { z } from "zod";
const sendEmail = tool(
async ({ to, subject, body }) => `Email sent to ${to}`,
{
name: "send_email",
description: "Send an email",
schema: z.object({ to: z.string(), subject: z.string(), body: z.string() }),
}
);
const agent = createAgent({
model: "anthropic:claude-sonnet-4-5",
tools: [sendEmail],
checkpointer: new MemorySaver(),
middleware: [
humanInTheLoopMiddleware({
interruptOn: { send_email: { allowedDecisions: ["approve", "edit", "reject"] } },
}),
],
});
```
</typescript>
</ex-basic-hitl-setup>
<ex-running-with-interrupts>
<python>
Run the agent, detect an interrupt, then resume execution after human approval.
```python
from langgraph.types import Command
config = {"configurable": {"thread_id": "session-1"}}
# Step 1: Agent runs until it needs to call tool
result1 = agent.invoke({
"messages": [{"role": "user", "content": "Send email to john@example.com"}]
}, config=config)
# Check for interrupt
if "__interrupt__" in result1:
print(f"Waiting for approval: {result1['__interrupt__']}")
# Step 2: Human approves
result2 = agent.invoke(
Command(resume={"decisions": [{"type": "approve"}]}),
config=config
)
```
</python>
<typescript>
Run the agent, detect an interrupt, then resume execution after human approval.
```typescript
import { Command } from "@langchain/langgraph";
const config = { configurable: { thread_id: "session-1" } };
// Step 1: Agent runs until it needs to call tool
const result1 = await agent.invoke({
messages: [{ role: "user", content: "Send email to john@example.com" }]
}, config);
// Check for interrupt
if (result1.__interrupt__) {
console.log(`Waiting for approval: ${result1.__interrupt__}`);
}
// Step 2: Human approves
const result2 = await agent.invoke(
new Command({ resume: { decisions: [{ type: "approve" }] } }),
config
);From Harmeet10000/skills, MIT.
More from Harmeet10000/skills
- 0.474score
text-to-speech
Harmeet10000
Convert text to speech using ElevenLabs voice AI.
SkillDFreshness: D★ 7Claude Code +9 - 0.469score
langsmith-evaluator
Harmeet10000
INVOKE THIS SKILL when building evaluation pipelines for LangSmith.
SkillDFreshness: D★ 7Claude Code +9 - 0.469score
ai-music-generation
Harmeet10000
Generate AI music and songs with Diffrythm, Tencent Song Generation via inference.sh CLI.
SkillDFreshness: D★ 7Claude Code +9 - 0.469score
langchain-dependencies
Harmeet10000
INVOKE THIS SKILL when setting up a new project or when asked about package versions, installation, or dependency management for LangChain, LangGraph…
SkillDFreshness: D★ 7Claude Code +9 - 0.466score
deep-agents-orchestration
Harmeet10000
INVOKE THIS SKILL when using subagents, task planning, or human approval in Deep Agents.
SkillDFreshness: D★ 7Claude Code +9 - 0.466score
deep-agents-core
Harmeet10000
INVOKE THIS SKILL when building ANY Deep Agents application.
SkillDFreshness: D★ 7Claude Code +9 - 0.466score
langsmith-trace
Harmeet10000
INVOKE THIS SKILL when working with LangSmith tracing OR querying traces.
SkillDFreshness: D★ 7Claude Code +9 - 0.466score
deep-agents-memory
Harmeet10000
INVOKE THIS SKILL when your Deep Agent needs memory, persistence, or filesystem access.
SkillDFreshness: D★ 7Claude Code +9 - 0.466score
langsmith-dataset
Harmeet10000
INVOKE THIS SKILL when creating evaluation datasets, uploading datasets to LangSmith, or managing existing datasets.
SkillDFreshness: D★ 7Claude Code +9 - 0.463score
langchain-fundamentals
Harmeet10000
Create LangChain agents with create_agent, define tools, and use middleware for human-in-the-loop and error handling.
SkillDFreshness: D★ 7Claude Code +9 - 0.461score
crawl4ai
Harmeet10000
Complete toolkit for web crawling and data extraction using Crawl4AI.
SkillDFreshness: D★ 7Claude Code +9 - 0.460score
langchain-architecture
Harmeet10000
Design LLM applications using LangChain 1.x and LangGraph for agents, memory, and tool integration.
SkillDFreshness: D★ 7Claude Code +9
Signals
- Stars
- 7
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Mar 15, 2026 (7 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/Harmeet10000/skills
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Harmeet10000
- 0.474score
text-to-speech
Harmeet10000
Convert text to speech using ElevenLabs voice AI.
SkillDFreshness: D★ 7Claude Code +9 - 0.469score
langchain-dependencies
Harmeet10000
INVOKE THIS SKILL when setting up a new project or when asked about package versions, installation, or dependency management for LangChain, LangGraph…
SkillDFreshness: D★ 7Claude Code +9 - 0.469score
ai-music-generation
Harmeet10000
Generate AI music and songs with Diffrythm, Tencent Song Generation via inference.sh CLI.
SkillDFreshness: D★ 7Claude Code +9 - 0.469score
langsmith-evaluator
Harmeet10000
INVOKE THIS SKILL when building evaluation pipelines for LangSmith.
SkillDFreshness: D★ 7Claude Code +9 - 0.466score
deep-agents-core
Harmeet10000
INVOKE THIS SKILL when building ANY Deep Agents application.
SkillDFreshness: D★ 7Claude Code +9 - 0.466score
deep-agents-orchestration
Harmeet10000
INVOKE THIS SKILL when using subagents, task planning, or human approval in Deep Agents.
SkillDFreshness: D★ 7Claude Code +9
Cite this page
langchain-middleware skill. Agent Mart. https://agentmart.dev/skills/harmeet10000-langchain-middleware (last updated 2026-10-24)