Skip to main content

Configuration Reference

Version: 0.1.0

All DecisionBox services are configured via environment variables. This page lists every variable, its default, and which service uses it.

Agent

The agent (decisionbox-agent) is a standalone binary that runs discovery. It reads project configuration from MongoDB but needs environment variables for infrastructure access.

Required

VariableDefaultDescription
MONGODB_URI(required)MongoDB connection string. Examples: mongodb://localhost:27017, mongodb+srv://user:pass@cluster.mongodb.net
MONGODB_DBdecisionboxMongoDB database name. Must match the API's database.

Secret Provider

The agent reads LLM API keys and warehouse credentials from a secret provider. These are configured per-project via the dashboard.

VariableDefaultDescription
SECRET_PROVIDERmongodbWhich secret provider to use. Options: mongodb, gcp, aws
SECRET_NAMESPACEdecisionboxNamespace prefix for all secrets. Prevents conflicts in shared cloud accounts.
SECRET_ENCRYPTION_KEY(empty)Base64-encoded 32-byte AES key for MongoDB secret provider. Generate with: openssl rand -base64 32. If empty, secrets are stored in plaintext (with warning).
SECRET_GCP_PROJECT_ID(empty)GCP project ID. Only required when SECRET_PROVIDER=gcp.
SECRET_AWS_REGIONus-east-1AWS region. Only used when SECRET_PROVIDER=aws.

LLM Behavior

VariableDefaultDescription
LLM_MAX_RETRIES3Number of retries on LLM API errors (rate limits, timeouts). Set to 0 for no retries.
LLM_TIMEOUT300sTimeout per LLM API call. Go duration format: 30s, 2m, 5m. Increased from 120s because large prompts on Opus-class models need more time.
LLM_REQUEST_DELAY_MS1000Delay between consecutive LLM calls in milliseconds. Helps with rate limiting and cost control. Set to 0 for no delay.

Domain Packs

VariableDefaultDescription
DOMAIN_PACK_PATH/app/domain-packsRoot directory containing domain pack files. In Docker: baked into image at /app/domain-packs. In development: ../../domain-packs (relative to services/agent/).

Operational

VariableDefaultDescription
SERVICE_NAMEdecisionbox-agentService name that appears in log output.
ENVdevEnvironment. dev = human-readable console logs. prod or production = structured JSON logs.
LOG_LEVELinfoLog verbosity. Options: debug, info, warn, error.

Agent CLI Flags

The agent also accepts command-line flags (typically set by the API when spawning):

FlagRequiredDefaultDescription
--project-idYesProject ID to run discovery for.
--run-idNoDiscovery run ID for live status updates. Set by the API.
--areasNo(all)Comma-separated analysis areas to run. Empty = all areas. Example: --areas churn,monetization
--max-stepsNo100Maximum exploration steps. More steps = more comprehensive but slower and more expensive.
--estimateNofalseEstimate cost only (no actual discovery). Outputs JSON to stdout.
--skip-cacheNofalseForce re-discovery of warehouse schemas (ignore cache).
--enable-debug-logsNotrueWrite detailed debug logs to MongoDB (TTL: 30 days).
--testNofalseTest mode — limits analysis for faster runs.

API

The API (decisionbox-api) is the REST server that manages projects, discoveries, and spawns agents.

Required

VariableDefaultDescription
MONGODB_URI(required)MongoDB connection string. Must be the same database as the agent.
MONGODB_DBdecisionboxMongoDB database name.
PORT8080HTTP listen port.

Secret Provider

Same variables as the agent — the API reads secrets to display masked values in the dashboard.

VariableDefaultDescription
SECRET_PROVIDERmongodbSame as agent. Must match.
SECRET_NAMESPACEdecisionboxSame as agent. Must match.
SECRET_ENCRYPTION_KEY(empty)Same as agent. Must match.
SECRET_GCP_PROJECT_ID(empty)Same as agent.
SECRET_AWS_REGIONus-east-1Same as agent.

Domain Packs

VariableDefaultDescription
DOMAIN_PACK_PATH/app/domain-packsSame as agent. The API reads domain pack metadata (areas, categories, profile schemas) for the dashboard.

Agent Runner

The API spawns the agent for each discovery run. Two modes:

VariableDefaultDescription
RUNNER_MODEsubprocessHow to spawn the agent. subprocess = exec.Command (local dev, agent binary must be in PATH). kubernetes = create a K8s Job per discovery (production).

Subprocess mode — No additional configuration. The agent binary (decisionbox-agent) must be in the system PATH.

Kubernetes mode — Additional configuration:

VariableDefaultDescription
AGENT_IMAGEghcr.io/decisionbox-io/decisionbox-agent:latestDocker image for the agent container.
AGENT_NAMESPACEdefaultKubernetes namespace for agent Jobs.
AGENT_CPU_REQUEST250mCPU request for agent containers (K8s resource quantity).
AGENT_CPU_LIMIT2CPU limit for agent containers.
AGENT_MEMORY_REQUEST256MiMemory request for agent containers.
AGENT_MEMORY_LIMIT1GiMemory limit for agent containers.
AGENT_JOB_TIMEOUT_HOURS6Maximum time (hours) to watch a K8s Job before giving up. Increase for very large datasets.

Operational

VariableDefaultDescription
SERVICE_NAMEdecisionbox-apiService name in logs.
ENVdevEnvironment (dev or prod).
LOG_LEVELinfoLog level: debug, info, warn, error.

Dashboard

The dashboard (decisionbox-dashboard) is a Next.js application that proxies API requests via middleware.

VariableDefaultDescription
API_URLhttp://localhost:8080Backend API URL. Server-side only — not exposed to the browser. In Docker: http://api:8080. In K8s: http://decisionbox-api:8080.
PORT3000Dashboard listen port.
HOSTNAME0.0.0.0Bind address. 0.0.0.0 = all interfaces. 127.0.0.1 = localhost only.

Important: API_URL is a runtime variable read by Next.js middleware on each request. It is NOT baked at build time. This means a single Docker image works across all environments — just change the environment variable.


Docker Compose

The docker-compose.yml includes all variables with documentation. Here's the minimal configuration:

services:
mongodb:
image: mongo:7.0
ports: ["27017:27017"]
volumes: [mongodb_data:/data/db]

api:
build: { context: ., dockerfile: services/api/Dockerfile }
ports: ["8080:8080"]
environment:
- MONGODB_URI=mongodb://mongodb:27017
- MONGODB_DB=decisionbox
- SECRET_PROVIDER=mongodb
- SECRET_ENCRYPTION_KEY=${SECRET_ENCRYPTION_KEY:-}
- DOMAIN_PACK_PATH=/app/domain-packs
- RUNNER_MODE=subprocess
depends_on:
mongodb: { condition: service_healthy }

dashboard:
build: { context: ui/dashboard, dockerfile: Dockerfile }
ports: ["3000:3000"]
environment:
- API_URL=http://api:8080
depends_on: [api]

volumes:
mongodb_data:

Generating an Encryption Key

For the MongoDB secret provider, generate a 32-byte encryption key:

# Generate key
openssl rand -base64 32

# Set in docker-compose or .env file
export SECRET_ENCRYPTION_KEY=$(openssl rand -base64 32)
docker compose up -d

File-Based Secrets (Kubernetes)

Environment variables support a file:// prefix for Kubernetes secret mounts:

# In K8s, mount secrets as files and reference them:
SECRET_ENCRYPTION_KEY=file:///var/run/secrets/encryption-key

This reads the file contents instead of using the env var value directly.


Precedence

  1. Environment variables — Highest priority. Override everything.
  2. Defaults in code — Used when env var is not set.
  3. Project configuration (MongoDB) — Per-project settings (warehouse, LLM, schedule) are stored in MongoDB and configured via the dashboard.

Next Steps