Vibe Engines is free, interactive AI engineering & system design — runs in your browser. Pick a learning path →
Talk is
a stopwatch.
A voice agent has one job that a chat box doesn't: it has to answer fast enough to feel like talking. Under the hood it's three stages in a row — hear it (speech-to-text), think (the LLM), say it (text-to-speech) — and the user waits for all three. Human conversation has a rhythm: reply in a beat and it feels alive; pause a second too long and it feels like a dropped call. So a voice agent isn't really about intelligence — it's about a latency budget, and this handbook is the arithmetic of spending it.
Three stages, one wait
A real-time voice agent is a pipeline. The user speaks; speech-to-text (STT) turns the audio into words; the LLM reads those words and generates a reply; text-to-speech (TTS) turns the reply back into audio the user hears. Three stages, run in order, because each needs the previous one's output: the LLM can't think until it has a transcript, TTS can't speak until it has text.
The consequence is simple and unforgiving: the user hears nothing until all three have finished, so the response time they feel is the sum of the stage times. It doesn't matter that your LLM is brilliant if the round trip takes two seconds — by then the human has already felt the silence. That's what makes voice different from a chat interface, where a spinner is socially acceptable. In conversation, the clock is running the whole time, and the budget for that clock is tiny.
A voice agent is STT + LLM + TTS in series, and the user waits for the whole sum — so it feels conversational only when that sum stays under the human turn-taking threshold, roughly 800 milliseconds.
The latency budget
Human turn-taking is astonishingly fast. In natural dialogue people begin replying within a couple hundred milliseconds of the other person stopping — often before, by predicting the end of the sentence. A gap much beyond that starts to feel like something's wrong: the other person is confused, distracted, or the line is bad. Cross about a second and the illusion of conversation collapses entirely.
So a voice agent has a latency budget — a hard ceiling on the end-to-end response time, commonly targeted around 800 ms to feel snappy (and every millisecond under that feels better). Every stage spends against it: STT might take 150 ms, the LLM 400 ms, TTS 200 ms. Add them up and you're at 750 ms — under budget, barely. Swap in a slower LLM at 700 ms and you're at 1050 ms, over the line, and the agent now feels like a laggy phone tree no matter how good its answers are. The whole engineering problem is keeping that sum under the ceiling.
Attack the bottleneck
When the sum is over budget, not all stages are equal. The one to fix first is the bottleneck — the slowest stage — because a fixed reduction there moves the total the same as anywhere else, but the bottleneck is where the biggest reductions are available. If the LLM is 700 ms and STT/TTS are 150 ms each, shaving the LLM is the only move that can bring a 1000 ms pipeline under 800 ms; trimming an already-fast stage barely helps.
So the optimization loop is: measure each stage, find the max, cut it, remeasure. Sometimes the bottleneck is the LLM (use a faster model, or fewer tokens); sometimes it's a network hop (colocate the services); sometimes it's TTS warmup. The discipline is to always spend your effort on the slowest stage, because that's the only place the total budget has real slack to give.
The budget math
The stages run in series, so end-to-end latency is their sum, and the pipeline "fits" only when that sum is within the conversational threshold:
150 + 400 + 200 = 750 ms ≤ 800 → fits. Swap the LLM to 700 → 1050 > 800 → over budget, feels laggy.
The stage to optimize is the one that dominates the sum — the max — and shaving the bottleneck is what pulls an over-budget pipeline back under the line:
Bottleneck of (150, 700, 200) is the LLM; halving it to 350 turns a failing 1050 ms into a passing 700 ms. The runnable version below computes the total, the fit, the bottleneck, and the headroom.
The latency budget, in numbers
A voice agent's response time is the sum of its three stages, because the user waits for STT, then the LLM, then TTS. It feels conversational only when that sum stays under the threshold — around 800 ms. The stage to optimize is the bottleneck, the slowest one, since that's where the biggest cuts live: halving a 700 ms LLM turns a failing 1050 ms pipeline into a passing 700 ms. Change the stage times or the threshold and watch the total, the fit, and the bottleneck move.
Streaming buys time
The math above treats the stages as strictly sequential — a worst case. Production voice agents beat it with streaming: each stage emits partial output as it works instead of waiting to finish, so the stages overlap. Streaming STT sends transcript fragments while the user is still talking, so the LLM can start on the first words before the sentence ends. A streaming LLM emits tokens one at a time, and streaming TTS speaks those tokens as they arrive — so the user starts hearing a reply while the LLM is still generating the rest of it.
The effect is dramatic: the perceived time-to-first-audio becomes far smaller than the naive sum, because the user only waits for the pipeline to begin producing sound, not to fully complete. This is the main reason a voice agent can feel real-time even when each stage individually takes a few hundred milliseconds. The sequential sum is still the right mental model for the budget — it's the ceiling you'd hit without overlap — but streaming is the lever that lets a real system live comfortably under it.
Pitfalls
The first trap is optimizing the wrong stage. It's tempting to tune the part you understand best, but if you shave 50 ms off a 150 ms STT while a 700 ms LLM sits untouched, you've barely moved the total. Always measure all three and attack the max. The second is ignoring the network: STT, LLM, and TTS are often three separate services, and every hop between them adds real time. Colocating them, or cutting round trips, can matter as much as the model choice.
Two more that make voice feel broken even under budget. Turn-taking: the agent must know when the user has actually stopped speaking (voice-activity detection and endpointing) and must gracefully handle being interrupted — a human who keeps talking over you feels awful, and so does an agent that won't yield. And no thinking-sound: because the budget is so tight, good voice agents fill unavoidable gaps with a natural filler ("let me check…") so the silence never reads as a freeze. Get the budget right and the interruption handling humane, and a voice agent stops feeling like a phone menu and starts feeling like a conversation. The rule is the whole handbook: keep the sum under the clock, and always cut the slowest stage first.
End-to-end latency is the sum of STT + LLM + TTS, so budget against that sum, optimize the bottleneck, and use streaming to overlap the stages. But a natural-feeling voice agent also needs good endpointing and interruption handling — low latency is necessary, not sufficient.
Worked example: time to first audio, step by step
The page’s budget counts STT, LLM and TTS. A real turn has two more costs: endpointing, the silence the agent waits through before deciding you have finished, and network hops. Take an illustrative stack: the endpointer waits 300 ms of silence, the LLM’s first token arrives after 200 ms and then one token every 25 ms, the reply is 40 tokens, each hop costs 20 ms. The clock starts when the user stops talking.
| Step | Event | Adds | Clock (streamed) |
|---|---|---|---|
| 1 | Endpointer hears 300 ms of silence and declares end of turn | 300 ms | 300 ms |
| 2 | Streaming STT finalises; most words were already transcribed | 50 ms | 350 ms |
| 3 | Transcript reaches the LLM | 20 ms | 370 ms |
| 4 | LLM’s first token | 200 ms | 570 ms |
| 5 | First clause done: 5 more tokens × 25 ms | 125 ms | 695 ms |
| 6 | Clause reaches TTS | 20 ms | 715 ms |
| 7 | TTS plays its first audio | 80 ms | 795 ms, under 800 |
| 8 | Same stack, no streaming: 300 + 150 STT + 20 + (200 + 39 × 25) + 20 + 200 TTS | — | 1,865 ms |
| 9 | Streamed, with a 200 ms endpoint instead of 300 | −100 ms | 695 ms |
Row 8 is the page’s sequential model with a full 40-token reply: 1,175 ms of generation alone puts it more than a second over budget. Streaming moves the user’s wait from “whole reply” to “first clause”, so only the LLM’s time to first token plus a few tokens counts. Rows 1 and 9 show the cost the page’s formula leaves out. Endpointing is the largest single line here, and it is pure waiting. After first audio, generation is far ahead of speech: 40 tokens is roughly 30 words, about 12 seconds of speech at 150 words per minute, produced in just over one second. Generation speed stops mattering; time to first token is what counts.
Cost and trade-offs: every latency lever has a price
Here Time is the effect on time to first audio, Space is what you pay for it, and Why is the trade-off.
| Case | Time | Space | Why |
|---|---|---|---|
| Smaller or faster LLM | Cuts time to first token and per-token time | Answer quality, tool-use reliability | Often the right first move, since the LLM is usually the bottleneck. Check quality on real calls, not on benchmarks. |
| Stream every stage | Wait drops from the whole reply to the first clause (rows 7 and 8) | Engineering: partial transcripts, chunked TTS, cancellation | Every stage must handle being cut off mid-stream when the user interrupts. |
| Shorter endpoint silence | Saves its full length (row 9) | Cuts off users who pause mid-thought | Semantic turn detection, a model that judges whether the sentence sounds finished, lets you wait less on complete sentences and longer on trailing ones. |
| Start the LLM on partial transcripts | Overlaps STT and LLM | Wasted tokens when the transcript changes | A speculative start: if the final words change the meaning, throw the draft away and restart. |
| Colocate services | Removes hop time (rows 3 and 6) | Less freedom to mix vendors and regions | Three vendors in three regions can spend more on hops than one stage takes. |
| Speech-to-speech model | Removes two stage boundaries | Less control: no text transcript in the middle for logging, guardrails or tool calls unless the model provides one | Fewer hops and more natural prosody, in exchange for a pipeline you can inspect less. |
| Filler phrase or cached audio | Perceived wait near zero for that turn | Can sound canned if overused | Pre-synthesised “let me check that” covers a slow tool call, but it does not make the real answer any faster. |
Measure the 95th percentile, not the mean. A pipeline that averages 700 ms but hits 1,500 ms on one turn in twenty will feel broken to most callers within a few minutes.
Where this shows up in production and interviews
- Phone agents
Call-centre and booking agents run over the phone network, which adds its own transport and buffering delay before your pipeline even starts. That leaves less of the 800 ms for STT, LLM and TTS, and is why phone deployments push hardest on streaming and colocation.
- Transport: WebRTC vs WebSockets
In the browser and in apps, audio usually travels over WebRTC. It was built for live media: it runs over UDP, uses a jitter buffer, and includes echo cancellation, so the agent does not hear its own voice and interrupt itself. WebSockets work and are simpler, but run over TCP, where one lost packet holds up everything behind it.
- Barge-in
When the user talks over the agent, three things must happen fast: stop playback, cancel the in-flight LLM and TTS streams, and keep only the part of the reply that was actually spoken in the conversation history. Get the last step wrong and the agent later refers to things the user never heard. Voice frameworks such as LiveKit Agents and Pipecat exist largely to handle this.
- The interview version
In “design a voice assistant”, draw the pipeline, write a per-stage budget like the table above including endpointing and hops, and say which stages stream. Then cover interruption, how you would measure p95 time to first audio per turn, and what happens when a tool call takes two seconds.
Check yourself
In the streamed timeline above, the LLM’s per-token time doubles from 25 ms to 50 ms. What is the new time to first audio?
Only the five tokens after the first one are on the critical path, so step 5 grows from 125 to 250 ms. Time to first audio becomes 920 ms, over budget. The rest of the reply still arrives faster than it can be spoken.
Your stages measure 150 / 700 / 200 ms and you have a week. Do you spend it on a faster TTS voice or on the LLM?
The LLM. Even removing TTS entirely leaves 850 ms, still over 800. Halving the LLM to 350 ms gives 700 ms. Cut the bottleneck first, as the page says, then make sure the LLM streams so its first token is what counts.
Users complain the agent interrupts them when they pause to think. Latency is fine. What do you change?
The endpointing. The silence threshold is too short for mid-sentence pauses. Lengthening it costs every turn that much time, so the better fix is semantic turn detection: wait less after a complete sentence, longer after “so I was wondering if…”.
After a barge-in, the agent says “as I mentioned, the fee is waived”. The user never heard that. What went wrong?
The agent saved the whole generated reply to the conversation history, not just the part that was played before the interruption. On barge-in, cut the assistant message to the text actually spoken, so the model’s memory matches what the user heard.
Quick answers
What is a voice AI agent?
A pipeline that hears you (STT), thinks (LLM), and speaks back (TTS), fast enough to feel like a conversation.
Why does latency matter?
The user waits for all three stages, and human dialogue breaks down past ~800 ms — so the sum of stage times decides whether it feels alive.
How do you cut latency?
Find the bottleneck (usually the LLM), shave that first, cut network hops, and use streaming so the stages overlap.
What is streaming?
Each stage emits partial output as it works, so they overlap — the user hears a reply while the LLM is still generating it.
This idea in other formats
Explore the topic
See this alongside everything else on the same subject — handbooks, system designs, challenges and tools, in one place.
More Handbooks
- The Prompting HandbookA friendly, hands-on field guide for everyday humans — learn the CRISP framework, spot bad prompts, practice with real recipes, play a drag-and-drop game, and test yourself with a quiz. No code required.Read →
- The Senior AI Engineer Interview Handbook60 questions across architecture, production incidents, agentic systems, RAG, evals, cost, safety, and leadership — what staff-level AI interviewers actually probe for.Read →
- The LLM Serving HandbookHow to serve large language models fast and cheap — prefill vs decode, the KV cache, continuous batching and PagedAttention (vLLM), quantization, speculative decoding, and the latency-vs-throughput tradeoffs that decide your inference bill.Read →
- The Transformers HandbookThe architecture behind every LLM, built up from scratch — tokens and embeddings, positional encoding, self-attention (query/key/value), multi-head attention, the transformer block (FFN, residuals, layer norm), and how a decoder-only model generates text autoregressively.Read →
- The Fine-Tuning HandbookWhen to fine-tune vs RAG vs prompting, full fine-tuning vs parameter-efficient methods, how LoRA and QLoRA make it cheap enough for a single GPU, why the data matters more than the method, catastrophic forgetting, and how to evaluate and decide.Read →
- The On-Device AI HandbookSmall models, everywhere: why 1–14B models got frontier-adjacent (distillation + textbook data), the napkin law of local inference (tokens/sec ≈ bandwidth ÷ bytes), quantization and the llama.cpp / GGUF / Ollama / MLX stack, the honest local-vs-cloud decision table, four hybrid patterns that ship, and the evals craft of choosing a small model that actually fits the device.Read →