Configuration¶
Kaval.AI is configured with environment variables. Library code never reads them
on its own — only the processes do (python -m kavalai.server,
python -m kavalai.migrate_db, kavalai-eval, the backoffice), and the
client constructors fall back to their provider’s key variable. Anything you
build yourself can pass the same values explicitly: the engine takes
default_llm_model and default_llm_parameters, and a normalizer is
installed with set_default_normalizer().
.env.example in the repository lists every variable, and
tests/test_config_drift.py checks it against the code in both directions.
In development, keep them in a .env file and load it with
python-dotenv:
import dotenv
dotenv.load_dotenv()
Provider credentials¶
Variable |
Description |
|---|---|
|
Used by |
|
Used by |
|
Used by |
|
Ollama endpoint. Default |
|
Read by the OpenAI SDK, not by Kaval.AI: points |
|
Read by the |
Each client also accepts api_key= (or host=) directly, which wins over
the environment. Model providers lists every provider these credentials belong
to, and how to find out which models each one offers.
Models¶
Read by python -m kavalai.server and, for the judge, by kavalai-eval.
Variable |
Description |
|---|---|
|
Model used when a workflow and its nodes both omit |
|
Fleet-wide defaults for every model call, passed to the engine as
|
|
Most tokens a model call may generate, reasoning tokens included. A
call that reaches it raises
|
|
Seconds before a model call is abandoned. Default |
|
Inactivity timeout between streamed chunks. Defaults to twice the plain timeout. |
|
Path to a YAML file describing a custom embedding
|
|
Thread count for local |
|
Where |
|
Comma-separated modules the agent server imports before loading the
workflow, so any backends they register with
|
Agent database¶
Read by python -m kavalai.server and python -m kavalai.migrate_db agents.
Variable |
Description |
|---|---|
|
Connection string for the agent database, e.g.
|
|
Schema holding the runtime tables. Default |
|
Embedding model of the |
|
Where that index lives, as a database URI ( |
|
Schema holding the RAG tables. Optional; the backend’s default otherwise. |
|
SQLAlchemy pool size. Default |
|
Pool overflow. Default |
|
Log every SQL statement. Default |
Agent server¶
Variable |
Description |
|---|---|
|
Path to the workflow YAML to serve. Required. |
|
Optional module imported before the workflow is loaded — a dotted name
or a |
|
Bind address. Default |
|
Port. Default |
|
Serve |
|
Seconds after which a run is cancelled and recorded as failed, passed
to the engine as |
|
Basic-auth username. Auth is disabled only when both this and the password are unset; setting either one enables it. |
|
Basic-auth password. |
See Serving a workflow over HTTP.
Backoffice¶
Variable |
Description |
|---|---|
|
Connection string for the backoffice’s own database — separate from any agent database. |
|
Schema for the backoffice tables. |
|
Interface |
|
Port for the backoffice server. Default |
|
Google OAuth client id for sign-in. Required. |
|
Google OAuth client secret. Required. |
|
Signing key for session cookies. Required, with no development fallback: a cookie signed with a well-known key is a backoffice that looks as if it works until it is exposed. |
|
Where a completed sign-in is redirected to. Required. |
The backoffice refuses to start when any of the four is unset, with a message naming the missing variable.
Tools¶
Variable |
Description |
|---|---|
|
Tor proxy used by |
See Bundled tools.
A worked example¶
A .env for local development against Docker Compose:
# Provider
OPENAI_API_KEY=sk-...
KAVALAI_DEFAULT_LLM_MODEL=openai/gpt-5.6-luna
# Agent database (runtime tables)
KAVALAI_DB_URI=postgresql://kavalai:kavalai@localhost:5432/kavalai
KAVALAI_DB_SCHEMA=agents
# Agent server
KAVALAI_AGENT_WORKFLOW_PATH=examples/support_agent/support_agent.yaml
KAVALAI_AGENT_PORT=10000
# Backoffice (its own database)
KAVALAI_BO_DB_URI=postgresql://kavalai:kavalai@localhost:5432/kavalai
KAVALAI_BO_DB_SCHEMA=backoffice
KAVALAI_BO_GOOGLE_CLIENT_ID=...
KAVALAI_BO_GOOGLE_CLIENT_SECRET=...
KAVALAI_BO_SESSION_SECRET_KEY=change-me
KAVALAI_BO_FRONTEND_URL=http://localhost:4200
Warning
A .env holds credentials. Keep it out of source control, and prefer your
platform’s secret store in production. The workflow YAML supports
url_env / command_env / username_env / password_env for
exactly this reason — see Workflow YAML reference.