Voice agents fail in a way text agents never do: the user can hear the delay. A chat interface can take several seconds to answer and nobody mentions it. A phone call that pauses noticeably produces "hello? are you there?" — and the illusion of conversation is gone.
That asymmetry makes voice engineering a latency discipline first and a language-model problem second. The model is rarely the bottleneck you can fix. The pipeline is: audio capture, endpoint detection, speech recognition, generation, synthesis, transport, and playback, each contributing delay and each capable of making the others look bad.
This is a guide to where the time goes, which tradeoffs are actually yours to make, and how to build a pipeline you can measure instead of a demo that sounds fine on your laptop and terrible on a phone.
Latency is a property of the chain
A useful mental model: the user perceives the time from the end of their last word to the first audible syllable of the reply. Every stage between those two points adds to it, and the stages are in series.
Capture and encoding cost a few frames of audio. Voice activity detection decides when the user has stopped speaking, and that decision is where most perceived latency is created or hidden. Speech recognition must produce at least a partial transcript. The model must produce its first token. Synthesis must produce its first chunk of audio. The transport must deliver it, and the client must have enough buffer to play it without stuttering.
Optimizing one stage in isolation is the classic mistake. A fast model behind a slow endpointing policy still feels slow, and a fast transcriber feeding a model that thinks for a long time changes nothing. You have to look at the sum, and you have to know which term dominates for your workload. That is a measurement problem, not an architecture preference.
Endpointing is the tradeoff nobody budgets for
The pipeline cannot know the user is finished until it decides they are finished. That decision is a policy with two failure directions.
Wait too little and you cut people off mid-thought. The transcript is truncated, the model answers a question that was still being asked, and the user has to repeat themselves — which feels much worse than a slow reply. Wait too long and every turn carries a fixed pause, even when the user has clearly finished.
Fixed silence thresholds are simple and surprisingly hard to beat. They are also blind to content. A pause after "and the second thing is" is not the same as a pause after a complete question, but a timer cannot tell. Semantic endpointing — a small model judging whether the utterance is complete — improves the experience at the cost of another model call in the critical path, plus the risk of being confidently wrong.
The practical compromise most teams land on is a short silence threshold combined with a tolerant recovery path: if the user resumes speaking while the agent is responding, treat it as an interruption rather than an error. That requires barge-in support, which is covered below, and it turns a hard timing problem into a soft one.
This is also where mobile networks punish you. Jitter and packet loss delay the final audio frames, so a threshold tuned on a wired connection fires early on a train. Test with real devices on real networks, or your endpointing parameters are fiction.
Streaming has to reach all the way down
The single most effective architectural decision is to stream every stage. Not because streaming is fashionable, but because the user only needs the beginning of the answer to feel responded to.
On the recognition side, partial transcripts let you start reasoning before the utterance is finalized. A common pattern is speculative: begin generating on a stable partial, then discard and restart if the final transcript differs materially. This is a real latency win with a real cost — discarded work — so it belongs behind a flag you can turn off when the model is expensive.
On the generation side, token streaming is table stakes. Waiting for the full response before synthesizing throws away the advantage of the whole pipeline.
On the synthesis side, sentence-level chunking matters more than raw model speed. A TTS engine that produces natural prosody per sentence will sound better and start sooner than one waiting for a whole paragraph, provided your text splitter respects sentence boundaries rather than chopping at fixed character counts. Number formatting is a detail that bites here: "1,200" read as "one comma two hundred" is an instant credibility loss, so normalize before synthesis.
The engineering discipline is a cancellation protocol. Every turn gets an identifier; every audio chunk carries it and a sequence number. When a new turn starts, the client drops chunks from the old one. Without this, an interrupted response keeps playing after the user has moved on, which is the audio equivalent of talking over someone.
Interruption is the feature that makes it feel human
Barge-in — letting the user talk over the agent — is what separates a conversational system from a walkie-talkie. It is also the hardest part to get right.
The core requirement is that the client keeps detecting speech while the agent's audio is playing. That means the microphone stays open, which means the agent hears itself through the speaker. Echo cancellation is mandatory; without it, the system interrupts itself on its own output and produces a loop of half-sentences.
The second requirement is state hygiene. When the user interrupts, the transcript should reflect what they actually heard, not what was generated. If the agent said half a sentence before being cut off, the model's history should contain that half sentence, because that is the shared context. Truncating to what was generated confuses the model about what was communicated; truncating to what was played is more honest, though it requires playback progress reporting from the client.
The third is a fast stop. Cancelling generation and synthesis promptly is a resource question as much as a UX one; a system that keeps synthesizing abandoned text pays for audio nobody hears.
Transport: WebSocket versus WebRTC
Both work; they fail differently.
A WebSocket is a TCP stream. It is simple to operate, passes through most proxies, and works everywhere a browser does. Its weakness is head-of-line blocking: a lost packet stalls everything behind it until retransmission, which for real-time audio shows up as a stutter rather than a gap. It also does nothing about echo, jitter, or device selection — you build those yourself.
WebRTC is designed for this problem. It handles jitter buffering, packet loss concealment, echo cancellation, and device negotiation, and it degrades gracefully because it runs over UDP with its own congestion control. The cost is operational: signaling, ICE, TURN servers for restrictive networks, and a steeper debugging curve. If you are shipping a phone-like experience to consumers, that cost is usually worth paying. If you are shipping an internal tool on desktop browsers, a WebSocket carrying PCM frames is far less machinery.
A hybrid is common and reasonable: WebRTC for the browser leg, a server-side bridge to your STT and TTS providers over WebSockets. You get real audio handling at the edge without adopting a full media server architecture. The streaming voice reference implementation is a readable starting point for the WebSocket half of that bridge.
Sample rates deserve a note. Speech recognition pipelines typically want 16 kHz mono PCM, while synthesis often outputs at a higher rate. Resampling is cheap but not free, and mismatched rates are a frequent source of "why does it sound like a call from 1998".
Measure the stages, not the vibe
You cannot tune what you do not timestamp. Instrument the pipeline with marks per turn: end of user speech, final transcript, first model token, first synthesized audio, first audio played. The distribution matters more than the average, so track percentiles — the p95 is what users remember, and the worst turns are usually network events rather than model events.
Alongside latency, track quality signals that correlate with the experience: false interruption rate (agent cut off the user), self-interruption rate (agent cut itself off), barge-in success rate, and task completion. A pipeline that is fast and constantly mis-endpoints is worse than a slower one that listens properly.
Test on hardware you do not control. A laptop on office Wi-Fi is the most forgiving environment in existence. A mid-range phone on a congested network, with a case that muffles the microphone, is the real target.
What's usable today
Streaming STT, streaming generation, and streaming TTS are all production-ready, and the orchestration around them is well understood. The parts that still demand engineering are endpointing under noise, barge-in with echo cancellation, and transport choice for your specific client. Hosted realtime APIs collapse much of the pipeline into one connection and are a reasonable starting point — the realtime voice agent example shows the shape — while self-hosted chains give you control over cost, voice, and data residency at the price of operating more moving parts.
Start with the simplest chain that streams end to end, measure per-stage latency on real devices, and only then optimize the dominant term. If you are still choosing the agent runtime that sits in the middle of this pipeline, the framework comparison is the practical next read.
Last updated: 2026-10-22