Environment Variables
Every environment variable read by the AgentShield services, with defaults, constraints, and production requirements.
All services read configuration from the environment and refuse to start when a value is invalid or unsafe for the selected mode. .env.example at the repository root holds development defaults for Compose.
Shared
| Variable | Services | Default | Notes |
|---|---|---|---|
AGENTSHIELD_ENV | All | development | development, test, or production. Production enforces the requirements marked below |
DATABASE_URL | Gateway, control plane, relay | — | postgres:// or postgresql://. Production: user must be agentshield_app |
Gateway
| Variable | Default | Notes |
|---|---|---|
GATEWAY_HTTP_ADDR | 127.0.0.1:8081 | host:port |
REDIS_URL | — | redis:// or rediss://. Required with DATABASE_URL to authorize |
GATEWAY_MAX_BODY_BYTES | 1048576 | 1 to 1048576 |
GATEWAY_SHUTDOWN_TIMEOUT | 10s | 1 s to 1 min |
GATEWAY_TOOLS_CONFIG | — | Path to the tools file. Empty registers only sample.echo |
GATEWAY_METRICS_ADDR | 127.0.0.1:9081 | host:port or off. Must differ from the API address |
INTELLIGENCE_URL | — | Analyzer origin. Empty disables analysis. Production: HTTPS unless loopback |
INTELLIGENCE_TOKEN | — | Bearer token for the analyzer. Production: required |
INTELLIGENCE_TIMEOUT | 500ms | Go duration, at most 5s |
| Tools file header variables | — | Any variable named by {"env": "…"} in the tools file. Must be non-empty, without line breaks |
Control plane
| Variable | Default | Notes |
|---|---|---|
CONTROL_PLANE_HOST | 127.0.0.1 | Listen host |
CONTROL_PLANE_PORT | 8080 | Listen port |
CONTROL_PLANE_METRICS_ADDR | 127.0.0.1:9080 | host:port or off. Must differ from the API port |
DASHBOARD_URL | http://127.0.0.1:3000 | Used to build invitation links. Production with mail: HTTPS |
SMTP_URL | — | smtp://[user:pass@]host[:port][?require_tls=true] or smtps://…. Enables emailed invitations. Production: smtps:// or require_tls=true |
MAIL_FROM | AgentShield <no-reply@agentshield.local> | Sender address |
MINIO_ENDPOINT | — | host:port, no scheme. Enables evidence reads |
MINIO_ACCESS_KEY / MINIO_ROOT_USER | — | Required with MINIO_ENDPOINT; MINIO_ACCESS_KEY wins |
MINIO_SECRET_KEY / MINIO_ROOT_PASSWORD | — | Required with MINIO_ENDPOINT; MINIO_SECRET_KEY wins |
MINIO_USE_SSL | false | Production: true unless the endpoint is loopback |
Bootstrap only
Read by npm run bootstrap / node apps/control-plane/dist/bootstrap.js. All five are required; Compose supplies the defaults below, but a run from source must set them. The password must be 12–128 characters. Not production credentials; the command refuses production mode.
| Variable | Development default |
|---|---|
AGENTSHIELD_BOOTSTRAP_EMAIL | owner@example.com |
AGENTSHIELD_BOOTSTRAP_PASSWORD | change-me-local-only |
AGENTSHIELD_BOOTSTRAP_DISPLAY_NAME | Local Owner |
AGENTSHIELD_BOOTSTRAP_ORG_NAME | Local |
AGENTSHIELD_BOOTSTRAP_ORG_SLUG | local |
Event relay
| Variable | Default | Notes |
|---|---|---|
RELAY_HTTP_ADDR | 127.0.0.1:8083 | Health and /metrics |
DATABASE_URL | — | Required. Production: agentshield_app |
NATS_URL | — | Required. nats:// or tls://. Production: tls:// unless loopback |
RELAY_BATCH | 100 | Outbox rows per drain, 1 to 500 |
MINIO_ENDPOINT | — | Enables evidence bundles. host:port, no scheme |
MINIO_ACCESS_KEY / MINIO_ROOT_USER | — | Required with MINIO_ENDPOINT |
MINIO_SECRET_KEY / MINIO_ROOT_PASSWORD | — | Required with MINIO_ENDPOINT |
MINIO_BUCKET | agentshield-evidence | Bucket for new bundles. The control plane reads the bucket recorded with each bundle |
MINIO_USE_SSL | false | Production: true unless loopback |
Intelligence engine
| Variable | Default | Notes |
|---|---|---|
INTELLIGENCE_HTTP_ADDR | 127.0.0.1:8082 | host:port |
INTELLIGENCE_TOKEN | — | At least 32 characters. Production: required |
INTELLIGENCE_METRICS_ADDR | 127.0.0.1:9082 | host:port or off. Must use a different port |
Dashboard
| Variable | Default | Notes |
|---|---|---|
CONTROL_PLANE_URL | http://127.0.0.1:8080 | Server-side only; the browser never calls the control plane directly |
DASHBOARD_ORIGIN | From the Host header | Set to the public origin when a proxy rewrites Host; used for the same-origin write check |
NODE_ENV | — | production marks the session cookie Secure |
CONTROL_PLANE_TOKEN | — | Optional fallback bearer token. Prefer signing in through the console |
NEXT_OUTPUT | — | standalone for the container build |
Docker Compose
Compose reads these from .env to override published ports and credentials:
| Variable | Default |
|---|---|
POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB, POSTGRES_PORT | agentshield, agentshield, agentshield, 5432 |
REDIS_PORT, NATS_PORT | 6379, 4222 |
MINIO_ROOT_USER, MINIO_ROOT_PASSWORD | agentshield, agentshield-dev-only |
GATEWAY_PORT, CONTROL_PLANE_PORT, DASHBOARD_PORT, INTELLIGENCE_PORT, RELAY_PORT | 8081, 8080, 3000, 8082, 8083 |
PROMETHEUS_PORT, GRAFANA_PORT, GRAFANA_ADMIN_PASSWORD | 9090, 3001, agentshield-dev-only |
MAILPIT_SMTP_PORT, MAILPIT_UI_PORT | 1025, 8025 |
Integrations
| Variable | Used by | Notes |
|---|---|---|
AGENTSHIELD_GATEWAY | MCP server | Gateway origin |
AGENTSHIELD_AGENT_ID | MCP server | Agent id |
AGENTSHIELD_ORGANIZATION_ID | MCP server | Organization id |
AGENTSHIELD_SEED_FILE | MCP server | Path to the 32-byte seed |
AGENTSHIELD_TOOLS | MCP server | Comma-separated tool names, default sample.echo |
Was this page helpful?
Deployment Overview
Plan an AgentShield deployment. Components to run, data stores to provide, deployment options, and the path from a workstation to production.
Docker Compose
Run AgentShield with Docker Compose. Data services, the app profile, the observability profile, configuration overrides, and lifecycle commands.