AI Engineering
Building a Production Voice AI Stack: Architecture, Latency & Real-Time Orchestration
A practical engineering guide to building production voice AI systems, covering realtime architecture, ASR, LLMs, TTS, orchestration, interruptions, latency, observability and failure handling.
In this article
- The Real Problem with Voice AI
- Two Ways to Architect Voice AI
- 1. Audio Transport & VAD
- 2. Streaming Speech Recognition
- 3. The Reasoning Layer
- 4. Real-Time Tool Execution
- 5. Streaming Text-to-Speech
- 6. Barge-in & Interruption
- 7. Latency as a Budget
- 8. Handling Failure in Production
- 9. Conversational Observability
- 10. Security & Data Boundaries
- 11. When Voice Is the Wrong Choice
- Prototype vs Production Ready
- Conclusion
- Frequently Asked Questions
Voice AI demos are easy to build. Production voice systems are not. The difficult part is keeping audio, models, tools, state and interruptions coordinated while everything is happening in real time.
What is a production Voice AI stack?
A production Voice AI stack is the combination of audio transport, speech recognition or speech-to-speech models, reasoning, tool execution, speech synthesis, session state, interruption handling and observability required to run a conversational AI system reliably in real time. That last part matters. A prototype can work perfectly when one person asks one question in a quiet room. A production system has to deal with background noise, incomplete speech, network jitter, slow APIs, users changing their minds, model failures and people talking over the assistant.
The real problem with Voice AI is not the voice
From the outside, a voice agent seems straightforward: listen to the user, understand what they said, work out what to do, and say something back.
Underneath that simple interaction is a distributed realtime system. Audio is moving continuously. Transcripts can change while the user is still speaking. Models may be generating responses while external tools are running. The user can interrupt at any point. Meanwhile, the client still has to play audio smoothly without jitter or buffering clicks.
This is why connecting an ASR provider, an LLM and a TTS provider together is only the beginning. The engineering challenge is coordinating those pieces without making the conversation feel like an awkward collection of discrete API calls.
The central engineering question
The goal is not simply to make every individual component as fast as possible. The goal is to keep the conversation responsive while maintaining correctness, state consistency and a graceful failure path.
Two ways to architect a modern Voice AI system
There is no single architecture that makes sense for every voice application. In practice, production systems converge on two broad patterns:
1. The Chained Architecture: The traditional approach separates the system into specialized, swappable components:
Audio In
↓
Speech Recognition (Streaming ASR)
↓
LLM / Reasoning Layer
↓
Tools & Application Logic (APIs, CRM, DB)
↓
Speech Synthesis (Streaming TTS)
↓
Audio OutThis approach remains useful because each layer can be controlled, evaluated, and replaced independently. Teams can choose their own specialized transcription provider, reasoning model, voice engine, and business logic. It is also straightforward to inspect: you can analyze transcripts, inspect model tokens, examine API payloads, and listen to generated audio as separate, traceable stages.
2. Full-Duplex Realtime Voice: Newer voice systems increasingly treat conversation as a continuous audio interaction rather than a sequence of completed turns. A full-duplex model listens while speaking, handles interruptions natively, and maintains conversational timing without requiring every utterance to cross discrete text-to-speech and speech-to-text boundaries.
This changes the architecture considerably. The conversational voice path stays focused on keeping interaction fluid and responsive, while deeper reasoning, tool execution, and database lookups happen asynchronously when needed.
A production Voice AI system has two distinct paths
The conversational path needs to stay responsive. Deeper reasoning and external actions can often happen asynchronously.
User Audio
Inbound stream
Voice Layer
VAD & transport
Fast Reasoning
Streaming turn
Audio Response
Playback start
Deep Reasoning
Agentic planner
Tool Execution
APIs & DB queries
State Sync
CRM & session record
Decoupling the audio critical path from heavy tool execution prevents multi-second conversational dead air.
1. Audio transport and voice activity detection
Everything starts before an AI model processes a single token. The system first has to capture raw microphone audio, transport it reliably across unpredictable networks, and accurately determine when human speech is occurring.
Depending on the client environment, transport typically involves WebRTC data/media tracks for browser and mobile apps, or SIP/WebSockets for telephony integrations.
VAD is more important than it looks.
Voice activity detection (VAD) determines whether incoming audio contains speech. In theory this sounds simple, but real-world audio is messy. Callers breathe, pause mid-thought, say "um", speak softly, or cough. Street noise, sirens, and background voices can easily trick an untrained detector.
A VAD or endpointing algorithm that is too aggressive will cut users off mid-sentence. One that waits too long introduces 600–900ms of dead air after every turn, making the assistant feel sluggish and unresponsive. Endpointing alone can materially change the perceived speed of an AI assistant.
2. Streaming speech recognition
In a real-time conversational agent, waiting for an entire utterance to finish before transcribing defeats the purpose of streaming. Instead, the speech recognition engine must emit partial results while the user is still vocalizing, followed by a committed final transcript once silence is confirmed.
A partial transcript is not a fact
A streaming recognizer may first emit "I'd like to change my delivery..." and later revise the phrase when subsequent phonetic context arrives. Application logic must never trigger irreversible actions (like modifying a database or billing a card) on provisional text. Use partial transcripts to prime retrieval and pre-warm models, but wait for confirmed turn endpoints before executing state changes.
Domain vocabulary matters.
General-purpose speech recognition works remarkably well until customers speak company-specific jargon, product SKUs, foreign names, or internal system identifiers:
"I want to cancel my VectoRise Core subscription."If the recognizer transcribes "VectoRise Core" as "vector eyes core", the downstream LLM may hallucinate a response based on an inaccurate entity. Keyterm prompting, specialized vocabulary dictionaries, and phonetic fuzz-matching against catalog databases are essential safeguards before executing business operations.
3. The reasoning layer is not just an LLM
Calling the middle tier of a voice agent "the LLM" obscures most of the engineering required for production stability. The reasoning layer must continuously orchestrate:
- Intent classification and conversational goal tracking
- Multi-turn context and session state preservation
- Decision logic on whether more information is needed before taking action
- Executing external API integrations and validating return payloads
- Enforcing safety and verification boundaries on sensitive actions
- Handling users who change their mind or contradict earlier statements mid-conversation
- Formatting responses specifically tailored for spoken audio rather than screen display
Voice changes how an LLM should respond.
A response written for a monitor can comfortably display bullet points, hyperlinks, and complex tables. Spoken aloud, that same output is exhausting and unnatural. Production voice prompts enforce succinct phrasing, conversational cadence, single-idea clauses, and verbal confirmations.
The reasoning layer is an orchestration problem
The model is one component. State, tools, permissions, validation and cancellation determine what actually happens.
Voice Orchestration Responsibilities
Scale: 1–10 ImportanceMulti-turn memory & conversation history
Intent classification & response strategy
API triggers & payload parameterization
Output verification & sanity checks
Least-privilege authorization boundary
In-flight abort on barge-in
4. Tool calls are where voice agents become useful
A voice agent that can only recite FAQ answers is a glorified IVR. A voice agent that can act in backend systems delivers genuine operational leverage. Typical enterprise workflows include:
- Checking order tracking and delivery status in real-time
- Scheduling, modifying, or cancelling calendar bookings
- Updating customer records in Salesforce or HubSpot
- Authenticating account credentials via multi-factor SMS
- Creating and prioritizing support tickets in Zendesk or Jira
- Verifying warehouse stock and processing inventory reservations
- Triggering internal dispatch and operational workflows
The fundamental challenge is that enterprise APIs are rarely realtime. A CRM lookup may take 250ms, an inventory database query may take 1.8 seconds, and an external payment gateway may occasionally timeout altogether. The voice layer must never stall the conversation while waiting for slow backend services.
Keep slow work off the critical conversational path
If an external operation takes time, the system must have a deliberate conversational strategy: acknowledge the request naturally ("Let me look up your account..."), maintain active listening, execute the tool asynchronously, and smoothly weave the result into the next turn. It must never plunge into awkward, multi-second silence.
5. Streaming text-to-speech
Once the reasoning layer begins producing tokens, the synthesizer must convert text into audio bytes without waiting for the complete sentence. Waiting for full model completion adds hundreds of unnecessary milliseconds of latency.
Modern neural TTS engines stream audio via WebSockets. However, the orchestrator faces a delicate balance: chunking text too early (1–2 words) produces fragmented, robotic prosody because the synthesizer lacks context. Chunking too late (full sentence) delays first-audio playback.
Streaming TTS trades context against response time
Smaller text chunks can start playback earlier, while larger chunks can provide more context for natural prosody.
TTS Chunk Size vs Latency & Context Trade-Off
Streaming Mechanics6. Barge-in: when the user talks over the assistant
Barge-in is the single clearest test separating amateur prototypes from enterprise-grade voice systems. Consider a typical interaction:
Assistant: "Your appointment is scheduled for Thursday at two in the afternoon..."
User: "No, Thursday doesn't work. Make it Friday."Naive implementations continue playing the original audio stream while simultaneously attempting to parse the interruption. The result feels deaf, clumsy, and unnatural. True barge-in requires coordinated cancellation across the entire software stack:
- Detect incoming user vocalization via VAD within 20–50ms
- Immediately instruct client audio drivers to stop and flush playback buffers
- Send cancellation frames to the active TTS synthesis WebSocket
- Cancel in-flight LLM token generation to avoid wasted compute and credit spend
- Resolve whether in-flight tool calls should be aborted, rolled back, or allowed to complete in the background
- Accurately reconcile conversation history based on the exact words the user heard before interrupting
That last point is critical: the model may have generated 20 words, the synthesizer may have buffered 12 words, but the user only heard 5 words before speaking. If your conversation memory includes the unplayed words as "spoken context", state desynchronization is guaranteed.
The interruption control pipeline
Barge-in is a distributed control problem that must coordinate the client audio buffer, TTS stream, LLM tokens, and backend tool state.
Interruption (Barge-In) Control Pipeline
6 Steps to Zero DesyncDetect speech
VAD flags incoming user audio frames immediately
Stop playback
Client audio buffer flushes within 15–30ms
Cancel generation
Active LLM token generation & TTS WebSocket canceled
Resolve tool state
Determine whether in-flight API calls abort or background
Update context
Session memory aligned to words the user actually heard
Resume conversation
Listen & process new turn without stale repetition
7. Latency is a budget, not a single number
Claiming "our voice agent has 300ms latency" is meaningless without specifying what was measured. In conversational audio, response speed is the sum of multiple distributed pipeline stages:
| Metric | What it measures | Target Benchmark |
|---|---|---|
| Time to First Transcript (TTFT-ASR) | How fast speech recognition begins emitting provisional tokens | 120–250ms |
| Endpointing / Turn Detection | Time waited after silence to commit the user turn | 300–600ms |
| LLM Time to First Token (TTFT) | How quickly the reasoning model begins streaming its reply | 150–400ms |
| Tool Execution Latency | Time required for external APIs or database queries to return | 100–1200ms |
| TTS Time to First Audio (TTFA) | How fast the voice synthesizer returns the first playable PCM chunk | 100–250ms |
| Client Playback Buffer | Audio driver buffer depth required to avoid underrun jitter | 30–80ms |
| Interruption Latency | Time from user speech start to client audio silence | 40–100ms |
Crucially, these stages do not execute sequentially. While the user is speaking, ASR is streaming frames. While turn endpointing resolves, context is pre-fetched. While the LLM generates tokens, early words stream into TTS. The architecture operates as a concurrent pipelined system.
Where perceived voice latency comes from
Conceptual breakdown of conversational response time across model, synthesis, transport, and turn detection.
Where Perceived Voice Latency Comes From
Pipeline BreakdownTime to first token from model
Speech-to-text frame processing
Silence threshold before turn commits
API lookups & database queries
Synthesizer first-chunk generation
Network packet jitter & client audio card
8. What happens when something goes wrong?
Production systems are defined not by their happy paths, but by how gracefully they recover when dependencies fail:
- ASR mishears an essential name or address: The agent should seek gentle clarification rather than committing a faulty transaction.
- CRM API takes 3+ seconds to respond: The voice layer uses filler phrases or proceeds asynchronously rather than freezing in dead silence.
- User interrupts in the middle of a database commit: The orchestrator evaluates idempotency keys and state safety before aborting.
- TTS provider WebSocket disconnects: The client immediately falls back to a secondary synthesis provider or cached prompts.
- Client network packet drops: Audio transport reconnects seamlessly without resetting the conversation session.
The rule we use for production systems
Every external dependency must have an explicit answer to one question: what happens when this dependency is slow, unavailable, or wrong? If the answer is "the user will probably try again", the system is not production ready.
9. Observability: measure the conversation, not just the APIs
Standard application APM metrics (like HTTP 200 counts) are useless for voice agents. A server may register 100% API success while users endure a frustrating, disjointed conversation. True voice observability tracks interaction telemetry at the session level:
- Endpointing duration and false-positive cut-off counts
- P50, P90, and P99 Time-to-First-Audio latency distribution
- Interruption and barge-in frequency per conversation
- Token generation cancellation rates and wasted compute costs
- ASR confidence scores and entity correction frequency
- Tool execution failure rates and retry volumes
- Task completion rate versus human agent transfer/escalation rate
Monitoring latency distribution is vital: an average response time of 400ms can easily conceal a P99 tail where 5% of users wait 3.5 seconds in awkward silence.
10. Security and data boundaries belong in the architecture
Voice callers frequently speak sensitive data they would hesitate to enter into a web form: national identifiers, card numbers, account details, and private personal circumstances. Security must be baked into the architecture from day one:
- Mutual TLS encryption for all SIP, WebRTC, and WebSocket transports
- Zero-retention policies for raw audio recordings containing regulated data
- Granular tool-level authorization ensuring agents cannot exceed least privilege
- Human-in-the-loop confirmation gates for financial or consequential actions
- Prompt injection safeguards against malicious voice jailbreaks and tool exploits
- Audit-ready tamper-evident event logs for all agent actions and decisions
11. When voice is the wrong interface
Voice is not universally superior simply because it is conversational. Good software engineering is about choosing the right interface for the job. A screen is vastly better when users need to:
- Review long, detailed legal documents or contracts
- Compare dozens of multi-attribute products side-by-side
- Enter complex alphanumeric strings (like serial keys or tracking numbers)
- Inspect rich graphical dashboards, charts, and visualizations
Voice excels when users are mobile, hands or eyes are occupied, workflows require conversational clarification, or when routine Tier-1 inquiries can be resolved immediately without hold times.
What actually makes a Voice AI system production-ready?
The difference between a flashy demo and a resilient enterprise voice system lies entirely in the engineering around the model:
| Prototype | Production Voice System |
|---|---|
| Single happy-path conversation | Explicit state machine with defined error & recovery paths |
| Fixed model pipeline | Adaptive orchestration matched to workflow complexity |
| Average latency metric | P90/P99 latency distribution & critical-path optimizations |
| Model output trusted blindly | Strict validation, output parsing, & permission boundaries |
| No interruption handling | Sub-50ms barge-in cancellation across audio & LLM streams |
| Raw API errors shown to caller | Graceful fallback phrasing & human agent transfer |
| Logs per API request | Holistic session-level conversational telemetry |
| Voice bolted onto existing IVR | Workflows redesigned around conversational intelligence |
Conclusion: Build the system around the conversation
Voice AI has progressed far beyond connecting an off-the-shelf speech-to-text API to an LLM and reading the result through text-to-speech. While that chained approach offers valuable modularity and control, full-duplex architectures are transforming conversational fluidity.
The true engineering challenge sits in the middle: the orchestration layer that preserves state, the transport layer that streams audio reliably, the cancellation logic that enables seamless barge-in, and the validation boundaries that prevent bad transcripts from triggering catastrophic transactions.
At VectoRise, we treat Voice AI as an infrastructure and systems engineering problem. The goal is always the same: build an AI system that holds up when real users do real things with it.
Frequently asked questions
What is a Voice AI stack?
A Voice AI stack is the collection of technologies responsible for capturing audio, understanding speech, reasoning about requests, executing backend actions, generating responses, and delivering streaming audio. Production systems also require session state, interruption handling, observability, and failure recovery.
What is the difference between a chained Voice AI system and a realtime voice model?
A chained system separates speech recognition, reasoning, and speech synthesis into discrete components. A realtime voice model processes incoming and outgoing audio as a continuous interaction. Chained systems provide granular modularity and vendor flexibility, while realtime models simplify conversational timing and turn-taking.
How do Voice AI systems reduce latency?
Key techniques include streaming audio transport, incremental transcription, early response generation, streaming TTS chunking, parallel tool execution, and keeping slow database operations off the critical conversational path.
What is barge-in in Voice AI?
Barge-in is the ability for a human caller to interrupt an AI assistant while it is speaking. A production implementation detects new speech within milliseconds, cancels active audio playback and in-flight token generation, reconciles conversational state, and continues naturally.
Should every Voice AI application use the fastest available model?
No. Model selection is a balance between response quality, tool accuracy, latency, cost, and consequence. A lightweight model may suffice for simple routing, while a reasoning-heavy model is justified for complex workflows.
What makes a Voice AI system production-ready?
Production readiness comes from the complete system rather than a single model: robust state management, sub-100ms interruption handling, schema validation, tool permission boundaries, session observability, security safeguards, and graceful recovery under failure.
