Environment Variables
Complete reference for AGENTRUST_* 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
| Variable | Default | Purpose |
|---|---|---|
AGENTRUST_ENABLED | true | Master kill-switch |
AGENTRUST_GATEWAY_URL | http://localhost:8000 | Gateway base URL |
AGENTRUST_KEY | — | API key (overrides config file) |
AGENTRUST_TIMEOUT_SEC | 10 | HTTP request timeout |
AGENTRUST_RETRY_ATTEMPTS | 3 | Max retries (requires [retry] extra) |
AGENTRUST_RETRY_BACKOFF | 0.5 | Initial backoff seconds |
AGENTRUST_FAILURE_MODE | open | open | closed | queue |
AGENTRUST_QUEUE_DB | ~/.agentrust/queue.db | Queue buffer SQLite path |
AGENTRUST_AUTO_INSTRUMENT | true | Disable auto-hooks when false |
AGENTRUST_EMBED_PORT | 8765 | Embedded gateway port |
AGENTRUST_EMBED_DB | ~/.agentrust/embedded.db | Embedded SQLite path |
AGENTRUST_EMBED_TOKEN | auto-generated | Bearer token for embedded gateway |
AGENTRUST_AUTOLOAD_EMBED | — | Auto-start embedded gateway |
AGENTRUST_AUTOLOAD_AGENT_ID | — | Default agent ID for autoload |
AGENTRUST_SDK_VERSION | 0.0.1a1 | Sent as X-AgentTrust-SDK-Version; override only in tests |
AGENTRUST_EMBED_HOST | 127.0.0.1 | Embedded gateway bind host (0.0.0.0 for Docker) |
AGENTRUST_AUTOLOAD_LOG_LEVEL | INFO | Verbosity of the autoload bootstrap |
AGENTRUST_WEBHOOK_URL | — | Discord or generic HTTPS webhook, registered on client init (Team+) |
AGENTRUST_WEBHOOK_EVENTS | all | Comma-separated: all, approve, block, escalate, request_evidence |
AGENTRUST_WEBHOOK_DB | ~/.agentrust/webhooks.db | Webhook registry |
AGENTRUST_WEBHOOK_TIMEOUT | 5 | Per-dispatch timeout, seconds |
AGENTRUST_WEBHOOK_AUTO_DISPATCH | true | Fire webhooks automatically after each validate() |
AGENTRUST_KILL_SWITCH | — | Set 1 to hard-block every agent in the embedded gateway |
AGENTRUST_MODE | alert | Embedded execution mode: alert | hitl | block |
AGENTRUST_DISCORD_WEBHOOK_URL | — | Embedded gateway Discord notifier |
AGENTRUST_SLACK_WEBHOOK_URL | — | Embedded gateway Slack notifier |
AGENTRUST_LLM_ENABLED | false | Enable the embedded LLM classifier |
AGENTRUST_LLM_KEY / AGENTRUST_LLM_MODEL | — / gpt-4o-mini | OpenAI-compatible classifier credentials |
TypeScript SDK
| Variable | Default | Purpose |
|---|---|---|
AGENTRUST_GATEWAY_URL | http://localhost:8000 | Gateway base URL |
AGENTRUST_API_KEY | — | API key (not AGENTRUST_KEY) |
AGENTRUST_ENABLED | true | Kill-switch |
AGENTRUST_FAILURE_MODE | open | open | closed (no queue) |
AGENTRUST_TIMEOUT_MS | 10000 | Request timeout |
Gateway (Docker Compose / K8s)
| Variable | Purpose |
|---|---|
DATABASE_URL | PostgreSQL connection string (required — no default) |
REDIS_URL | Redis connection string |
AGENTRUST_ENV | production / development |
AGENTRUST_JWT_SECRET | JWT signing secret (required when auth on) |
AUTH_ENABLED | Defaults ON except dev/test |
RATE_LIMIT_ENABLED | Per-agent rate limiting |
RATE_LIMIT_PER_MINUTE | Declared in settings (default 60) but not read by the limiter — it loads gateway/config/rate_limits.yaml. Edit that file to change limits |
AGENTRUST_API_KEYS | Comma-separated static API keys |
AGENTRUST_AUTO_MIGRATE | Auto-run Alembic migrations |
JUDGE_BACKEND | disabled | ollama | claude |
ANTHROPIC_API_KEY | Claude judge backend |
WEBHOOK_URL, WEBHOOK_SECRET | Outbound webhooks |
AGENTRUST_AUDIT_ENCRYPTION_KEY | AES-256-GCM at-rest encryption |
OBJECT_STORE_* | S3/MinIO evidence offload |
VECTOR_STORE_* | pgvector/Chroma semantic search |
AGENTRUST_SIGNING_KEY | Ed25519 audit package signing |
AGENTRUST_HYBRID_MODE | Hybrid cloud telemetry |
OTEL_EXPORTER_OTLP_ENDPOINT | OpenTelemetry export |
RECERT_ENABLED | Continuous re-certification scheduler |
CORS_ALLOWED_ORIGINS | Dashboard CORS |
Two variables the gateway hard-fails on
Starting the gateway with AUTH_ENABLED=true and no AGENTRUST_JWT_SECRET — or a secret
shorter than 32 characters — aborts the process at startup. In a production-like
AGENTRUST_ENV (production, staging, prod, stg), AUTH_ENABLED=false or
RATE_LIMIT_ENABLED=false also aborts startup. Generate a secret with
openssl rand -hex 32.
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=5Examples
Kill-switch:
export AGENTRUST_ENABLED=falseQueue mode (air-gap):
export AGENTRUST_FAILURE_MODE=queue
export AGENTRUST_QUEUE_DB=/var/lib/agentrust/queue.dbBest Practices
- Inject secrets via your platform's secret manager, not
.envfiles in repos - Use
AGENTRUST_FAILURE_MODE=closedin staging,openin production (unless compliance requires closed) - Set
AUTH_ENABLED=trueon gateway in all non-dev environments - Document env var differences between Python and TypeScript SDKs in your runbooks
Common Mistakes
- Using
AGENTRUST_KEYin Node.js (useAGENTRUST_API_KEY) - Setting
AGENTRUST_RETRY_ATTEMPTSwithout installing[retry]extra - Running production gateway with
AUTH_ENABLED=false
Troubleshooting
| Issue | Check |
|---|---|
| SDK ignores env change | Every value is read live from os.environ on access, so no reload is needed. A client already constructed keeps the base URL and headers it was built with — construct a new one. |
| Invalid failure mode | Must be exactly open, closed, or queue |
| Gateway auth fails | Verify AGENTRUST_KEY matches AGENTRUST_API_KEYS or JWT |