Introduction

Runtime governance platform for AI agents — overview, prerequisites, and first steps.

Introduction

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-sdk on npm) — Node.js client and wrap() 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

ModeGateway required?Best for
OSSNoSchema-only validation, no API key
EmbeddedIn-process SQLite on :8765Dev, demos, CI, air-gap
Full EdgePostgreSQL + Redis gatewayStaging 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=closed

Examples

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 @harness for new agents; use auto_instrument() for legacy codebases
  • Set AGENTRUST_FAILURE_MODE=closed in staging to catch gateway issues early
  • Set AGENTRUST_FAILURE_MODE=open in 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=false in production
  • Expecting queue mode to auto-replay without calling drain_queue() or agentrust queue replay
  • Confusing Python AGENTRUST_KEY with TypeScript AGENTRUST_API_KEY
  • Using Team-tier adapters (LangGraph, CrewAI) without a valid API key

Troubleshooting

SymptomFix
BlockedError on every callCheck policy pack rules; inspect result.decision.reasons
Gateway unreachableVerify AGENTRUST_GATEWAY_URL; check failure mode setting
Tier-gated feature skippedRun agentrust whoami to confirm tier
Embedded gateway port conflictSet AGENTRUST_EMBED_PORT=8766