AAnvio
Backend

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-user

Schema reference (workspaceSpecSchema)

FieldType / enumDefaultNotes
spec.auth.enabledbooleanfalseOptional auth plugin. Stays off unless external MCP providers (GitHub, Google, Slack) require it.
spec.auth.providernone | oauth2 | jwtnone
spec.storage.providerfilesystem | sqlite | postgresql | s3filesystemsqlite writes to workspace/state.db (with FTS5 message search since v1.20.0).
spec.storage.basePathstring.Relative to workspace root.
spec.memory.providerfilesystem | sqlite | postgresql | qdrant | redis | honchofilesystem
spec.memory.basePathstringmemory
spec.memory.ftsbooleanfalseFull-text search over memory.
spec.events.providerlocal | natslocalIn-process bus by default; NATS for multi-process/Level 3 deployments.
spec.runtime.defaultlocal | cursor | claude-code | codex | antigravitylocalDefault runtime provider when an agent doesn't specify one.
spec.execution.defaultTimeoutMsnumber30000Hard kill timeout for sandboxed code execution.
spec.execution.networkEnabledbooleanfalseNetwork access for sandboxed code, off by default.
spec.credentials.encryptiondisabled | enableddisabledEncrypted credential pools for local runtime API keys.
spec.acp.enabledbooleanfalseAgent Client Protocol server (editor integration).
spec.acp.portnumber8765
spec.acp.hoststring127.0.0.1
spec.channels.*per-channel object—See Channels overview for the full adapter list.
spec.worktrees.enabledbooleanfalseGit worktree isolation for coding agents.
spec.worktrees.repoPathstring..Git repo root, relative to the workspace directory.
spec.defaultAgentstring—Agent used when a channel message doesn't map to a session yet.
spec.defaultSoulstring—Default Soul (identity/persona) profile.
spec.defaultUserIdstringlocal-userDefault 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

VariablePurpose
ANVIO_WORKSPACEWorkspace path. Default ./workspace.
ANTHROPIC_API_KEYOptional — direct Anthropic API key for the local runtime / model provider. Not needed for mock mode.

Runtime provider OAuth (vendor-native, not API billing)

VariablePurpose
CLAUDE_CODE_OAUTH_TOKENClaude Code runtime OAuth token (Pro/Max subscription). Set via anvio setup-token --claude.
ANTIGRAVITY_TOKENAntigravity CLI runtime OAuth (Google Sign-In), for CI/headless use.
CODEX_ACCESS_TOKENCodex CLI runtime OAuth (ChatGPT subscription).

See Vendor CLI runtimes for the full auth model.

Model provider API keys

VariableProvider
OPENAI_API_KEYOpenAI
GEMINI_API_KEY / GOOGLE_API_KEYGemini
OPENROUTER_API_KEY (+ OPENROUTER_REFERER, OPENROUTER_APP_NAME)OpenRouter
DEEPSEEK_API_KEYDeepSeek
GROQ_API_KEYGroq
MISTRAL_API_KEYMistral
TOGETHER_API_KEYTogether
XAI_API_KEYxAI
FIREWORKS_API_KEYFireworks
MOONSHOT_API_KEYMoonshot
CEREBRAS_API_KEYCerebras
SAMBANOVA_API_KEYSambaNova
PERPLEXITY_API_KEYPerplexity
COHERE_API_KEYCohere
HF_TOKENHugging Face
OLLAMA_BASE_URL (+ OLLAMA_ENABLED)Ollama (local inference, optional API key)
CUSTOM_API_KEYCustom OpenAI-compatible endpoint (provider: custom in agent YAML)

Full provider catalog and routing behavior: Model Router.

Credential pools and MCP

VariablePurpose
ANVIO_CREDENTIALS_PASSPHRASEEncrypts stored API keys added via anvio credentials add. Change from the default in production.
GITHUB_TOKENExample MCP integration credential — enable servers in workspace/mcp/servers.yaml.

Level 2+ (API, Gateway, auth)

VariablePurpose
API_PORTapps/api HTTP port. Default 3000.
GATEWAY_PORTapps/gateway port.
API_URLBase URL the gateway/worker use to reach the API.
ACP_PORTACP editor integration port (only if spec.acp.enabled: true).
JWT_SECRETOnly used when workspace/anvio.yaml has auth.enabled: true.

Level 3 (Postgres, Redis, NATS)

VariablePurpose
DATABASE_URLPostgreSQL connection string (postgresql://anvio:anvio@localhost:5432/anvio).
REDIS_URLRedis connection string.
NATS_URLOnly read when spec.events.provider: nats.

Observability

VariablePurpose
OTEL_EXPORTER_OTLP_ENDPOINTOTLP trace collector endpoint. Setting this also implicitly enables tracing.
ANVIO_OTEL_ENABLEDExplicit 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:

LevelWhat's required
1 — Local CLINothing beyond ANVIO_WORKSPACE (defaults to ./workspace). No auth, filesystem storage/memory, in-process events.
2 — API + GatewayAPI_PORT, GATEWAY_PORT, optionally JWT_SECRET if auth is turned on.
3 — Multi-process / scaledDATABASE_URL (PostgreSQL), REDIS_URL, NATS_URL, spec.storage.provider: postgresql, spec.events.provider: nats.
4 — Full observabilityOTEL_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.

Edit on GitHub

Last updated on

On this page