Architecture · Voice
Voice AI Agent Architecture: From Phone Call To Spoken Reply
The short answer
A voice AI agent is a streaming pipeline. Audio arrives over the phone network or WebRTC, a media server carries it to voice activity detection and streaming speech-to-text, a language model decides what to say and which tools to call, and streaming text-to-speech speaks the reply. The alternative is a speech-to-speech model that hears and speaks directly. Either way, the design goal is a reply that starts within about a second.
By Maitreya Kulkarni · Updated · 11 min read
01 · The architecture
How Does Audio Flow Through A Voice Agent?
Through a loop of streaming stages. The media server receives the caller's audio, turn detection and speech-to-text work on it as it arrives, the dialogue agent responds and calls tools, text-to-speech streams the voice back through the media server, and interruptions cut the loop short.
NX-AR-03 · Architecture
The cascaded voice pipeline
- Outside world
- Data & integration
- AI agent
- System of record
- Your people
- L1
Caller
(Outside world)Phone call
PSTN or SIP trunk
. Hands work to: Media server.Browser or app
WebRTC
. Hands work to: Media server.
Passes down: audio in - L2
Transport
(Data & integration)Media server
Rooms, codecs, jitter buffers
. Hands work to: Turn detection, Speech-to-text.
Passes down: audio frames - L3
Hearing
(Data & integration)Turn detection
Voice activity, end of turn, barge-in
. Hands work to: Dialogue agent.Speech-to-text
Partial and final transcripts
. Hands work to: Dialogue agent.
Passes down: transcripts and turn signals - L4
Thinking
(AI agent)Dialogue agent
LLM with the call playbook
. Hands work to: Tool calls, Text-to-speech.
Passes down: words and tool calls - L5
Acting
(AI agent)Tool calls
Calendar, CRM, knowledge
. Hands work to: Warm transfer.Text-to-speech
Streams sentence by sentence
. Hands work to: Audio out.
Passes down: outcomes - L6
Outcome
(System of record)Warm transfer
To a person, with a summary
Audio out
Back to the caller
. Hands work to: Media server.Transcript and recording
02 · Two approaches
What Are The Two Ways To Build A Voice Agent?
A cascaded pipeline chains separate speech-to-text, language and text-to-speech models. A speech-to-speech model, such as OpenAI's Realtime models or Gemini Live, takes audio in and produces audio out. Cascades give more control; speech-to-speech gives lower latency and more natural prosody.
| Item | Cascaded (STT → LLM → TTS) | Speech-to-speech |
|---|---|---|
| Latency | Cascaded (STT → LLM → TTS)Low with streaming; more hops | Speech-to-speechLowest; one model |
| Control | Cascaded (STT → LLM → TTS)Swap any stage; inspect text | Speech-to-speechLess visibility into each step |
| Voices | Cascaded (STT → LLM → TTS)Any TTS voice, cloning | Speech-to-speechThe model's voices |
| Tool use | Cascaded (STT → LLM → TTS)Mature, any LLM | Speech-to-speechSupported, model-dependent |
| Best for | Cascaded (STT → LLM → TTS)Regulated, tool-heavy calls | Speech-to-speechNatural, fast conversation |
03 · Latency
Where Does The Latency Go In A Voice Agent?
Into every hop: telephony, deciding the caller has finished, final transcription, the model's first token, and the first audio from speech synthesis. People notice pauses beyond about a second, so each stage is streamed and tuned.
Turn detection
Waiting for silence is slow; semantic end-of-turn models decide sooner whether the caller has finished a thought.
Fast first token
A fast model, a short system prompt and prompt caching shorten the wait for the first words.
Streaming speech
Text-to-speech starts on the first sentence while the model is still writing the rest.
Location
Running media, models and telephony in the same region removes hundreds of milliseconds of travel.
04 · Turn-taking
How Do Interruptions And Turn-Taking Work?
The agent listens while it speaks. When voice activity detection hears the caller start talking, the agent stops its speech, drops what it was about to say and treats the new words as the next turn, just as a person would.
Barge-in
Speech output is cancelled the moment the caller speaks, so they never have to wait for the agent to finish.
Backchannels
Short sounds like “mm-hm” are recognised as listening, not as a new turn.
Filler while working
When a tool takes time, the agent says something natural (“let me check that”) instead of going silent.
05 · Production
What Does It Take To Run Voice Agents In Production?
Everything a call centre needs, plus AI-specific checks: consent and disclosure, recordings and transcripts, quality sampling, dashboards, and compliance with calling rules in each country.
Disclosure and consent
Callers are told they are speaking to an automated agent, and recording consent is handled per jurisdiction.
Calling rules
Outbound calls respect do-not-call registries such as India's DND and the TCPA in the US, and calling hours.
Quality assurance
Every call is transcribed and scored; a sample and every flagged call is reviewed by a person.
Hand-off
Warm transfer to a person with a summary on screen, so callers never repeat themselves.
The ecosystem
Twilio
LiveKit
Deepgram
ElevenLabs
OpenAI Realtime
Gemini Live
WebRTC


