Configuration
The workspace/anvio.yaml schema and the environment variables that configure a local Anvio workspace.
5 min read
Anvio is local-first and file-first: the source of truth for configuration is workspace/anvio.yaml, validated by a Zod schema in packages/core/src/schemas/workspace.schema.ts. Environment variables layer on top for secrets and per-deployment overrides — they are never required for Level 1 (default) operation.
workspace/anvio.yaml
The default workspace file, unmodified:
# Anvio Workspace Configuration
# Local-first, file-first — no database or authentication required.
apiVersion: anvio.io/v1
kind: Workspace
metadata:
name: default
version: "1.0.0"
spec:
auth:
enabled: false
storage:
provider: filesystem
basePath: .
memory:
provider: filesystem
basePath: memory
events:
provider: local
defaultAgent: architect
defaultSoul: architect-soul
defaultUserId: local-userSchema reference (workspaceSpecSchema)
| Field | Type / enum | Default | Notes |
|---|---|---|---|
spec.auth.enabled | boolean | false | Optional auth plugin. Stays off unless external MCP providers (GitHub, Google, Slack) require it. |
spec.auth.provider | none | oauth2 | jwt | none | |
spec.storage.provider | filesystem | sqlite | postgresql | s3 | filesystem | sqlite writes to workspace/state.db (with FTS5 message search since v1.20.0). |
spec.storage.basePath | string | . | Relative to workspace root. |
spec.memory.provider | filesystem | sqlite | postgresql | qdrant | redis | honcho | filesystem | |
spec.memory.basePath | string | memory | |
spec.memory.fts | boolean | false | Full-text search over memory. |
spec.events.provider | local | nats | local | In-process bus by default; NATS for multi-process/Level 3 deployments. |
spec.runtime.default | local | cursor | claude-code | codex | antigravity | local | Default runtime provider when an agent doesn't specify one. |
spec.execution.defaultTimeoutMs | number | 30000 | Hard kill timeout for sandboxed code execution. |
spec.execution.networkEnabled | boolean | false | Network access for sandboxed code, off by default. |
spec.credentials.encryption | disabled | enabled | disabled | Encrypted credential pools for local runtime API keys. |
spec.acp.enabled | boolean | false | Agent Client Protocol server (editor integration). |
spec.acp.port | number | 8765 | |
spec.acp.host | string | 127.0.0.1 | |
spec.channels.* | per-channel object | — | See Channels overview for the full adapter list. |
spec.worktrees.enabled | boolean | false | Git worktree isolation for coding agents. |
spec.worktrees.repoPath | string | .. | Git repo root, relative to the workspace directory. |
spec.defaultAgent | string | — | Agent used when a channel message doesn't map to a session yet. |
spec.defaultSoul | string | — | Default Soul (identity/persona) profile. |
spec.defaultUserId | string | local-user | Default user identity for single-tenant local use. |
Load and validate a workspace file with parseWorkspaceDefinition():
import { parseWorkspaceDefinition } from '@anvio/core';
import { parse as parseYaml } from 'yaml';
const config = parseWorkspaceDefinition(parseYaml(rawYamlString));Invalid configuration throws a Zod validation error immediately — there is no silent fallback to defaults for a malformed file structure (individual missing fields do fall back to their schema defaults).
Environment variables
From .env.example, grouped by purpose.
Workspace and Level 1 basics
| Variable | Purpose |
|---|---|
ANVIO_WORKSPACE | Workspace path. Default ./workspace. |
ANTHROPIC_API_KEY | Optional — direct Anthropic API key for the local runtime / model provider. Not needed for mock mode. |
Runtime provider OAuth (vendor-native, not API billing)
| Variable | Purpose |
|---|---|
CLAUDE_CODE_OAUTH_TOKEN | Claude Code runtime OAuth token (Pro/Max subscription). Set via anvio setup-token --claude. |
ANTIGRAVITY_TOKEN | Antigravity CLI runtime OAuth (Google Sign-In), for CI/headless use. |
CODEX_ACCESS_TOKEN | Codex CLI runtime OAuth (ChatGPT subscription). |
See Vendor CLI runtimes for the full auth model.
Model provider API keys
| Variable | Provider |
|---|---|
OPENAI_API_KEY | OpenAI |
GEMINI_API_KEY / GOOGLE_API_KEY | Gemini |
OPENROUTER_API_KEY (+ OPENROUTER_REFERER, OPENROUTER_APP_NAME) | OpenRouter |
DEEPSEEK_API_KEY | DeepSeek |
GROQ_API_KEY | Groq |
MISTRAL_API_KEY | Mistral |
TOGETHER_API_KEY | Together |
XAI_API_KEY | xAI |
FIREWORKS_API_KEY | Fireworks |
MOONSHOT_API_KEY | Moonshot |
CEREBRAS_API_KEY | Cerebras |
SAMBANOVA_API_KEY | SambaNova |
PERPLEXITY_API_KEY | Perplexity |
COHERE_API_KEY | Cohere |
HF_TOKEN | Hugging Face |
OLLAMA_BASE_URL (+ OLLAMA_ENABLED) | Ollama (local inference, optional API key) |
CUSTOM_API_KEY | Custom OpenAI-compatible endpoint (provider: custom in agent YAML) |
Full provider catalog and routing behavior: Model Router.
Credential pools and MCP
| Variable | Purpose |
|---|---|
ANVIO_CREDENTIALS_PASSPHRASE | Encrypts stored API keys added via anvio credentials add. Change from the default in production. |
GITHUB_TOKEN | Example MCP integration credential — enable servers in workspace/mcp/servers.yaml. |
Level 2+ (API, Gateway, auth)
| Variable | Purpose |
|---|---|
API_PORT | apps/api HTTP port. Default 3000. |
GATEWAY_PORT | apps/gateway port. |
API_URL | Base URL the gateway/worker use to reach the API. |
ACP_PORT | ACP editor integration port (only if spec.acp.enabled: true). |
JWT_SECRET | Only used when workspace/anvio.yaml has auth.enabled: true. |
Level 3 (Postgres, Redis, NATS)
| Variable | Purpose |
|---|---|
DATABASE_URL | PostgreSQL connection string (postgresql://anvio:anvio@localhost:5432/anvio). |
REDIS_URL | Redis connection string. |
NATS_URL | Only read when spec.events.provider: nats. |
Observability
| Variable | Purpose |
|---|---|
OTEL_EXPORTER_OTLP_ENDPOINT | OTLP trace collector endpoint. Setting this also implicitly enables tracing. |
ANVIO_OTEL_ENABLED | Explicit override to force-enable/disable OTel. |
Progressive enhancement levels
Anvio's configuration is designed so each level only adds what it needs — nothing in Level 1 requires a database, auth, or Docker:
| Level | What's required |
|---|---|
| 1 — Local CLI | Nothing beyond ANVIO_WORKSPACE (defaults to ./workspace). No auth, filesystem storage/memory, in-process events. |
| 2 — API + Gateway | API_PORT, GATEWAY_PORT, optionally JWT_SECRET if auth is turned on. |
| 3 — Multi-process / scaled | DATABASE_URL (PostgreSQL), REDIS_URL, NATS_URL, spec.storage.provider: postgresql, spec.events.provider: nats. |
| 4 — Full observability | OTEL_EXPORTER_OTLP_ENDPOINT, Langfuse dashboard import. |
Mock/dev-mode environment flags exist throughout the codebase for testing without real infrastructure or credentials — for example ANVIO_DOCKER_MOCK=1, ANVIO_SSH_MOCK=1, ANVIO_DAYTONA_MOCK=1, ANVIO_MODAL_MOCK=1, ANVIO_SINGULARITY_MOCK=1, ANVIO_NOUS_MOCK=1, ANVIO_MCP_STUB=1. These are covered on the relevant runtime/tool pages, not centrally documented as one flag family.
Last updated on