Configuration

Environment Variables

Complete reference for AGENTRUST_* environment variables.

Environment Variables

Overview

All AgentTrust configuration is driven by environment variables. No config file is required for basic usage. Variables are read lazily at runtime, so secrets managers and container entrypoints can inject values without restart.

Why It Matters

Env-only configuration enables the deployment ladder: identical app code across dev, staging, and production with only variable changes.

Prerequisites

None — reference document.

Step-by-Step Guide

Python SDK

VariableDefaultPurpose
AGENTRUST_ENABLEDtrueMaster kill-switch
AGENTRUST_GATEWAY_URLhttp://localhost:8000Gateway base URL
AGENTRUST_KEYAPI key (overrides config file)
AGENTRUST_TIMEOUT_SEC10HTTP request timeout
AGENTRUST_RETRY_ATTEMPTS3Max retries (requires [retry] extra)
AGENTRUST_RETRY_BACKOFF0.5Initial backoff seconds
AGENTRUST_FAILURE_MODEopenopen | closed | queue
AGENTRUST_QUEUE_DB~/.agentrust/queue.dbQueue buffer SQLite path
AGENTRUST_AUTO_INSTRUMENTtrueDisable auto-hooks when false
AGENTRUST_EMBED_PORT8765Embedded gateway port
AGENTRUST_EMBED_DB~/.agentrust/embedded.dbEmbedded SQLite path
AGENTRUST_EMBED_TOKENauto-generatedBearer token for embedded gateway
AGENTRUST_AUTOLOAD_EMBEDAuto-start embedded gateway
AGENTRUST_AUTOLOAD_AGENT_IDDefault agent ID for autoload
AGENTRUST_SDK_VERSION0.0.1a1Override only in tests

TypeScript SDK

VariableDefaultPurpose
AGENTRUST_GATEWAY_URLhttp://localhost:8000Gateway base URL
AGENTRUST_API_KEYAPI key (not AGENTRUST_KEY)
AGENTRUST_ENABLEDtrueKill-switch
AGENTRUST_FAILURE_MODEopenopen | closed (no queue)
AGENTRUST_TIMEOUT_MS10000Request timeout

Gateway (Docker Compose / K8s)

VariablePurpose
DATABASE_URLPostgreSQL connection string
REDIS_URLRedis connection string
AGENTRUST_ENVproduction / development
AGENTRUST_JWT_SECRETJWT signing secret (required when auth on)
AUTH_ENABLEDDefaults ON except dev/test
RATE_LIMIT_ENABLEDPer-agent rate limiting
RATE_LIMIT_PER_MINUTEDefault 60
AGENTRUST_API_KEYSComma-separated static API keys
AGENTRUST_AUTO_MIGRATEAuto-run Alembic migrations
JUDGE_BACKENDdisabled | ollama | claude
ANTHROPIC_API_KEYClaude judge backend
WEBHOOK_URL, WEBHOOK_SECRETOutbound webhooks
AGENTRUST_AUDIT_ENCRYPTION_KEYAES-256-GCM at-rest encryption
OBJECT_STORE_*S3/MinIO evidence offload
VECTOR_STORE_*pgvector/Chroma semantic search
AGENTRUST_SIGNING_KEYEd25519 audit package signing
AGENTRUST_HYBRID_MODEHybrid cloud telemetry
OTEL_EXPORTER_OTLP_ENDPOINTOpenTelemetry export
RECERT_ENABLEDContinuous re-certification scheduler
CORS_ALLOWED_ORIGINSDashboard CORS

Deployment ladder example

# Dev
AGENTRUST_ENABLED=true
# embed_gateway() sets AGENTRUST_GATEWAY_URL=http://localhost:8765

# Staging
AGENTRUST_GATEWAY_URL=https://agentrust-staging.internal:8000
AGENTRUST_KEY=at_team_...
AGENTRUST_FAILURE_MODE=closed

# Production
AGENTRUST_GATEWAY_URL=https://agentrust.internal:8000
AGENTRUST_FAILURE_MODE=open
AGENTRUST_RETRY_ATTEMPTS=5

Examples

Kill-switch:

export AGENTRUST_ENABLED=false

Queue mode (air-gap):

export AGENTRUST_FAILURE_MODE=queue
export AGENTRUST_QUEUE_DB=/var/lib/agentrust/queue.db

Best Practices

  • Inject secrets via your platform's secret manager, not .env files in repos
  • Use AGENTRUST_FAILURE_MODE=closed in staging, open in production (unless compliance requires closed)
  • Set AUTH_ENABLED=true on gateway in all non-dev environments
  • Document env var differences between Python and TypeScript SDKs in your runbooks

Common Mistakes

  • Using AGENTRUST_KEY in Node.js (use AGENTRUST_API_KEY)
  • Setting AGENTRUST_RETRY_ATTEMPTS without installing [retry] extra
  • Running production gateway with AUTH_ENABLED=false

Troubleshooting

IssueCheck
SDK ignores env changeCall SDK_CONFIG.reload() in tests after mutating os.environ
Invalid failure modeMust be exactly open, closed, or queue
Gateway auth failsVerify AGENTRUST_KEY matches AGENTRUST_API_KEYS or JWT