garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /docs/notes/voice-agent.md

raw


topic: voice-agent triggers: [crates/voice, cartopolis_voice, "mcp/voice.rs", voice_tools, "--voice-agent", voice_call, "voice agent", "Realtime API", realtime, KEEP_LISTENING, agent_voice, tap_audio, pcm_sink, "accounts.agent", "CallMember.agent"] updated: 2026-10-23

The voice agent: calls the bot takes part in by speech

Design and the decisions taken with the person steering: docs/mockups/voice-agent/. Built 2026-10-23. Three pieces: cartopolis_voice (the bridge to OpenAI's Realtime API, Bevy-free), cartopolis_mcp::voice_tools (its tools), and the client's systems::mcp::voice (answering, placing, following calls).

Why it is a device and not a service

Calls are end-to-end encrypted and the simulator must never open a frame (calls.md). So the agent is a member of the call: the bot's headless client hears through its session (Session::tap_audio) and speaks through it (Session::pcm_sink). Both run on threads of their own, never at the app's frame rate, which on a headless client between calls is two frames a second (pace_idle, which now also keeps the full rate during any call so tool replies are not half a second late).

Decided while building, and why

What is verified, and what is not

Running it

midas bot start --node <node> --name viberfox --agent --brief tools/bot/viberfox.md \
  --mcp 'cargo run -q -p cartopolis -- mcp --socket /tmp/bot/mcp.sock' \
  -- cargo run -q -p cartopolis -- --mcp-headless --mcp-listen /tmp/bot/mcp.sock \
     --connect cartopolis.org --mcp-allow jeroen --mcp-private-only \
     --voice-agent --voice-key-file ~/.config/cartopolis/voice.key

Then mark viberfox as an agent on the Admin page, so callers see the badge.