Architecture Overview
Validate-at-runtime architecture, deployment modes, and gateway API surface.
Overview
AgentTrust follows a validate-at-runtime architecture. The SDK (or HTTP client) sends an execution envelope to the gateway. The gateway runs a deterministic fast-path pipeline (validation → confidence → risk → decision), persists an audit record, and optionally enqueues async LLM judge jobs and human review items.
┌─────────────┐ POST /v1/runtime/validate ┌──────────────────────┐
│ Agent App │ ─────────────────────────────────▶│ AgentTrust Gateway │
│ (SDK/HTTP) │◀───────────────────────────────── │ (FastAPI) │
└─────────────┘ ValidateResponse └──────────┬───────────┘
│
┌────────────────────────────────────────┼────────────┐
▼ ▼ ▼ ▼
PostgreSQL Redis Review Queue LLM Judge
(audit store) (jobs, cache) (human ops) (async)Why It Matters
Understanding the architecture helps you choose the right deployment mode, tune latency expectations, and know which features require which infrastructure components.
Prerequisites
Familiarity with How It Works and the repository layout.
Step-by-Step Guide
Validation pipeline (full gateway)
Each POST /v1/runtime/validate request runs:
- Historical reliability — Redis cache → audit store lookup for agent_id
- ValidationEngine — 6 deterministic checks (target <20ms, zero LLM calls)
- ConfidenceEngine — 7-signal weighted confidence score
- RiskEngine — 4-factor risk scoring →
low/medium/high/critical - Trust chain — Multi-agent provenance check (Enterprise)
- DecisionEngine — Maps scores to governance outcome
- Audit persist — Append-only ledger with hash chain
- Review queue —
escalate/request_evidencerouted to operators - LLM judge — Async background enrichment (Enterprise)
Validation checks (fast path)
| Check | Role |
|---|---|
| Schema | Output structure validation |
| Tool trust | Tool call / result verification |
| Policy | Policy pack rules (YAML) |
| Consistency | Output consistency + contradiction detector |
| Golden tests | YAML-defined regression rules |
| Grounding | Evidence / grounding checks |
| Adversarial | Hard gate; caps policy score on failure |
Decision outcomes
approve · retry · request_evidence · escalate · block · pending
Repository layout
agent-trust-sdk/
├── agentrust_sdk/ # Python SDK (pip install agentrust-sdk)
├── sdks/typescript/ # TypeScript/Node SDK
├── agentrust-edge/
│ ├── gateway/ # FastAPI governance runtime
│ ├── dashboard/ # React operator UI
│ ├── docker-compose.yml
│ └── k8s/ # Helm + raw manifests
├── examples/ # Framework integration cookbooks
└── docs/ # This documentationDeployment modes
| Mode | Components | Capabilities |
|---|---|---|
| OSS | SDK only | In-process schema validation |
| Embedded | SDK + SQLite gateway on :8765 | Schema + basic policy; risk always LOW |
| Full Edge | Gateway + Postgres + Redis + Dashboard | All engines, review queue, analytics, judge |
Gateway API surface
| Prefix | Purpose |
|---|---|
/v1/runtime | Validate executions |
/v1/audit | Execution history, hash chain verify, PII erasure |
/v1/review | Human review queue |
/v1/policy | Policy evaluation and versioning |
/v1/certify | Agent certification harness |
/v1/analytics | Fleet analytics |
/v1/alerts | Alert engine |
/v1/reports | Compliance and regulator evidence packs |
/v1/team | Team management |
/v1/sso | SAML SSO (Enterprise) |
/health | DB + Redis health |
/metrics | Prometheus metrics |
Examples
Docker Compose stack (staging):
| Service | Port | Role |
|---|---|---|
| Postgres | 5432 | Audit and execution storage |
| Redis | 6379 | Job queue, rate limiting, cache |
| Gateway | 8000 | Validate + management APIs |
| Dashboard | 3000 | Operator UI |
Env-only promotion — same app code across environments:
# Dev
embed_gateway() # or AGENTRUST_GATEWAY_URL=http://localhost:8765
# Staging
AGENTRUST_GATEWAY_URL=https://staging.internal:8000
# Production
AGENTRUST_GATEWAY_URL=https://agentrust.internal:8000
AGENTRUST_FAILURE_MODE=openBest Practices
- Use embedded gateway for dev/CI; full edge for staging and production
- Run gateway with
AUTH_ENABLED=truein all non-dev environments - Mount policy packs as read-only ConfigMaps in Kubernetes
- Export OpenTelemetry traces from both SDK and gateway (see OTEL Cookbook)
- Verify audit chain integrity periodically via
GET /v1/audit/chain/verify
Common Mistakes
- Assuming embedded gateway has the same capabilities as full edge
- Deploying dashboard without setting
VITE_API_URLto the gateway - Skipping Redis in production (breaks async judge and rate limiting)
Troubleshooting
| Issue | Diagnosis |
|---|---|
| High P99 latency | Check Redis connectivity; review golden test count |
| Missing review items | Confirm decision is escalate or request_evidence |
| Audit chain verify fails | Check for manual DB edits; use /v1/audit/chain/verify |