Skip to main content

Configuration Reference

All configuration is handled by Pydantic Settings with the BEHAVRY_ prefix. Values can be set via environment variables or a .env file in the backend/ directory.


Core Settings

VariableDefaultRequiredDescription
BEHAVRY_ENVdevelopmentNodevelopment or production. Controls JWT auto-generation, debug routes, OpenAPI UI.
BEHAVRY_DEBUGfalseNoEnable verbose debug logging.

Database

VariableDefaultRequiredDescription
BEHAVRY_DB_URLpostgresql+asyncpg://behavry:behavry@localhost:5432/behavryYesAsync PostgreSQL connection string. Must use asyncpg driver.
BEHAVRY_DB_POOL_SIZE10NoSQLAlchemy connection pool size.
BEHAVRY_DB_MAX_OVERFLOW20NoMax connections above pool size during bursts.

Example:

BEHAVRY_DB_URL=postgresql+asyncpg://behavry:s3cr3t@db.internal:5432/behavry

OPA Policy Engine

VariableDefaultRequiredDescription
BEHAVRY_OPA_URLhttp://localhost:8181NoOPA sidecar base URL.
BEHAVRY_OPA_TIMEOUT_SECONDS2.0NoPer-request timeout for OPA calls. Keep low — this is in the agent's critical path.
BEHAVRY_OPA_FAIL_CLOSEDtrueNoIf true, OPA unreachability causes deny (safe default). Set false only for testing.

JWT / Auth

VariableDefaultRequired in ProdDescription
BEHAVRY_JWT_PRIVATE_KEY(auto-generated in dev)YesRS256 private key PEM. Generate with openssl genrsa -out private.pem 2048.
BEHAVRY_JWT_PUBLIC_KEY(auto-generated in dev)YesRS256 public key PEM. Generate with openssl rsa -in private.pem -pubout.
BEHAVRY_JWT_ALGORITHMRS256NoJWT signing algorithm. Do not change.
BEHAVRY_JWT_ISSUERbehavryNoJWT iss claim.
BEHAVRY_APP_SECRET_KEY(random at startup)NoApplication-level secret for session cookies (if used). Set explicitly for multi-instance deployments.

Generating keys:

openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -pubout -out public.pem
# Paste PEM content into env vars (preserve newlines)
export BEHAVRY_JWT_PRIVATE_KEY="$(cat private.pem)"
export BEHAVRY_JWT_PUBLIC_KEY="$(cat public.pem)"

Admin Auth

VariableDefaultRequiredDescription
BEHAVRY_ADMIN_USERNAMEadminNoUsername for the default tenant admin created on first run.
BEHAVRY_ADMIN_PASSWORD(empty — uses admin in dev)Yes in prodPassword for the default admin. In dev, defaults to admin. Must be set in production.
BEHAVRY_AUTH_PROVIDERpasswordNoAuth backend: password, clerk, or oidc.

Clerk OIDC (when BEHAVRY_AUTH_PROVIDER=clerk)

VariableDefaultRequiredDescription
BEHAVRY_CLERK_SECRET_KEY(empty)YesClerk backend API key (sk_live_... or sk_test_...).
BEHAVRY_CLERK_PUBLISHABLE_KEY(empty)NoClerk publishable key (frontend use, informational in backend).
BEHAVRY_CLERK_ISSUER(empty)YesClerk issuer URL, e.g. https://clerk.your-instance.clerk.accounts.dev.

Frontend also requires:

VITE_CLERK_PUBLISHABLE_KEY=pk_live_...  # Set in dashboard/.env

Generic OIDC (when BEHAVRY_AUTH_PROVIDER=oidc)

VariableDefaultRequiredDescription
BEHAVRY_OIDC_JWKS_URI(empty)YesJWKS endpoint, e.g. https://login.microsoftonline.com/{tenant}/discovery/v2.0/keys.
BEHAVRY_OIDC_ISSUER(empty)YesToken issuer, e.g. https://login.microsoftonline.com/{tenant}/v2.0.
BEHAVRY_OIDC_AUDIENCE(empty)NoExpected aud claim. Leave empty to skip audience verification.

CORS

VariableDefaultRequiredDescription
BEHAVRY_CORS_ORIGINS_STRhttp://localhost:3000,http://localhost:5173NoComma-separated list of allowed CORS origins. Set to your dashboard URL in production.

Example:

BEHAVRY_CORS_ORIGINS_STR=https://app.behavry.com,https://behavry-alpha.fly.dev

SSE

VariableDefaultDescription
BEHAVRY_SSE_KEEPALIVE_SECONDS15Interval for SSE keep-alive comments. Prevents proxy timeouts.

Webhooks / SIEM

VariableDefaultDescription
BEHAVRY_WEBHOOK_URL(empty)Comma-separated outbound webhook URLs (Slack, Teams, Splunk HEC, etc.).
BEHAVRY_WEBHOOK_SECRET(empty)HMAC-SHA256 signing secret. Included in X-Behavry-Signature header.
BEHAVRY_WEBHOOK_MIN_SEVERITYhighMinimum alert severity to trigger delivery: low, medium, high, critical.
BEHAVRY_WEBHOOK_FORMATjsonPayload format: json or cef (Common Event Format for SIEM).

Demo / External Integrations

VariableRequiredDescription
GITHUB_TOKENDemo onlyGitHub PAT for GitHub MCP server demo.
SLACK_BOT_TOKENDemo onlySlack bot token for Slack MCP server demo.
ANTHROPIC_API_KEYDemo onlyAnthropic API key for Claude agent demo.
OPENAI_API_KEYDemo onlyOpenAI API key for ChatGPT agent demo.

Ollama Proxy

VariableDefaultRequiredDescription
BEHAVRY_OLLAMA_URLhttp://localhost:11434NoUpstream Ollama server URL for the Ollama API proxy.

Deployment Mode (Sprint W)

These variables control the control-plane / data-plane split for hybrid deployments.

VariableDefaultRequiredDescription
BEHAVRY_DEPLOYMENT_MODEstandaloneNostandalone, control-plane, or data-plane.
BEHAVRY_CONTROL_PLANE_URL(empty)data-planeURL of the control plane (e.g. https://control.behavry.com).
BEHAVRY_DATA_PLANE_TOKEN(empty)data-planeToken issued by the control plane for authentication.
BEHAVRY_LICENSE_KEY(empty)data-planeLicense key for data plane validation.
BEHAVRY_DEPLOYMENT_ID(empty)data-planeUnique ID for this data plane instance.
BEHAVRY_HEARTBEAT_INTERVAL60NoSeconds between heartbeats to the control plane.

Example (data plane):

BEHAVRY_DEPLOYMENT_MODE=data-plane
BEHAVRY_CONTROL_PLANE_URL=https://control.behavry.com
BEHAVRY_DATA_PLANE_TOKEN=dp_abc123...
BEHAVRY_LICENSE_KEY=lic_xyz789...
BEHAVRY_DEPLOYMENT_ID=dp-us-east-1-01
BEHAVRY_HEARTBEAT_INTERVAL=60

Data Protection (Sprint DP)

VariableDefaultRequiredDescription
BEHAVRY_LOCAL_ENCRYPTION_KEY(empty)encrypted modeBase64-encoded 32-byte AES-256 key for the local KMS provider. Required when data protection mode is encrypted.

Generating a key:

python3 -c "import os, base64; print(base64.b64encode(os.urandom(32)).decode())"

Observability (Sprint O)

VariableDefaultRequiredDescription
BEHAVRY_SENTRY_DSN(empty)NoSentry DSN. Omit or leave empty to disable (zero overhead).
BEHAVRY_RELEASE_VERSION(empty)NoGit SHA for Sentry release tracking. Set BUILD_SHA in Docker build args.
BEHAVRY_METRICS_TOKEN(empty)NoBearer token for the /metrics endpoint. Empty = no auth (dev default).

Complete Minimal .env for Local Dev

BEHAVRY_ENV=development
BEHAVRY_ADMIN_PASSWORD=admin
BEHAVRY_DB_URL=postgresql+asyncpg://behavry:behavry@localhost:5432/behavry
BEHAVRY_OPA_URL=http://localhost:8181

Complete .env for Production (Standalone)

BEHAVRY_ENV=production
BEHAVRY_ADMIN_USERNAME=admin
BEHAVRY_ADMIN_PASSWORD=<strong-password>

# Database
BEHAVRY_DB_URL=postgresql+asyncpg://behavry:<db-password>@db:5432/behavry
BEHAVRY_DB_POOL_SIZE=10
BEHAVRY_DB_MAX_OVERFLOW=20

# OPA
BEHAVRY_OPA_URL=http://opa:8181
BEHAVRY_OPA_FAIL_CLOSED=true

# JWT keys (paste PEM, including header/footer lines)
BEHAVRY_JWT_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n..."
BEHAVRY_JWT_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----\n..."

# Auth provider (password | clerk | oidc)
BEHAVRY_AUTH_PROVIDER=password

# CORS
BEHAVRY_CORS_ORIGINS_STR=https://app.your-domain.com

# Webhooks (optional)
BEHAVRY_WEBHOOK_URL=https://hooks.slack.com/services/...
BEHAVRY_WEBHOOK_SECRET=<signing-secret>
BEHAVRY_WEBHOOK_MIN_SEVERITY=high

# Data protection (optional — set if dp_mode=encrypted)
# BEHAVRY_LOCAL_ENCRYPTION_KEY=<base64-encoded-32-byte-key>

# Observability (optional)
# BEHAVRY_SENTRY_DSN=https://...@sentry.io/...
# BEHAVRY_METRICS_TOKEN=<random-bearer-token>

Complete .env for Data Plane

BEHAVRY_ENV=production
BEHAVRY_DEPLOYMENT_MODE=data-plane
BEHAVRY_CONTROL_PLANE_URL=https://control.behavry.com
BEHAVRY_DATA_PLANE_TOKEN=<token-from-control-plane>
BEHAVRY_LICENSE_KEY=<license-key>
BEHAVRY_DEPLOYMENT_ID=dp-us-east-1-01
BEHAVRY_HEARTBEAT_INTERVAL=60

# Database (local to data plane)
BEHAVRY_DB_URL=postgresql+asyncpg://behavry:<db-password>@db:5432/behavry

# OPA (bundle-polling mode — configured via opa-data-plane.yaml)
BEHAVRY_OPA_URL=http://opa:8181
BEHAVRY_OPA_FAIL_CLOSED=true

# JWT keys (synced from control plane JWKS, or set manually)
BEHAVRY_JWT_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----\n..."
BEHAVRY_JWT_PUBLIC_KEY="-----BEGIN PUBLIC KEY-----\n..."

Authentication Providers

VariableDefaultRequiredDescription
BEHAVRY_CLERK_SECRET_KEYClerk onlyClerk backend secret, used for org provisioning and webhook signature verification
BEHAVRY_CLERK_WEBHOOK_SECRETClerk onlySecret used to verify Clerk webhooks (user / org events)
BEHAVRY_OIDC_ISSUEROIDC onlyIssuer URL (e.g. https://login.microsoftonline.com/{tenant}/v2.0)
BEHAVRY_OIDC_CLIENT_IDOIDC onlyOIDC client ID
BEHAVRY_OIDC_CLIENT_SECRETOIDC onlyOIDC client secret
BEHAVRY_SAML_IDP_METADATA_URLSAML onlyIdP metadata URL (or upload via API)

The dashboard and docs sites also read a publishable key at build time:

VariableWhereDescription
VITE_CLERK_PUBLISHABLE_KEYdashboardClerk publishable key used by the React dashboard
CLERK_PUBLISHABLE_KEYdocsiteClerk publishable key used by the documentation site's auth gate

Both should point to the same Clerk project; add the dashboard and docs hostnames as Clerk satellite domains so sessions span both.


AI Surface Proxies

Behavry forwards LLM traffic to upstream providers through dedicated proxy modules. The upstream URL for each can be overridden (useful for self-hosted or on-prem model endpoints):

VariableDefaultDescription
BEHAVRY_NEMOCLAW_URLhttp://localhost:7860NVIDIA NemoClaw API upstream
BEHAVRY_OPENSHELL_URLhttp://localhost:7861NVIDIA OpenShell API upstream

The Anthropic, OpenAI, Google Gemini, and Ollama proxies use the standard provider base URLs and pick up credentials at request time from the client.


Data Protection (Sprint DP)

VariableDefaultDescription
BEHAVRY_LOCAL_ENCRYPTION_KEYBase64-encoded 32-byte AES-256 key for the local KMS provider (dev only)
BEHAVRY_KMS_PROVIDERlocallocal or aws
BEHAVRY_AWS_KMS_KEY_ARNCMK ARN when BEHAVRY_KMS_PROVIDER=aws

See Data Protection Pipeline.