System Architecture
This document provides a high-level view of the AgentZero runtime architecture.
Design Principles
Section titled “Design Principles”- Traits define boundaries. Core crate has zero infrastructure dependencies.
- Fail closed. Security defaults deny everything; capabilities require explicit opt-in.
- Single binary. One
cargo installgives you CLI, gateway, daemon, and all tools. - Crate isolation. Each subsystem lives in its own crate with minimal dependencies.
Crate Diagram
Section titled “Crate Diagram”Workspace Crates (16)
Section titled “Workspace Crates (16)”The workspace was consolidated from 46 to 16 crates. Each remaining crate corresponds to a real deployment or consumption boundary.
| Crate | Purpose |
|---|---|
bin/agentzero | Thin binary entrypoint |
agentzero-cli | Command parsing, dispatch, UX (absorbed 18 modules: daemon, doctor, health, hooks, service, etc.) |
agentzero-core | Agent traits, orchestrator, domain types, security, delegation, routing |
agentzero-config | Typed config model and policy validation |
agentzero-providers | OpenAI-compatible provider implementation (Anthropic, OpenAI, OpenRouter, Ollama, etc.) |
agentzero-auth | Credential management (OAuth, API keys, profiles) |
agentzero-storage | Encrypted KV store + conversation memory (SQLite, Turso, SQLCipher) |
agentzero-tools | 50+ built-in tool implementations (includes autonomy, hardware, cron, skills) |
agentzero-infra | Agent orchestration, audit, runtime execution, tool wiring |
agentzero-channels | Platform integrations (Telegram, Discord, Slack) + leak guard |
agentzero-plugins | WASM plugin host runtime (wasmi default, wasmtime optional) |
agentzero-plugin-sdk | Plugin SDK (ABI v2, WASI) |
agentzero-gateway | HTTP/WebSocket server (Axum) with SSE streaming |
agentzero-ffi | FFI bindings (Swift/Kotlin/Python via UniFFI, Node via napi-rs) |
agentzero-testkit | Test doubles and mocks (dev-only) |
agentzero-bench | Criterion benchmark suite (dev-only) |
Command Execution Flow
Section titled “Command Execution Flow”See Also
Section titled “See Also”- Security Boundaries — Layered defense-in-depth model
- Trait System — Detailed trait interfaces and crate boundaries
- Config Reference — Full annotated
agentzero.toml - Threat Model — Security threat analysis