Configuration
How AgentShield services are configured, how production mode tightens validation, and the configuration files that sit beside environment variables.
AgentShield services are configured entirely through environment variables, plus two files: the gateway's tools file and the policy documents stored through the control plane. Each service validates its configuration at startup and exits with a clear message rather than running in a degraded or unsafe mode.
Modes
AGENTSHIELD_ENV selects one of three modes:
| Mode | Purpose |
|---|---|
development (default) | Workstations. Allows the schema owner role, plain NATS and object storage, and an analyzer without a token |
test | Test suites. Same relaxations as development |
production | Shared and production environments. Enforces every requirement below |
Any other value is refused.
What production mode enforces
| Service | Requirement | Error if not met |
|---|---|---|
| Gateway, control plane, relay | DATABASE_URL user is agentshield_app | "production mode requires DATABASE_URL to use the agentshield_app role…" |
| Gateway | INTELLIGENCE_TOKEN set whenever INTELLIGENCE_URL is set | "production mode requires INTELLIGENCE_TOKEN when INTELLIGENCE_URL is set" |
| Gateway | INTELLIGENCE_URL is HTTPS unless loopback | "production mode requires https for a non-loopback INTELLIGENCE_URL" |
| Gateway | Tools file without allow_insecure_http or allow_private_networks | "…are refused in production" |
| Intelligence engine | INTELLIGENCE_TOKEN set, at least 32 characters | "production mode requires INTELLIGENCE_TOKEN" |
| Relay | NATS_URL uses tls:// unless loopback | "production mode requires tls:// for a non-loopback NATS_URL" |
| Relay, control plane | MINIO_USE_SSL=true unless the endpoint is loopback | "production mode requires MINIO_USE_SSL=true…" |
| Control plane | SMTP_URL uses smtps:// or require_tls=true | "production mode requires smtps:// or require_tls=true in SMTP_URL" |
| Control plane | DASHBOARD_URL is HTTPS when mail is configured | "production mode requires DASHBOARD_URL to use https when SMTP_URL is set" |
| Bootstrap | Refuses to run | — |
Always-on validation
Regardless of mode:
- Listen and metrics addresses must be valid
host:port; a metrics address equal to the API address is refused. DATABASE_URLmust be a PostgreSQL URL;REDIS_URLa Redis URL;NATS_URLnats://ortls://.MINIO_ENDPOINTmust behost:portwithout a scheme, with credentials present.GATEWAY_MAX_BODY_BYTEScannot exceed 1 MiB;INTELLIGENCE_TIMEOUTcannot exceed 5 s;RELAY_BATCHis 1–500.- The tools file is at most 1 MiB, rejects unknown fields and duplicate hosts, and every referenced credential variable must be non-empty.
The tools file
GATEWAY_TOOLS_CONFIG names a JSON file that enables adapters beyond sample.echo:
{
"http": {
"timeout": "5s",
"max_response_bytes": 262144,
"allow_insecure_http": false,
"allow_private_networks": false,
"hosts": [
{ "host": "api.github.com", "headers": { "Authorization": { "env": "AGENTSHIELD_GITHUB_AUTHORIZATION" } } }
]
}
}Field reference: Tool execution architecture.
Policy documents
Policies are configuration that lives in the database, managed through the control plane API or the console's Policies section. They take effect on the next authorize request. See Policy management.
Fixed limits
Some security limits are compile-time constants rather than configuration, so a mistaken environment variable cannot weaken them:
| Limit | Value | Source |
|---|---|---|
| Signature clock skew | 60 s | runtime/identity |
| Nonce reservation | 130 s | runtime/gateway/internal/nonce |
| Budgets | 60 requests, 30 per tool, 100,000 tokens per 60 s | runtime/gateway/internal/limits |
| Circuit | 5 failures → open 30 s | runtime/gateway/internal/limits |
| Approval expiry | 15 minutes | runtime/gateway/internal/store |
| Incident thresholds | 4096-byte arguments; 5 denies in 10 minutes | runtime/gateway/internal/limits |
| Session lifetime | 12 hours | apps/control-plane/src/sessions |
| Invitation lifetime | 72 hours | apps/control-plane |
| Control plane body limit | 256 KiB | apps/control-plane/src/http |
Example: production gateway
AGENTSHIELD_ENV=production
GATEWAY_HTTP_ADDR=0.0.0.0:8081
GATEWAY_METRICS_ADDR=0.0.0.0:9081
DATABASE_URL=postgres://agentshield_app:${DB_PASSWORD}@db.internal:5432/agentshield?sslmode=require
REDIS_URL=rediss://redis.internal:6380/0
GATEWAY_TOOLS_CONFIG=/etc/agentshield/gateway-tools.json
AGENTSHIELD_GITHUB_AUTHORIZATION="Bearer ${GITHUB_TOKEN}"
INTELLIGENCE_URL=https://intelligence.internal
INTELLIGENCE_TOKEN=${INTELLIGENCE_TOKEN}
INTELLIGENCE_TIMEOUT=500msAll variables: Environment variables.
Was this page helpful?
Kubernetes
Deploy AgentShield on Kubernetes with the Kustomize base and overlays. Local clusters, production configuration, secrets, network policy, and image verification.
Production Deployment
A production readiness checklist for AgentShield covering images, data stores, network exposure, secrets, monitoring, and operations.