Skip to Content
AgentShield
Self-Hosting

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:

ModePurpose
development (default)Workstations. Allows the schema owner role, plain NATS and object storage, and an analyzer without a token
testTest suites. Same relaxations as development
productionShared and production environments. Enforces every requirement below

Any other value is refused.

What production mode enforces

ServiceRequirementError if not met
Gateway, control plane, relayDATABASE_URL user is agentshield_app"production mode requires DATABASE_URL to use the agentshield_app role…"
GatewayINTELLIGENCE_TOKEN set whenever INTELLIGENCE_URL is set"production mode requires INTELLIGENCE_TOKEN when INTELLIGENCE_URL is set"
GatewayINTELLIGENCE_URL is HTTPS unless loopback"production mode requires https for a non-loopback INTELLIGENCE_URL"
GatewayTools file without allow_insecure_http or allow_private_networks"…are refused in production"
Intelligence engineINTELLIGENCE_TOKEN set, at least 32 characters"production mode requires INTELLIGENCE_TOKEN"
RelayNATS_URL uses tls:// unless loopback"production mode requires tls:// for a non-loopback NATS_URL"
Relay, control planeMINIO_USE_SSL=true unless the endpoint is loopback"production mode requires MINIO_USE_SSL=true…"
Control planeSMTP_URL uses smtps:// or require_tls=true"production mode requires smtps:// or require_tls=true in SMTP_URL"
Control planeDASHBOARD_URL is HTTPS when mail is configured"production mode requires DASHBOARD_URL to use https when SMTP_URL is set"
BootstrapRefuses 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_URL must be a PostgreSQL URL; REDIS_URL a Redis URL; NATS_URL nats:// or tls://.
  • MINIO_ENDPOINT must be host:port without a scheme, with credentials present.
  • GATEWAY_MAX_BODY_BYTES cannot exceed 1 MiB; INTELLIGENCE_TIMEOUT cannot exceed 5 s; RELAY_BATCH is 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:

LimitValueSource
Signature clock skew60 sruntime/identity
Nonce reservation130 sruntime/gateway/internal/nonce
Budgets60 requests, 30 per tool, 100,000 tokens per 60 sruntime/gateway/internal/limits
Circuit5 failures → open 30 sruntime/gateway/internal/limits
Approval expiry15 minutesruntime/gateway/internal/store
Incident thresholds4096-byte arguments; 5 denies in 10 minutesruntime/gateway/internal/limits
Session lifetime12 hoursapps/control-plane/src/sessions
Invitation lifetime72 hoursapps/control-plane
Control plane body limit256 KiBapps/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=500ms

All variables: Environment variables.

Was this page helpful?

On this page