Production governance for LangGraph agents — no graph restructuring required
Add policy enforcement, confidence scoring, and compliance audit trails to an existing LangGraph agent in under 30 minutes — without modifying your graph definition.
Adding production governance to LangGraph agents without changing your graph structure
LangGraph is one of the most capable frameworks available for building stateful, multi-step AI agents. Its graph-based architecture handles complex reasoning cycles, parallel execution branches, and state checkpointing in ways that simpler sequential frameworks can't match.
What LangGraph does not provide — by design — is governance infrastructure: access control for which nodes can invoke which tools, confidence scoring before irreversible actions, policy enforcement at the tool call level, or structured audit trails for compliance review. These are intentionally out of scope for an orchestration framework.
This tutorial shows exactly where and how to add AgentTrust OS governance to an existing LangGraph agent — without restructuring your graph, without changing your node logic, and without modifying the state model you've already built.
AgentTrust OS integrates at the tool execution layer — the boundary between your graph nodes and the external systems they call. This is the right place to enforce governance because it is the point of maximum leverage: all tool calls pass through it regardless of which node initiates them, and it is where irreversible actions happen.
You do not need to modify your LangGraph graph definition, StateGraph, or node functions. Governance wraps the tool execution environment that the graph calls into — keeping your graph logic clean and your governance logic separate.
npm install @agenttrust/sdk
# or
pip install agenttrust-sdkA policy file declares which tools are permitted, their trust level, and the confidence threshold required for autonomous execution.
import { definePolicy } from "@agenttrust/sdk";
export const researchAgentPolicy = definePolicy({
name: "research-agent-v1",
tools: {
web_search: { trustLevel: "standard", threshold: 0.75 },
read_file: { trustLevel: "standard", threshold: 0.75 },
write_file: { trustLevel: "sensitive", threshold: 0.90 },
send_email: { trustLevel: "high-risk", threshold: 0.95,
requireApproval: true },
delete_resource: { trustLevel: "critical", blocked: true },
},
defaults: { threshold: 0.80, trustLevel: "standard" },
});import { StateGraph, ToolNode } from "@langchain/langgraph";
import { AgentTrustRuntime } from "@agenttrust/sdk";
import { researchAgentPolicy } from "./policy";
import { tools } from "./tools"; // your existing tools
// Wrap the runtime around your tools — graph structure unchanged
const runtime = new AgentTrustRuntime({ policy: researchAgentPolicy });
const governedTools = runtime.wrapTools(tools);
// Use governed tools in your ToolNode — same API as before
const toolNode = new ToolNode(governedTools);
// Your graph definition is unchanged
const graph = new StateGraph(AgentState)
.addNode("agent", callModel)
.addNode("tools", toolNode) // ← governed automatically
.addEdge("tools", "agent")
.addConditionalEdges("agent", routeToTools);
export const app = graph.compile();When an action scores below the autonomous threshold, Trust Runtime surfaces it to your escalation handler instead of executing.
const runtime = new AgentTrustRuntime({
policy: researchAgentPolicy,
onEscalate: async ({ action, score, signals }) => {
// Route to your review queue, Slack, PagerDuty, etc.
await reviewQueue.add({
action,
score,
signals,
agentId: "research-agent",
timestamp: new Date().toISOString(),
});
// Return "pause" to halt workflow pending review
// Return "reject" to block and continue with error
return "pause";
},
});Every governed tool call generates a structured record in Trust Audit — no additional instrumentation required. Records include the full decision trace: composite score, each signal value, the routing decision, policy reference, and all action parameters.
import { TrustAudit } from "@agenttrust/sdk";
const audit = new TrustAudit();
// Get all tool calls for a workflow run
const records = await audit.query({
agentId: "research-agent",
runId: workflowRunId,
from: "2026-07-01",
});
// Each record: { tool, score, signals, route, params, timestamp }
// Export as structured JSON for compliance reviewAdd Trust Runtime to your existing LangGraph agents. No graph restructuring required.
View LangGraph Integration →