Chain-level governance
This is the design decision that makes ProofRail different from other agent governance tools. Understanding it explains why the SDK is structured the way it is and what kind of failures it catches that others don’t.The problem with per-call governance
Most AI safety tools evaluate one tool call at a time. The agent callssearch_web — the tool is allowed, no PII, looks fine. The agent calls calculate_offer for 3,000 — again under the threshold, allowed. Another 4,000 commitment to close out the workflow — still under the single-transaction threshold, allowed.
Six allow decisions. The workflow completes. Your company is now committed to paying a vendor $13,000.
Each individual step passed its own review. The chain of steps did not.
What chain-level tracking measures
When you open a ProofRailChain, the SDK creates a session that lives for the duration of that workflow. Every action the agent takes in that session contributes to running totals:
- Cumulative financial exposure — sum of all
amountorvaluefields seen across the workflow - External communications — count of emails sent, messages posted, API calls made to external domains
- Records modified — count of write/update/delete actions against your data
- Privileged actions — count of permission changes, IAM operations, role assignments
- External domains contacted — deduplicated list of every domain the agents touched
- Tokens used and estimated cost — running LLM spend across all calls in the workflow
The example, in code
How chain context interacts with fast-path
ProofRail’s local fast-path evaluation handles obviously-safe actions without a backend round-trip. These actions are still added to cumulative metrics — the fast-path doesn’t bypass tracking, only the backend authorization step. This means the earlysearch_web call in the example above resolves in under 5ms locally, but its (non-financial, no external comm) presence is still recorded. When the financial actions come through later, the backend sees the full chain state including the fast-path events.
See Configuration Reference for fast-path tuning options.
Chain lifecycle
A chain is a context manager. It starts when you enter thewith block and completes when you exit, normally or via exception.
Where to go next
Policies
How ProofRail decides what to allow, flag, or block.
Audit receipts
HMAC-signed records you can verify offline.
Configuration
Tune chain behavior — thresholds, fail modes, timeouts.
Framework adapters
Wrap LangGraph, LangChain, CrewAI, or MCP with one line.