Skip to content

Environment variables

All env vars are prefixed Z4J_ (brain-side) or read from the Z4J dict in framework settings (agent-side).

VariableRequiredDefaultDescription
Z4J_DATABASE_URLyes-PostgreSQL connection string (postgresql+asyncpg://...)
Z4J_SECRETyes-Main app secret (hex, 64 chars recommended)
Z4J_SESSION_SECRETyes-Session signing secret
Z4J_AUDIT_SECRETyes-HMAC audit chain secret
Z4J_PUBLIC_URLyes-Full public URL with scheme
Z4J_DB_POOL_SIZEno10asyncpg pool size
Z4J_DB_POOL_MAX_OVERFLOWno5Overflow connections
Z4J_PASSWORD_MIN_LENGTHno8Min password length
Z4J_ARGON2_TIME_COSTno3argon2id time cost
Z4J_ARGON2_MEMORY_COSTno65536argon2id memory (KiB)
Z4J_ARGON2_PARALLELISMno4argon2id threads
Z4J_SMTP_HOSTno-SMTP server
Z4J_SMTP_PORTno587SMTP port
Z4J_SMTP_USERno-SMTP username
Z4J_SMTP_PASSWORDno-SMTP password
Z4J_SMTP_FROMno-From address
Z4J_SMTP_TLSnostarttlsTLS mode
Z4J_SMTP_TIMEOUTno10Timeout in seconds
Z4J_RECONCILE_ENABLEDnotrueEnable reconciliation
Z4J_RECONCILE_INTERVALno60Seconds between passes
Z4J_RECONCILE_THRESHOLD_SECONDSno1800”Started” age before query
Z4J_RECONCILE_MAX_PER_PASSno500Max tasks per pass per agent
Z4J_TASK_RETENTION_DAYSno90Days before tasks are swept
Z4J_METRICS_TOKENno-Token for /metrics endpoint
Z4J_SENTRY_DSNno-Sentry error reporting
Z4J_AUDIT_VERIFY_INTERVALno-Seconds between auto-verify runs
Z4J_BOOTSTRAP_ADMIN_EMAILno-Auto-provision admin on first boot
Z4J_BOOTSTRAP_ADMIN_PASSWORDno-Required with above
Z4J_AUTOMIGRATEnotrueRun Alembic on boot

Set in your framework’s config dict (e.g., Django settings.Z4J):

KeyRequiredDefaultDescription
brain_urlyes-WebSocket URL of the brain
tokenyes-Agent bearer token
project_idno"default"Project ID
agent_nameno$HOSTNAMEDisplay name
buffer_sizeno1000Event buffer cap
heartbeat_intervalno30Seconds between heartbeats
reconnect_backoff_maxno60Max backoff on reconnect

Env vars override everything. File-based settings can supplement env vars but not replace them.