Skip to main content

Configuration reference

Every Z3rno surface beyond the always-on base (store / recall / forget / audit / sessions / api-keys / conversations / limits / graph) is opt-in via a gating flag. Default values produce a working local-dev stack against docker-compose.dev.yml; flip the gates as you light up Forge / Ingest / Refine / forget-proof / OpenTelemetry / etc.
Source of truth: z3rno-server/src/z3rno_server/config.py. Variables names are case-insensitive; values are read from environment or .env file. As of v0.20.0.

Database

VariableDefaultNotes
DATABASE_URLpostgresql+asyncpg://z3rno:z3rno_dev_password@localhost:5432/z3rnoAsync driver required (asyncpg).
DATABASE_POOL_SIZE20SQLAlchemy connection pool.
DATABASE_MAX_OVERFLOW10Pool overflow above DATABASE_POOL_SIZE.
DATABASE_READ_URL""Opt-in (Phase G slice 1). When set, pure-read GET endpoints route SELECTs to the replica. WAL replay lag is checked at session acquire; over-threshold falls back to primary.
READ_REPLICA_LAG_CHECK_ENABLEDtrueHonoured only when DATABASE_READ_URL is set.
READ_REPLICA_LAG_THRESHOLD_SECONDS5.0Replica skipped when lag exceeds this.

Valkey / Redis

VariableDefaultNotes
VALKEY_URL""Preferred. Falls back to REDIS_URL when empty.
REDIS_URLredis://localhost:6379/0Back-compat alias.

Embedding

VariableDefaultNotes
EMBEDDING_PROVIDERlitellmRoutes embedding calls through LiteLLM.
EMBEDDING_MODELtext-embedding-3-smallOpenAI default. Output dim is hard-coded at 1536 (ADR-001).
OPENAI_API_KEY""Required for OpenAI embeddings. Also the fallback for LLM_API_KEY and MULTIMODAL_API_KEY.

Authentication

VariableDefaultNotes
Z3RNO_API_KEY""Dev bypass. When set, this key authenticates without a DB lookup. The fresh-local-server default is z3rno_sk_test_localdev — rotate it for any non-localhost deploy. Production keys are generated via POST /v1/api-keys.
Z3RNO_DEV_ORG_ID""Org id stamped on requests authenticated by Z3RNO_API_KEY.
API_KEY_HEADERX-API-KeyAlternative to Authorization: Bearer.
API_KEY_CACHE_TTL60Valkey cache TTL (seconds) for verified API keys.
JWT_SECRET_KEY""HMAC secret for dashboard JWT auth. Required when JWT auth is in use.
JWT_ALGORITHMHS256
JWT_EXPIRY_MINUTES60

Rate limiting

VariableDefaultNotes
RATE_LIMIT_ENABLEDtrueToggles the entire middleware.
RATE_LIMIT_PER_MINUTE60Per-API-key request budget.
RATE_LIMIT_BURST10Burst allowance above the steady rate.

Server / CORS / logging

VariableDefaultNotes
SERVER_HOST0.0.0.0
SERVER_PORT8000
DEBUGfalse
CORS_ORIGINShttp://localhost:3000,http://localhost:8000Comma-separated.
LOG_LEVELINFODEBUG / INFO / WARNING / ERROR / CRITICAL.
LOG_FORMATjsonjson or text.

Celery backpressure

VariableDefaultNotes
CELERY_QUEUE_DEPTH_THRESHOLD1000When broker depth exceeds this, /v1/ingest* returns 503 with Retry-After. Set to 0 to disable.
CELERY_QUEUE_DEPTH_RETRY_AFTER_SECONDS30Value of the Retry-After header on backpressure 503s.

Phase A — Forge (DISTILL_ENABLED)

The Forge pipeline is dormant unless DISTILL_ENABLED=true. With the flag off, /v1/distill is not registered and z3rno.forge_distill self-rejects.
VariableDefaultNotes
DISTILL_ENABLEDfalseMaster gate.
LLM_PROVIDERopenaiopenai / anthropic / gemini / bedrock / ollama.
LLM_MODELopenai/gpt-4o-miniLiteLLM-namespaced model id.
LLM_API_KEY""Falls back to OPENAI_API_KEY when provider is openai.
LLM_TIMEOUT_SECONDS30.0Per-call timeout.
LLM_MAX_RETRIES3Tenacity retry budget.
STRUCTURED_OUTPUT_FRAMEWORKinstructorOnly instructor is shipped.
DISTILL_CHUNK_SIZE1024tokens
DISTILL_CHUNK_OVERLAP128tokens
DISTILL_MAX_CONCURRENCY4Per-job LLM fan-out semaphore.
DISTILL_SUMMARY_STYLEconciseconcise / bullet / abstractive.
DISTILL_PROVENANCE_REQUIREDfalsePhase F slice 1. When true, aborts the Forge transaction if any Memo’s provenance + audit chain entry can’t be written.

Phase B.1 — Ingestion (INGEST_ENABLED)

/v1/ingest, /v1/ingest/file, /v1/datasets and the z3rno.ingest_run worker register only when INGEST_ENABLED=true.
VariableDefaultNotes
INGEST_ENABLEDfalseMaster gate.
STORAGE_BACKENDlocallocal (filesystem) or s3 (Phase B.2).
STORAGE_LOCAL_DIR/var/lib/z3rno/artifacts
INGEST_MAX_FILE_BYTES52428800 (50 MB)Hard cap on uploads + URL responses.
INGEST_MAX_CSV_ROWS10000
INGEST_DEFAULT_CHUNK_SIZE1024Per-request override allowed.
INGEST_AUTO_DISTILLtrueChain ingest → z3rno.forge_distill when DISTILL_ENABLED=true.
URL_FETCH_TIMEOUT_SECONDS15.0
URL_ALLOWED_SCHEMEShttp,https

Phase B.2 — Multimodal / S3 / Tavily / Playwright

Each capability flips on independently — multimodal doesn’t require S3, Tavily doesn’t require multimodal, etc.

Multimodal (image + audio)

VariableDefaultNotes
MULTIMODAL_ENABLEDfalseRegisters image/audio loaders with the registry on worker startup.
MULTIMODAL_PROVIDERlitellmlitellm (OpenAI vision + Whisper) / local (CLIP + openai-whisper, requires z3rno-core[multimodal-local]) / stub.
MULTIMODAL_VISION_MODELopenai/gpt-4o-mini
MULTIMODAL_AUDIO_MODELwhisper-1
MULTIMODAL_API_KEY""Falls back to OPENAI_API_KEY.
MULTIMODAL_MAX_AUDIO_BYTES26214400 (25 MB)OpenAI Whisper cap.
MULTIMODAL_MAX_IMAGE_BYTES20971520 (20 MB)

S3 storage backend (STORAGE_BACKEND=s3)

VariableDefaultNotes
S3_BUCKET""Required when STORAGE_BACKEND=s3.
S3_REGIONus-east-1
S3_ENDPOINT_URL""Empty for AWS; set for MinIO / Cloudflare R2 / DigitalOcean Spaces.
S3_PREFIXz3rnoBucket-key prefix sandbox.
S3_ACCESS_KEY_ID""Empty → default AWS credential chain (IRSA / IAM role).
S3_SECRET_ACCESS_KEY""

Tavily web search (registers /v1/ingest/search)

VariableDefaultNotes
TAVILY_API_KEY""Set to register the search route.
TAVILY_SEARCH_DEPTHbasicbasic / advanced.
TAVILY_MAX_RESULTS5

URL loader Playwright fallback

VariableDefaultNotes
URL_PLAYWRIGHT_ENABLEDfalseRequires pip install 'z3rno-core[playwright]'.
URL_PLAYWRIGHT_MIN_CHARS200Below this, fall back to Playwright.
URL_PLAYWRIGHT_TIMEOUT_SECONDS30.0

Phase C — Retrieval

VariableDefaultNotes
ALLOW_CYPHER_QUERYfalseGates strategy="CYPHER" on recall. Off by default — the strategy exists but is hidden behind 403 until an operator opts in.

Phase D — Refine / Ontology / Codegraph (REFINE_ENABLED)

/v1/feedback, /v1/refine, and the z3rno.refine_run worker register only when REFINE_ENABLED=true.

Refine

VariableDefaultNotes
REFINE_ENABLEDfalseMaster gate.
REFINE_SCHEDULEcron:0 */6 * * *Per-cron-tab format; consumed by the legacy schedule wiring. Multi-tenant scheduler uses REFINE_BEAT_INTERVAL_SECONDS below.
FEEDBACK_WEIGHT_DECAY0.95EMA blend factor per refine cycle.
REFINE_MAX_PER_TICK10v0.19.4. Tenants picked per scheduler tick.
REFINE_BEAT_INTERVAL_SECONDS0v0.19.4. Set > 0 to enable multi-tenant beat scheduler. 0 keeps the scheduler dormant (on-demand only).
REFINE_INFER_ENABLEDfalseLLM stage: propose edges for under-connected Memos.
REFINE_SUMMARIZE_ENABLEDfalseLLM stage: per-cluster SUMMARY Memos.
REFINE_INFER_MAX_CANDIDATES50Per-cycle LLM call cap.

Ontology grounding (Forge integration)

VariableDefaultNotes
ONTOLOGY_RESOLVERnonenone or rdflib. Set rdflib to resolve distilled entities to OWL URIs.
ONTOLOGY_FILE_PATH""Required when ONTOLOGY_RESOLVER=rdflib. Path to OWL/TTL/RDF file.
ONTOLOGY_MATCHING_STRATEGYfuzzyexact or fuzzy.
ONTOLOGY_FUZZY_THRESHOLD0.80Minimum score for fuzzy match (0-1).

Codegraph (Ingest integration)

VariableDefaultNotes
CODEGRAPH_ENABLEDfalseWhen true, ingest of code sources also runs the tree-sitter extractor. Requires pip install 'z3rno-core[codegraph]'.
CODEGRAPH_LANGUAGESpython,typescriptAllow-list. v0.19.5 added go and rust.

Phase F — Differentiation

Memory-tier routing

VariableDefaultNotes
MEMORY_TIER_AUTO_ROUTEfalseWhen true, the AUTO strategy asks the MemoryTierRouter for tiers and fans out across them. Per-request tier_route in the recall body always wins.

Compliance-graded retrieval (PII redaction)

VariableDefaultNotes
RETRIEVAL_REDACTION_ENABLEDfalseRole-aware regex scrubbing on recall results.
RETRIEVAL_REDACTION_RULES_PATH""YAML rules file. Empty → built-in defaults (email / SSN / credit card / US phone).

Forget-with-proof

VariableDefaultNotes
FORGET_PROOF_ENABLEDfalseWhen true, every forget() emits a Merkle-rooted, ed25519-signed certificate; GET /v1/forget/{cert_id} is registered.
FORGET_PROOF_SIGNING_KEY_PATH""PEM-encoded unencrypted Ed25519 private key.
FORGET_PROOF_SIGNER_KEY_IDdefaultRotation-friendly label stamped on each cert.

Distributed worker backends

VariableDefaultNotes
DISTRIBUTED_BACKENDcelerycelery / modal / k8s_jobs. Off-default backends lazy-import — missing SDK raises JobBackendError, not a crash.
MODAL_APP_NAMEz3rno
K8S_JOBS_NAMESPACEz3rno
K8S_JOBS_IMAGE""Image used when DISTRIBUTED_BACKEND=k8s_jobs.

Phase G — Agent-native

Usage telemetry + budgets

Zero = no cap (default). Non-zero values trip BudgetExceededError on Forge / refine pre-flight; the job is rejected before any LLM/embedding work.
VariableDefault
USAGE_BUDGET_DAILY_TOKENS0
USAGE_BUDGET_DAILY_LLM_CALLS0
USAGE_BUDGET_DAILY_EMBEDDINGS0
USAGE_BUDGET_MONTHLY_TOKENS0
USAGE_BUDGET_MONTHLY_LLM_CALLS0
USAGE_BUDGET_MONTHLY_EMBEDDINGS0
Per-tenant overrides land via PUT /v1/tenants/me/budgets (v0.20.3). See Components → z3rno-server for the endpoint.

Cross-tenant admin (v0.22.1, managed-hosting)

VariableDefaultNotes
SUPERADMIN_ENABLEDfalseGates /v1/tenants/{org_id}/budgets. Both this and SUPERADMIN_API_KEY must be set for the routes to register.
SUPERADMIN_API_KEY""Deploy-time secret. The bearer presented on a request is matched against this directly — there is no DB lookup. Treat like a root password; rotate by config push.
The cross-tenant surface is off by default and stays invisible (not in the OpenAPI spec) until both vars are set. See the Managed-hosting guide for the ops playbook.

Recall counter batching (v0.22.0)

VariableDefaultNotes
RECALL_COUNT_BATCH_ENABLEDfalseCoalesce recall_count bumps into one UPDATE per org per window. Per-process.
RECALL_COUNT_BATCH_WINDOW_MS50Flush cadence. Smaller = fresher counters + more writes; larger = staler counters + better coalescing.
Off by default; flip on once your deployment’s benchmark numbers ratify the win. The single-process laptop bench delta is +2-4% ops/sec at high concurrency with a -19 to -25% p99 reduction at 20-30 concurrent recalls.

OpenTelemetry tracing

VariableDefaultNotes
OTEL_ENABLEDfalseWhen true, instruments FastAPI; W3C traceparent propagates outbound.
OTEL_SERVICE_NAMEz3rno-server
OTEL_ENVIRONMENTproductionStamped as deployment.environment on every span.
OTEL_EXPORTER_OTLP_ENDPOINT""OTLP/gRPC endpoint.

v0.20 — Operator polish

NOTIFY/LISTEN audit drain (v0.20.2)

VariableDefaultNotes
Z3RNO_AUDIT_LISTEN_ENABLEDfalseGate read by the z3rno-audit-listener console-script (the singleton pod deployed by the chart’s auditListener.enabled block). When true, the listener opens LISTEN z3rno_audit_pending and fires z3rno.audit_drain on every notification (~50 ms wake instead of waiting for beat).

Audit-drain tunables (read by the engine; surface them through chart beat.audit.*)

VariableDefaultNotes
AUDIT_DRAIN_BATCH_SIZE500Rows per drain transaction.
AUDIT_DRAIN_INTERVAL_SECONDS1.0Beat tick interval. Recommended 60.0 when listener is enabled (poll becomes fallback).
AUDIT_DRAIN_MAX_ORGS_PER_TICK100Bounds per-tick fan-out.

Reference