LangChain
Guardrails
LangChain powers millions of AI agents. LangSmith watches them. OnLeash governs them. Policy enforcement that blocks dangerous actions before execution — not after logging. The guardrail layer LangChain agents need in production.
What LangSmith Doesn't Do
LangSmith is excellent observability. It is not governance. Here's the gap.
No deterministic policy engine
LangSmith provides observability. It logs actions — it does not block them. By the time you see a dangerous action in LangSmith, it has already executed.
No kill switch
There is no mechanism to halt a running LangChain agent in real-time. If an agent enters a dangerous loop or executes harmful actions, you cannot stop it without killing the process.
No compliance evidence
LangSmith traces are observability data, not compliance evidence. They are not tamper-proof, not cryptographically chained, and not structured for EU AI Act or SOC 2 audit requirements.
Tool calls are ungoverned
LangChain agents call tools based on LLM reasoning. There is no policy layer between the LLM decision and the tool execution.
What OnLeash Adds
Tool call interception
Every LangChain tool call routes through the OnLeash governance middleware. Policy rules evaluate ALLOW, DENY, or ESCALATE before the tool executes.
Chain-level monitoring
Track entire chain executions, not just individual calls. Detect anomalous chain behavior, excessive retries, cost overruns, and behavioral drift across chain steps.
LangGraph state governance
For LangGraph-based agents, OnLeash monitors state transitions. Policy rules can restrict which states an agent can enter and what actions are available in each state.
Python SDK integration
Native Python SDK wraps LangChain callbacks. Minimal code changes — add the OnLeash callback handler to your chain or agent configuration.
Kill switch + circuit breakers
Real-time kill switches halt any LangChain agent. Circuit breakers auto-trigger on anomalous behavior. Quarantine captures forensic snapshots.
Compliance-grade audit
Cryptographically chained audit logs. Tamper-proof. Structured for EU AI Act, SOC 2, and NIST AI RMF. Export-ready compliance reports.
How It Works
The OnLeash Python SDK provides a callback handler that plugs into LangChain's callback system. Add it to your agent or chain configuration — three lines of code. Every tool call is then routed through the governance engine before execution.
- 1. Install the Python SDK
- 2. Add the governance callback to your agent configuration
- 3. Every tool call is now governed — ALLOW, DENY, or ESCALATE
Three lines of code. Full governance. Every tool call evaluated before execution.
Production Guardrails for LangChain
Free tier. Python SDK integration. Works alongside LangSmith.
Deploy Guardrails