LangChain Agent Middleware: Verify Tools Before Execution
Wrap LangChain tool calls with verifyAction() or protectAgent(). Policies, human approval, and audit — without rewriting your agent graph.
LangChain agents chain tools, memory, and models. The dangerous step is always tool execution. Wrap calls with Sanctum — middleware style or protectAgent() from the agent adapter.
Two integration paths
- Per-tool wrapper — verify before each tool.invoke()
- protectAgent() — adapter hooks the agent loop automatically
Policies follow action names
Map LangChain tool names to Sanctum actions: send_email, run_sql, delete_file. Set verify on destructive ops, approve on reads.
Guides: agentic AI risk · MCP security · runtime authorization · HITL approvals · coding agents · get started
More: all posts · AI trust layer · open Sanctum Console
