Introduction
Runtime governance platform for AI agents — overview, prerequisites, and first steps.
Overview
AgentTrust is a runtime governance platform for AI agents. Every agent execution is intercepted, validated, scored for confidence and risk, and given a governance decision before its output is returned to users or downstream systems. A complete, ISO/IEC 42001-aligned audit trail is recorded for every run.
The platform consists of:
- Python SDK (
agentrust-sdk) — decorators, HTTP clients, framework adapters, embedded gateway - TypeScript SDK (
agentrust-sdkon npm) — Node.js client andwrap()helper - Edge Gateway — FastAPI governance runtime with validation, confidence, risk, and decision engines
- Dashboard — React operator UI for executions, review queue, analytics, and policy management
Why It Matters
AI agents can produce incorrect, unsafe, or policy-violating outputs. Without runtime governance:
- High-stakes actions (payments, data access, customer communications) run unchecked
- There is no auditable record of what an agent decided and why
- Multi-agent pipelines have no provenance or trust chain
- Compliance teams cannot demonstrate ISO 42001 or GDPR controls
AgentTrust solves this by sitting between your agent and its consumers, enforcing policy-as-code, scoring every output, and routing risky decisions to human reviewers.
Prerequisites
- Python ≥ 3.10 (Python SDK) or Node.js ≥ 18 (TypeScript SDK)
- Basic familiarity with your agent framework (LangChain, LangGraph, OpenAI, etc.)
- For full gateway features: PostgreSQL 15+, Redis 7+ (provided via Docker Compose)
Step-by-Step Guide
1. Choose your deployment mode
| Mode | Gateway required? | Best for |
|---|---|---|
| OSS | No | Schema-only validation, no API key |
| Embedded | In-process SQLite on :8765 | Dev, demos, CI, air-gap |
| Full Edge | PostgreSQL + Redis gateway | Staging and production |
2. Install the SDK
pip install "agentrust-sdk[embedded,retry]"3. Add governance to one agent function
from agentrust_sdk import harness, embed_gateway
embed_gateway() # optional: in-process gateway for dev
@harness
def my_agent(user: str, input: str) -> dict:
return {"answer": "processed"}
result = my_agent(user="alice", input="Transfer $500")4. Promote to production
Change only environment variables — app code stays identical:
export AGENTRUST_GATEWAY_URL=https://agentrust.internal:8000
export AGENTRUST_KEY=at_team_your_key_here
export AGENTRUST_FAILURE_MODE=closedExamples
Embedded (zero external services):
from agentrust_sdk import harness, embed_gateway
embed_gateway()
@harness
def payment_agent(user, input): return {"status": "approved"}Direct client (full validation result):
from agentrust_sdk import AgentTrustClient
with AgentTrustClient() as client:
result = client.validate(
agent_id="payment-agent",
user="alice",
input="Transfer $500",
output={"status": "approved"},
)
print(result.decision.outcome) # approve | block | escalate | ...Best Practices
- Start with embedded mode locally, then promote via env vars only
- Use
@harnessfor new agents; useauto_instrument()for legacy codebases - Set
AGENTRUST_FAILURE_MODE=closedin staging to catch gateway issues early - Set
AGENTRUST_FAILURE_MODE=openin production if agent availability is critical - Always configure a PII policy pack for customer-facing agents
Common Mistakes
- Running the full gateway with
AUTH_ENABLED=falsein production - Expecting queue mode to auto-replay without calling
drain_queue()oragentrust queue replay - Confusing Python
AGENTRUST_KEYwith TypeScriptAGENTRUST_API_KEY - Using Team-tier adapters (LangGraph, CrewAI) without a valid API key
Troubleshooting
| Symptom | Fix |
|---|---|
BlockedError on every call | Check policy pack rules; inspect result.decision.reasons |
| Gateway unreachable | Verify AGENTRUST_GATEWAY_URL; check failure mode setting |
| Tier-gated feature skipped | Run agentrust whoami to confirm tier |
| Embedded gateway port conflict | Set AGENTRUST_EMBED_PORT=8766 |