Deployment Guide¶
Anvil Agent ships a stdlib-only Python 3.11+ backend (server/) and hardened Docker Compose stack (deploy/) so anyone can deploy the complete voice agent gateway, MCP glasses bridge, and real-time STT/LLM router end to end.
Architecture¶
MemoMind One Glasses / Phone UI MCP Agents (Hermes, Pi, Claude Code, Codex)
│ HTTPS or loopback HTTP │ POST /mcp (Streamable HTTP)
▼ ▼
Anvil Agent Gateway (:8792) ── Stateless turns, /v1/memos/preview, event ring
│ │
STT audio │ │ Agent turns
▼ ▼
Real-Time Router (:8000) Agent Backends (openai-chat, hermes-api, pi-web)
├── /v1/audio/transcriptions ──► STT Engine (Parakeet, Whisper, Speaches)
└── /v1/chat/completions ──► LLM Engine (Ollama, vLLM, llama.cpp, OpenAI)
If you already operate an Anvil Serving gateway, you can skip the bundled realtime-router container and point agent.router_url directly at your Anvil Serving router (http://127.0.0.1:8000).
Option A: Docker Compose (Recommended)¶
- Copy router.example.toml, agent.example.toml, and env.example into
~/.config/anvil-agent/(chmod 700on the directory,chmod 600onruntime.env). - Update
router.tomlwith your STT and LLM upstream URLs, and optionally uncomment thehermes-apiorpi-websections inagent.toml. - Launch the stack:
By default,
AGENT_ROUTER_CONFIG=~/.config/anvil-agent/router.toml \ AGENT_CONFIG=~/.config/anvil-agent/agent.toml \ docker compose -f deploy/docker-compose.yml --env-file ~/.config/anvil-agent/runtime.env up --build -danvil-agentbinds127.0.0.1:8792on the host,realtime-routerstays private on the Compose bridge network, and both containers includehost.docker.internal:host-gatewayso host-local STT/LLM/Hermes/Pi services work on both Linux and macOS.
Built-in HTTPS with Caddy¶
MemoMind iOS plugins require https:// for non-loopback servers. Set AGENT_DOMAIN in runtime.env and enable the tls profile (deploy/Caddyfile strips incoming Tailscale-User-Login headers and enforces a 32 MB body cap):
AGENT_ROUTER_CONFIG=~/.config/anvil-agent/router.toml \
AGENT_CONFIG=~/.config/anvil-agent/agent.toml \
docker compose -f deploy/docker-compose.yml --profile tls --env-file ~/.config/anvil-agent/runtime.env up --build -d
Option B: Native Python (Bare Metal / Tailscale Serve)¶
Requires Python 3.11+ and ffmpeg on PATH. When adapting deploy/*.example.toml for bare metal, switch Docker hostnames (realtime-router, host.docker.internal) to 127.0.0.1 and set listen_host = "127.0.0.1" / allow_container_bind = false. Export your runtime env file first because anvil-agent-server reads process environment variables directly:
pip install -e ./server
set -a && . ~/.config/anvil-agent/runtime.env && set +a
# Validate configs offline before binding
anvil-agent-server router validate --config ~/.config/anvil-agent/router.toml
anvil-agent-server agent validate --config ~/.config/anvil-agent/agent.toml
# Run both services
anvil-agent-server router run --config ~/.config/anvil-agent/router.toml
anvil-agent-server agent run --config ~/.config/anvil-agent/agent.toml
Tailscale Serve Authentication¶
When exposing Anvil Agent over a tailnet with tailscale serve:
- Keep
listen_host = "127.0.0.1"(never combineallowed_logins_envwithallow_container_bind = true). - Set
allowed_logins_env = "ANVIL_AGENT_LOGINS"to a comma-separated list of authorized tailnet logins. - Optionally also set
client_token_env(orclient_token_file) so local or remote MCP clients can authenticate with Bearer tokens.
Configuring Agent Backends¶
Declare 1 to 8 backends under [agent.backends.<id>] in agent.toml (order sets the picker order in the glasses UI):
kind = "openai-chat"— Any OpenAI-compatible/v1/chat/completionsserver (includingrealtime-router, Ollama, vLLM, llama.cpp, SGLang, or OpenAI). Requiresurlandmodel; supportskey_env/key_fileorauth = "none"for local unauthenticated servers.kind = "hermes-api"— Hermes API server (/v1/chat/completionswith persistent server-sideX-Hermes-Session-Idstate). Requiresurlandkey_env/key_file; optionalsession(default"anvil-agent") and optionalmodel.kind = "pi-web"— Pi mobile session bridge (/api/mobile-pi/sessions/<session>). Requiresurl,key_env/key_file, andsession.