Share your middleware
Middleware enables context engineering, harness customization, and runtime safety controls. It is a useful extension point in LangChain and we love highlighting what the community builds with it:Add an official integration
Follow the contributing guide to build and publish a middleware package.
Share a community middleware
Open a PR to the docs repo to add your middleware to the all integrations table.
Featured integrations
| Provider | Middleware available | Source | Downloads |
|---|---|---|---|
OpenAI middleware | Content moderation | langchain-ai/langchain | |
Anthropic middleware | Prompt caching, bash tool, text editor, memory, and file search | langchain-ai/langchain | |
AWS middleware | Prompt caching and AgentCore Payments | langchain-ai/langchain-aws, aws/bedrock-agentcore-sdk-python | |
Microsoft Foundry middleware | Text moderation, image moderation, prompt shield, protected material, and groundedness | langchain-ai/langchain-azure | |
NVIDIA middleware | Model routing and Nemotron 3 Ultra harness optimization | langchain-ai/langchain-nvidia, langchain-ai/deepagents | N/A |
All middleware
| Provider | Middleware available | Source | Downloads |
|---|---|---|---|
OpenAI middleware | Content moderation | langchain-ai/langchain | |
Anthropic middleware | Prompt caching, bash tool, text editor, memory, and file search | langchain-ai/langchain | |
AWS middleware | Prompt caching and AgentCore Payments | langchain-ai/langchain-aws, aws/bedrock-agentcore-sdk-python | |
Microsoft Foundry middleware | Text moderation, image moderation, prompt shield, protected material, and groundedness | langchain-ai/langchain-azure | |
CopilotKit | CopilotKit middleware and FastAPI bridge for Deep Agents, create_agent graphs, AG-UI, and the React and runtime clients | CopilotKit/CopilotKit | |
ISNAD | Claim-level provenance and trust grading for agent outputs. Grades every transmitter in a claim’s chain (source, scraper, model) in a living registry, caps the chain at its weakest link, and quarantines fabricated (mawḍūʿ) chains—with a tamper-evident audit trail. | alizahidraja/isnad | |
xaidr | In-process runtime security sensor for AI agents. LangChain middleware covering input, tool-call, and output boundaries for prompt injection, jailbreak, DLP, and A2A-protocol scanning. | delphisecurity/xaidr | |
PIIAnonymizationMiddleware | Protect personal data (PII) in prompts, tool calls, and agent conversations. Hides sensitive values from the model, then restores the real values in the reply and at the tool boundary, so tools and the user still get the real data. Pluggable regex, NER, and LLM detectors, thread-consistent tokens, and token-by-token streaming restoration. | Athroniaeth/piighost | |
attenu-guard | Per-agent permission enforcement on every tool call and subagent handoff through wrap_tool_call (a subagent’s permissions are a computed subset of its parent’s), with a hash-chained audit log verified offline | attenu-io/attenu-guard | |
Highflame | Runtime AI security guardrails (prompt injection, PII/DLP, content safety) applied as middleware via Highflame Shield (OWASP LLM Top 10). | highflame-ai/highflame-sdk | |
ATLTaskMiddleware | Automatic task-time routing to executable MCP and provider capabilities, with failure redecision and outcome reporting. | wenhua6666668-oss/langchain-agenttrafficlab | |
Nuggets Authority | Pre-execution authority enforcement for tool calls. Verifies a scoped, signed delegation before each tool runs, fails closed on deny, and emits an independently verifiable cryptographic proof of every decision. | NuggetsLtd/langchain-nuggets | |
prompt-shield | Runtime prompt-injection firewall. Scans inputs, tool results, and outputs across detectors and output scanners with block, flag, and log modes. | mthamil107/prompt-shield | |
TealTiger | Deterministic governance middleware. Policy enforcement, cost limits, tool allowlisting, FREEZE rules, and SARIF audit evidence with no LLM in the governance path. | agentguard-ai/tealtiger | |
advisor-middleware | Claude Code’s advisor pattern as LangChain middleware. Pairs a fast executor model with a powerful advisor model that intervenes only on critical decisions. | emanueleielo/advisor-middleware | |
compact-middleware | Claude Code’s compaction engine as LangChain middleware. Multi-level context compaction for long-running agents. | emanueleielo/compact-middleware | |
langchain-runcycles | Pre-execution budget authority for model calls, tool calls, and agent loops | runcycles/langchain-runcycles | |
langgraph-state-machine | Section-based flow control for LangGraph React agents. Divides conversations into discrete phases with scoped tools, prompts, auto-transitions, branching, and optional per-section LLM override. | mahmoud661/langgraph-state-machine | |
SeekritCredentials | Scopes secrets per model call and per tool call. Credentials stay as placeholders in agent code and are substituted at the HTTP boundary against a default-deny allowlist, so an unlisted tool cannot reach a credential. | seekritdev/python-sdk | |
langchain-task-steering | Implicit state-machine middleware for ordered task pipelines with per-task tool scoping, dynamic prompt injection, and composable completion validation. | edvinhallvaxhiu/langchain-task-steering | |
langchain-router | Phase-based model routing. Routes execution turns to a fast model, keeps the primary for planning and recovery. | johanity/langchain-router | |
Cisco AI Defense | Runtime security inspection | cisco-ai-defense/ai-defense-langchain-middleware | |
RelayShield | Mandatory pre-execution gate that blocks connect_mcp_server and install_mcp_package tool calls when RelayShield reports risk. | nzdsf2-gif/langchain-relayshield | |
BastionGuardrailMiddleware | Prompt-injection and jailbreak detection. Screens user input and tool results, including indirect injection through retrieved content, before the model runs. Runs locally on your own hardware. | bastion-soft/bastion-prompt-protection | |
langchain-collapse | Preventive context management. Collapses consecutive tool-call groups before they fill the context window. | johanity/langchain-collapse | |
DeepKeep middleware | DeepKeep AI Firewall pre-moderation and post-moderation for LangChain agents. | | |
NeuralTrust TrustGuard | TrustGuard evaluate middleware. Allow, block, report, or transform agent input, model output, and optional tool traffic. | NeuralTrust/langchain-neuraltrust | |
text2sql-framework | Replaces RAG with recursive tool use: the agent explores, writes, tests, and self-corrects using one execute_sql tool. | Text2SqlAgent/text2sql-framework | |
AxioRank | Security gateway for AI agents: score tool calls and model turns against policy with allow, deny, and redact. | AxioRank/langchain-axiorank | |
Pydantic Monty Code Interpreter | Provides Code Interpretation inside Pydantic’s Monty Runtime | langchain-monty | |
OpenBox | Real-time governance for LangGraph and Deep Agents. Policies, guardrails, HITL, OTel hook governance, and behavior rules. | OpenBox-AI/openbox-langgraph-sdk-python | |
Tessera | Signed trust labels and taint-tracking that gate tool calls when context contains untrusted segments. | kenithphilip/Tessera | |
langchain-distil | Reversible, certified context compression. Digests large tool outputs and message history before the model call (tool and function messages reversibly, human and system losslessly, the model messages never rewritten), with byte-exact recovery of every digest. Decision-equivalence between compressed and full context is certified offline by a statistical non-inferiority gate. | dshakes/distil | |
comply54 | Runtime compliance enforcement for AI agents under African data protection and financial-sector regulations (deny, escalate, audit, or allow). | comply54/langchain-comply54 | |
langchain-pop | Portable persona loading, legacy migration, and boundary-aware tool filtering for LangChain agents. | joy7758/persona-object-protocol | |
OWASP Agent Memory Guard | Runtime defense against AI agent memory poisoning (OWASP ASI06). Scans messages, model responses, and tool outputs locally with block, warn, and strip modes. | OWASP/www-project-agent-memory-guard | |
NoPII | Runtime PII tokenization. Detects personal data in outbound prompts, replaces it with deterministic vault tokens before the request reaches the LLM, and restores the original values in the response. | Enigma-Vault/NoPII | |
DNS-AID | DNS-based agent discovery via the DNS-AID protocol. Auto-publishes agents on startup, auto-unpublishes on shutdown, and provides discovery tools. | IngmarVG-IB/langchain-dns-aid | |
VecrContextCompressor | Deterministic LLM context compression with a regex retention whitelist for structured tokens before the model call. | h2cker/vecr | |
ATR Guardrail | Runtime detection of prompt injection, tool poisoning, and unsafe tool calls using Agent Threat Rules. Halts the agent or blocks the tool call on a critical finding and keeps an audit trail. | Agent-Threat-Rule/agent-threat-rules | N/A |
eager-tools | Reduces agent wall-clock latency by dispatching each tool call the moment its streaming block closes, overlapping tool execution with LLM generation. | cloudthinker-ai/eager-tools | N/A |
Haldir | Governance layer for LangChain agents with scoped sessions, encrypted secrets, hash-chained audit, and policy enforcement. | ExposureGuard/haldir | N/A |
NVIDIA middleware | Model routing and Nemotron 3 Ultra harness optimization | langchain-ai/langchain-nvidia, langchain-ai/deepagents | N/A |
If you’d like to contribute an integration, see Contributing integrations.
Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

