All env vars are prefixed Z4J_ (brain-side) or read from the Z4J dict in framework settings (agent-side). Brain settings map onto fields in z4j_brain.settings.Settings; the prefix is dropped and the name lowercased (e.g. Z4J_EVENT_RETENTION_DAYS -> settings.event_retention_days).
This page lists every Z4J_* variable the brain reads. Most operators set only the required four plus a handful from the Database, Retention, and Metrics sections; the rest are exposed for fine-tuning under sustained load or unusual deployments.
Comma-separated previous Z4J_SECRET values still accepted while verifying older audit rows / frames during rotation. Writes always use the new Z4J_SECRET. Empty = no rotation in progress.
Z4J_PREVIOUS_SESSION_SECRETS
-
Comma-separated previous session secrets still accepted while verifying older cookies during rotation.
Hard cap on a session’s age (default 7 days). Sessions are rejected past this regardless of activity.
Z4J_SESSION_IDLE_TIMEOUT_SECONDS
1800
Sliding idle timeout (default 30 minutes). Sessions whose last_seen_at is older than this are rejected.
Z4J_SESSION_COOKIE_SAMESITE
lax
SameSite attribute on the session cookie. lax or strict.
Z4J_SESSION_PIN_USER_AGENT
false
If true, the resolved client User-Agent at session issue time is enforced on every subsequent request. Off by default; too many false positives on mobile networks.
Z4J_LOGIN_LOCKOUT_THRESHOLD
10
Failed login attempts on a single account before lockout.
Z4J_LOGIN_LOCKOUT_DURATION_SECONDS
900
Lockout duration after threshold exceeded.
Z4J_LOGIN_BACKOFF_BASE_SECONDS
0.5
Base per-failure backoff applied to the login response.
Z4J_LOGIN_BACKOFF_MAX_SECONDS
5.0
Cap on the per-failure backoff.
Z4J_LOGIN_MIN_DURATION_MS
300
Minimum total response time for /auth/login (success or failure). Held by asyncio.sleep so timing variance cannot leak whether the account exists.
Z4J_LOG_LOGIN_EMAIL
false
Log the attempted email on failed logins. Off by default (PII consideration).
Bearer token required by /metrics. Operators may provide one explicitly via env or ~/.z4j/secret.env; if absent and Z4J_METRICS_PUBLIC is unset, z4j serve auto-mints one and writes it to ~/.z4j/secret.env. Run z4j metrics-token to print or rotate.
Z4J_METRICS_PUBLIC
false
Set to 1 to leave /metrics open. Use only when the endpoint is firewalled or behind an authenticated proxy.
Z4J_METRICS_ENABLED
true
Set to false to skip mounting the /metrics route entirely (very rare; use the auth-token instead).
The brain’s BrainRegistry routes commands to agent connections across replicas. The default postgres_notify backend uses Postgres LISTEN/NOTIFY; SQLite forces local automatically.
Variable
Default
Description
Z4J_REGISTRY_BACKEND
postgres_notify
postgres_notify or local. SQLite forces local.
Z4J_REGISTRY_LISTENER_HEARTBEAT_SECONDS
10
Self-NOTIFY heartbeat for the watchdog on the LISTEN connection.
Z4J_REGISTRY_LISTENER_HEARTBEAT_TIMEOUT_SECONDS
25
Timeout before the watchdog reconnects the LISTEN connection.
Z4J_REGISTRY_LISTENER_MAX_AGE_SECONDS
900
Hard-recycle interval for the LISTEN connection.
Z4J_REGISTRY_RECONCILE_INTERVAL_SECONDS
30
Poll cadence for pending commands targeting an agent this replica owns.
When the brain needs to push a schedule trigger to z4j-scheduler, it dials an outbound gRPC channel. Without Z4J_SCHEDULER_TRIGGER_URL set, the brain falls back to its in-process scheduler path and the TLS variables are ignored.
Variable
Default
Description
Z4J_SCHEDULER_TRIGGER_URL
-
host:port of the scheduler’s TriggerSchedule listener.
Z4J_SCHEDULER_TRIGGER_TLS_CERT
-
Path to the brain’s client certificate.
Z4J_SCHEDULER_TRIGGER_TLS_KEY
-
Path to the brain’s client key.
Z4J_SCHEDULER_TRIGGER_TLS_CA
-
Path to the CA bundle the brain uses to verify the scheduler’s server cert.
Env vars override everything. File-based settings (~/.z4j/config.env) can supplement env vars but not replace them. Explicit keyword arguments to the framework adapter win over both.
We use analytics cookies
Anonymous pageview + referrer data via Google Analytics so
we can see which docs are useful. No advertising, no
cross-site tracking. You can change your mind any time.