Skip to Content
AgentShield
Self-Hosting

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

VariableServicesDefaultNotes
AGENTSHIELD_ENVAlldevelopmentdevelopment, test, or production. Production enforces the requirements marked below
DATABASE_URLGateway, control plane, relay—postgres:// or postgresql://. Production: user must be agentshield_app

Gateway

VariableDefaultNotes
GATEWAY_HTTP_ADDR127.0.0.1:8081host:port
REDIS_URL—redis:// or rediss://. Required with DATABASE_URL to authorize
GATEWAY_MAX_BODY_BYTES10485761 to 1048576
GATEWAY_SHUTDOWN_TIMEOUT10s1 s to 1 min
GATEWAY_TOOLS_CONFIG—Path to the tools file. Empty registers only sample.echo
GATEWAY_METRICS_ADDR127.0.0.1:9081host: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_TIMEOUT500msGo 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

VariableDefaultNotes
CONTROL_PLANE_HOST127.0.0.1Listen host
CONTROL_PLANE_PORT8080Listen port
CONTROL_PLANE_METRICS_ADDR127.0.0.1:9080host:port or off. Must differ from the API port
DASHBOARD_URLhttp://127.0.0.1:3000Used 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_FROMAgentShield <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_SSLfalseProduction: 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.

VariableDevelopment default
AGENTSHIELD_BOOTSTRAP_EMAILowner@example.com
AGENTSHIELD_BOOTSTRAP_PASSWORDchange-me-local-only
AGENTSHIELD_BOOTSTRAP_DISPLAY_NAMELocal Owner
AGENTSHIELD_BOOTSTRAP_ORG_NAMELocal
AGENTSHIELD_BOOTSTRAP_ORG_SLUGlocal

Event relay

VariableDefaultNotes
RELAY_HTTP_ADDR127.0.0.1:8083Health and /metrics
DATABASE_URL—Required. Production: agentshield_app
NATS_URL—Required. nats:// or tls://. Production: tls:// unless loopback
RELAY_BATCH100Outbox 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_BUCKETagentshield-evidenceBucket for new bundles. The control plane reads the bucket recorded with each bundle
MINIO_USE_SSLfalseProduction: true unless loopback

Intelligence engine

VariableDefaultNotes
INTELLIGENCE_HTTP_ADDR127.0.0.1:8082host:port
INTELLIGENCE_TOKEN—At least 32 characters. Production: required
INTELLIGENCE_METRICS_ADDR127.0.0.1:9082host:port or off. Must use a different port

Dashboard

VariableDefaultNotes
CONTROL_PLANE_URLhttp://127.0.0.1:8080Server-side only; the browser never calls the control plane directly
DASHBOARD_ORIGINFrom the Host headerSet 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:

VariableDefault
POSTGRES_USER, POSTGRES_PASSWORD, POSTGRES_DB, POSTGRES_PORTagentshield, agentshield, agentshield, 5432
REDIS_PORT, NATS_PORT6379, 4222
MINIO_ROOT_USER, MINIO_ROOT_PASSWORDagentshield, agentshield-dev-only
GATEWAY_PORT, CONTROL_PLANE_PORT, DASHBOARD_PORT, INTELLIGENCE_PORT, RELAY_PORT8081, 8080, 3000, 8082, 8083
PROMETHEUS_PORT, GRAFANA_PORT, GRAFANA_ADMIN_PASSWORD9090, 3001, agentshield-dev-only
MAILPIT_SMTP_PORT, MAILPIT_UI_PORT1025, 8025

Integrations

VariableUsed byNotes
AGENTSHIELD_GATEWAYMCP serverGateway origin
AGENTSHIELD_AGENT_IDMCP serverAgent id
AGENTSHIELD_ORGANIZATION_IDMCP serverOrganization id
AGENTSHIELD_SEED_FILEMCP serverPath to the 32-byte seed
AGENTSHIELD_TOOLSMCP serverComma-separated tool names, default sample.echo

Was this page helpful?

On this page