Components
A tour of Anvio's apps and core packages — what each one is responsible for and how they depend on each other.
6 min read
Purpose
This page is the component-level reference: for each app and the packages that matter most operationally, what it does, and what talks to what. Read High-Level Architecture first for the overall shape and the apps → platform → packages → core dependency rule this page assumes.
Apps
| App | Role |
|---|---|
apps/cli | Primary interface. Ships the anvio binary (bin: { anvio: "./dist/main.js" }). Every command (chat, run, sessions, soul, goal, mcp, setup-token, etc.) is a thin wrapper that calls into @anvio/platform. |
apps/api | Optional REST layer, built on NestJS. Not required for Level 1 usage — exists for programmatic/multi-user access once you opt in. |
apps/worker | Background job consumer. Executes detached runs (anvio run <agent> --detach) independently of the client connection. |
apps/gateway | WebSocket gateway. Also hosts the unified gateway (anvio gateway start) — a single daemon that replaces separate worker + API + WebSocket processes, serving channels, the agent worker, the REST API, and WebSocket on one port (default 3001). |
apps/desktop | Desktop shell scaffold — an early-stage app, not the primary supported interface. |
Core packages
@anvio/core
Shared schemas and ports. Every other package depends on this, and it depends on nothing else in the monorepo — it's the bottom of the dependency graph.
@anvio/platform
The composition factory. Reads workspace/anvio.yaml and wires together storage, memory, events, the agent runtime, tool gateway, model router, harness, and automation according to what's enabled. This is the one place that "knows" the full shape of a running Anvio instance — apps call into it rather than assembling their own dependency graphs.
@anvio/workspace
Workspace loader and session store. Responsible for anvio init, anvio workspace validate, and resolving ANVIO_WORKSPACE to actual files on disk (agents, personas, skills, souls, tools, providers, mcp, hooks, credentials, connections, sessions).
@anvio/agents
The agent runtime engine and orchestration. Implements the state machine described in Data Flow, context assembly, tool execution coordination, delegation via the SupervisorOrchestrator, and session restoration via thread mapping. Runtime code never imports channel-specific code — all outbound communication flows through events to the Channel Hub.
@anvio/tools
The built-in tool gateway — 73 tools spanning filesystem, web, browser/CDP, terminal, kanban, delegation, Home Assistant, vision, and skills management. Configured via workspace/tools/gateway.yaml. Agents invoke tools through fenced anvio_tool blocks (up to 5 model round-trips per turn) or native tool_use for Anthropic, OpenAI, and Gemini providers.
@anvio/models
Model providers and routing. Ships 18 built-in providers (Anthropic, OpenAI, Gemini, DeepSeek, Groq, OpenRouter, Mistral, Together, xAI, Fireworks, Moonshot, Cerebras, SambaNova, Perplexity, Cohere, Hugging Face, Ollama, plus a custom OpenAI-compatible endpoint) with fallback routing defined in workspace/providers/routing.yaml.
@anvio/runtimes
Runtime providers — the execution backends an agent can bind to: local (built-in tool loop, default), claude-code, cursor, codex, antigravity (all OAuth-based vendor runtimes via RuntimeRoutingAgentRuntime), plus remote execution backends: ssh, daytona, modal, singularity. See Runtimes & Models overview.
@anvio/memory
Pluggable memory providers behind a single MemoryProvider port — filesystem (default), SQLite, PostgreSQL, Qdrant, and Honcho. FTS5 full-text search over session messages is available once SQLite storage is enabled.
@anvio/events
The event bus — LocalEventBus in-process by default, with NATS JetStream as an optional Level 3 provider. See Event Flow.
@anvio/harness
Channel harness: formatting, engagement policy, and OAuth connection management for channel/tool integrations (Slack, GitHub, etc.) via the connection broker — distinct from runtime OAuth. ChannelHub sits in front of this.
@anvio/channels
Multi-platform channel adapters: CLI, Telegram, Discord, Slack, WhatsApp, Mattermost, Microsoft Teams, Matrix, Email, Signal, Google Chat, Feishu, SMS (Twilio), and Web Chat — 14 adapters total, all normalized to the same inbound/outbound event shape by the Channel Hub.
@anvio/learning
The learning loop: memory nudges, LLM-generated session summaries, and skill drafts derived from tool-use patterns. Gated by each soul's evolution.allowAutoUpdate policy (see @anvio/soul-gate). Falls back to rule-based summaries without a model API key.
@anvio/acp
Editor integration — implements the Agent Client Protocol so Cursor (and other ACP-speaking editors) can drive Anvio agents directly (anvio acp serve).
Advanced Agent OS packages
souls, soul-gate, goals, automation, blueprints, kanban, batch, execution, hooks, credentials, skills, personas, integrations — together these implement souls (long-lived agent identity + gated self-evolution), persistent goals, cron/event automation, workflow blueprints, kanban boards and worker lanes, batch job processing, a code execution sandbox, event hooks, encrypted credential pools, the skills catalog, persona templates, and the MCP-first integration registry.
@anvio/db
Drizzle ORM schema for the Level 3 PostgreSQL backend (users, agents, personas, skills, agent_skills, sessions, session_messages, memory_entries, tool_executions). Retained for Level 3 but not required at Level 1 or 2.
How components relate
Best practices
- When adding a new capability, ask which package it belongs in before writing code — most features map cleanly onto an existing package (tool →
tools, channel →channels, memory backend →memory). - Keep app-layer code (
apps/*) as thin adapters. If you find yourself writing business logic in a CLI command handler or a NestJS controller, that logic likely belongs in@anvio/platformor a package it composes. - Respect the dependency rule directionality — packages should not import from
apps/, andcoreshould not import from anything else in the repo.
Common mistakes
- Confusing
@anvio/harnesswith@anvio/channels. Channels are the adapters (Telegram, Slack, etc.); harness is the cross-cutting formatting/engagement/OAuth layer that channels sit behind. - Assuming
apps/workerandapps/gatewayare both required. The unified gateway (anvio gateway start) replaces the need to run worker, API, and gateway as separate processes — running them split is a legacy/development-only pattern. - Treating
@anvio/dbas required. It backs the Level 3 PostgreSQL option only; Level 1 and 2 don't touch it.
References
Last updated on