Blog
langchainai-agentsmiddlewaresdk

LangChain agent middleware: verify tools before your chain executes

Wrap LangChain tool calls with Sanctum verifyAction() or protectAgent() — policies, human approval, and audit without rewriting your agent graph.

May 12, 20267 min read

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

  1. Per-tool wrapper — verify before each tool.invoke()
  2. 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.

Documentation · MCP gate · Action approval

More: all posts · runtime trust layer · open Sanctum Console

Build AI humans can trust.

Open the cloud console to manage runtimes and policies, or self-host the open-source runtime from GitHub.