Local .env
Create a .env file at the project root:
DATABASE_URL pointed at the Compose service
hostname postgres. For host-run scripts, override it with
postgresql://postgres:postgres@localhost:5432/agentflow.
Deployment Matrix
| Variable | Required for | Notes |
|---|---|---|
DATABASE_URL | Readiness, migrations, all tenant-backed routes | Leave unset only with AGENTFLOW_ALLOW_NO_DATABASE=true for health/docs-only mode. |
AGENTFLOW_ALLOW_NO_DATABASE | Health/docs-only local boot | Set true only when intentionally running without PostgreSQL. |
OPENAI_API_KEY | Platform-managed OpenAI calls | Not needed for a tenant that exclusively uses BYO provider keys. |
Provider keys such as ANTHROPIC_API_KEY or GOOGLE_API_KEY | Platform-managed non-OpenAI calls | Use only for provider keys the deployment owns globally. |
ENCRYPTION_KEY | Tenant BYO LLM keys | Required before saving encrypted provider keys through /api/v1/llm/config. |
REDIS_URL | Shared caches, rate limits, question wakeups, workers | Recommended for any multi-replica deployment. |
TENANT | Single-tenant local or production jobs | Default tenant key for scripts and prewarm. |
TENANT_NAMES | Multi-tenant workers and migration jobs | Comma or whitespace separated tenant database names. |
PREWARM_TENANTS | Low-latency startup | Comma or whitespace separated tenants to bootstrap at API startup. |
DEV_AUTH_BYPASS | Local development only | Must be false or unset outside local development. |
DEV_TENANT_NAME, DEV_USER_ID | Local development only | Tenant/user identity used when DEV_AUTH_BYPASS=true. |
AUTH0_DOMAIN, AUTH0_AUDIENCE, AUTH0_ISSUER | Production human auth | Verifies user bearer tokens. |
AUTH0_M2M_AUDIENCE, AUTH0_M2M_ISSUER, AUTH0_M2M_REQUIRED_SCOPE | Production machine auth | Verifies service-to-service bearer tokens and required scope. |
CORS_ALLOWED_ORIGINS | Browser clients | Comma separated allowed web origins. |
LOG_LEVEL | All environments | DEBUG, INFO, WARNING, or ERROR. |
DD_TRACE_ENABLED, DD_LLMOBS_ENABLED, DD_LLMOBS_ML_APP | Datadog observability | Keep DD_LLMOBS_ML_APP lowercase. |
/api/v1/llm/config;
they are encrypted with ENCRYPTION_KEY and are not stored in .env.
Auth Modes
Local development can bypass Auth0:Usage & Budget Controls
AgentFlow tracks LLM usage through the LiteLLM gateway and enforces monthly spend caps before outbound model calls.LLM Defaults
These defaults are used when no explicitllm_config is provided:
| Purpose | Default Behavior |
|---|---|
| Agent | Primary model, higher temperature for natural responses |
| Tool | Smaller model, zero temperature for deterministic output |
| Planning | Smaller model, moderate temperature |
| Reflection | Smaller model, zero temperature |
llm_config parameter in the @agent decorator or the management API.
Multi-Provider LLM Support
AgentFlow supports multiple LLM providers. Prefix models with the provider name:BYO LLM Tenant Keys
Tenant admins can bring their own provider keys without exposing platform defaults. Save one provider configuration per key:mode is byo, every tenant LLM use case must resolve to an allowed tenant model. This includes agent chat, raw LLM chat, tool calls, sub-agents, title generation, KB enrichment, follow-up questions, autocomplete, query processing, planning, reflection, summaries, embeddings, reranking, and vision. Disallowed explicit model requests return 403.
Use GET /api/v1/llm/config/model-options to discover the current model ids and use-case keys before saving the policy.
