Agency Swarm reuses your existing Agent definitions for voice. This page shows how to adapt agents for spoken conversations; deployment lives on the dedicated Deployment guide.
What you can build
- Phone receptionist — answers calls, routes to specialists, captures caller details.
- Live support triage — gathers context, lets callers interrupt, and escalates to a human or another agent.
- Language coach — listens, corrects pronunciation, and keeps the dialogue short and encouraging.
Prerequisites
- Access to a supported realtime provider:
- OpenAI (
gpt-realtime-2 by default, or the cheaper gpt-realtime-mini)
- xAI (
grok-voice-think-fast-1.0; legacy grok-voice-fast-1.0 remains available for older deployments)
- The standard install—no extras needed:
Define your agent (same API)
You keep using the standard Agent class—voice agents are regular agents with the same tools, handoffs, and instructions.
Keep using the same agent definitions—add voice= only when you care about the spoken persona.
Set voice to any supported realtime token:
- OpenAI voices:
alloy, ash, ballad, cedar, coral, echo, marin, sage, shimmer, verse
- xAI voices:
ara, eve, leo, rex, sal
One voice per call
A call uses a single voice from start to finish. Once the model has spoken, the realtime API refuses to switch voices—OpenAI answers with a cannot_update_voice error. Agency Swarm therefore picks the voice as the call starts and keeps it, even when the call hands off to another agent.
The voice comes from the first place that sets one:
- The
voice= you pass to run_realtime() or the demo launcher.
- The
voice= on your entry agent—the agent that answers the call.
- The provider’s own default when neither is set.
A voice= on any other agent is not used for that call. It is still worth setting: that agent uses its own voice whenever it is the one answering.
If you want variety without picking voices by hand, build the agency with randomize_agent_voices=True. Every agent without an explicit voice gets a deterministic random pick from the provider’s list, and the entry agent’s pick becomes the voice for the call. Pass voice_random_seed= to keep the picks stable between runs.
Add handoffs (optional)
Handoffs work exactly as they do in text mode. Register your flows once and they will carry over to voice sessions.
When the concierge hands off, the specialist takes over the conversation with its own instructions and tools. The caller keeps hearing the concierge’s marin voice for the rest of the call, so give the specialists a different name or greeting if you want the switch to be obvious.
Next steps