Normalized for Mintlify from
knowledge-base/aiconnected-apps-and-modules/modules/aiConnected-voice/aiConnected-voice-deep-dive.mdx.Voice by aiConnected — A Technical Deep Dive for the AI Community
What This Document Is
This document is written for practitioners in the AI/ML space — engineers, researchers, and builders who understand the current state of large language models, their capabilities, and their limitations. You know what context windows are, why latency matters, and how fragile the magic of “AI that just works” really is. This document explains what we’re building, the hard problems we’re solving, and the architectural decisions that make real-time voice AI actually work.The Challenge: AI in Real-Time
Why Voice AI Is Hard
Most AI applications have a luxury that voice doesn’t: time. When you’re using ChatGPT, Claude, or any chat interface, a 2-3 second response time is acceptable. You’re looking at a screen, maybe typing something else, and when the response appears, you read it. No problem. Voice doesn’t work that way. In a phone conversation, humans expect responses within 300-500ms. Anything longer feels like lag. Anything over 1.5 seconds feels like the other person isn’t listening. Over 2 seconds, people start saying “Hello? Are you there?” The entire voice AI pipeline — speech recognition, language model inference, and speech synthesis — needs to complete in under a second. Every time. With no batching, no retry loops, no “please wait.”The Latency Budget
Here’s what we’re working with:The Architecture
High-Level Overview
Why This Stack?
GoToConnect — We have a grandfathered unlimited plan at $17/user. The critical insight is that GoToConnect exposes a full WebRTC API with call control. We don’t need Twilio or Telnyx as intermediaries. LiveKit — The LiveKit Agents SDK is purpose-built for voice AI. It handles the gnarly parts: room management, track subscription, audio encoding, participant state. We focus on the AI logic. Deepgram — Lowest latency streaming STT available. They provide interim results (partial transcriptions) which we use to pre-warm the LLM context before the speaker finishes. Claude — Best reasoning capabilities for complex conversations. Streaming support. Native function calling. The system prompt + conversation history approach maps well to phone calls. Chatterbox — MIT-licensed, self-hostable on RunPod. Zero per-minute cost at scale. Sub-200ms TTFB with the Turbo model. Native paralinguistic tags ([laugh], [cough]).
The Hard Problems
1. Context Management
The problem: Phone calls can last 30 minutes or more. A typical customer service call might involve:- Initial greeting and identification
- Problem description
- Multiple back-and-forth clarifications
- Information lookup (account details, availability, etc.)
- Resolution or transfer
- Confirmation and goodbye
2. Barge-In (Interruption Handling)
The problem: Humans interrupt each other constantly. If the AI is mid-sentence and the caller starts talking, we need to:- Stop the AI’s audio immediately
- Capture what the caller is saying
- Incorporate the interruption naturally
3. Tool Calling Without Blocking
The problem: The AI needs to perform actions during the conversation — check calendars, look up account info, update CRM records. But API calls take time. If we wait for the tool to complete before responding, we introduce unacceptable latency. Our approach: Async tool execution with conversational bridging.4. Multi-Turn Conversation Coherence
The problem: Phone conversations meander. The caller might:- Start with one topic, switch to another, then return to the first
- Refer to things mentioned 5 minutes ago with pronouns (“Can you change that?”)
- Provide information incrementally across multiple turns
5. Graceful Degradation
The problem: In production, things fail. APIs time out. Services go down. Network connections drop. Unlike a web app where you can show an error page, a phone call has to keep going. Our approach: Multiple fallback layers for each component.6. The “Streaming Waterfall”
The problem: Each stage of the pipeline produces output incrementally. Connecting these stages efficiently is non-trivial. Our approach: asyncio queues connecting each stage.Why Self-Host TTS?
A quick note on our TTS choice, since this often comes up. The hosted TTS providers (ElevenLabs, Cartesia, PlayHT) charge $0.01-0.18 per minute. At scale, this dominates your cost structure. Chatterbox, self-hosted on an RTX A5000 (0.27/hour \= \~197/month), gives us effectively unlimited TTS for a fixed cost. At 50,000 minutes/month:
The A5000 runs Chatterbox-Turbo at better than real-time (RTF < 1.0), so a single GPU can handle many concurrent calls.
The tradeoff is operational complexity (we manage the GPU instance) and slightly higher latency than Cartesia (~150ms vs ~50ms TTFB). For our use case, the cost savings justify it.
Multi-Tenancy Considerations
This is a platform, not a single-use application. Multiple businesses use the same infrastructure, each with:- Their own phone numbers
- Their own AI personality and instructions
- Their own knowledge base
- Their own tools and integrations
- Their own usage limits and billing
Observability
Voice AI is hard to debug. When something goes wrong, you can’t just look at logs — you need to hear what happened. What we capture:- P50/P90/P99 mouth-to-ear latency
- Breakdown by stage (STT, LLM, TTS)
- Latency by tenant (to identify problematic configurations)
- Latency over time (to catch regressions)
- Turn count (more turns might indicate confusion)
- Interruption rate
- Transfer rate
- Call resolution rate (did we solve their problem?)
What We’re Not Building
To be clear about scope: Not a general-purpose voice assistant — We’re focused on business phone calls with structured objectives, not open-ended chat. Not a real-time translation service — English only for MVP. Multilingual is on the roadmap but not initial scope. Not a transcription service — We transcribe for our own use; we don’t expose STT as a standalone product. Not an LLM provider — We use Claude. We’re not training our own models. Not a TTS provider — We use Chatterbox. We’re not building voice synthesis technology. We’re building the integration layer that makes all of these work together for the specific use case of business phone calls.Open Research Questions
Things we’re still figuring out:1. Optimal token buffer size for TTS
We’re currently using ~20 tokens before triggering TTS. This is a tradeoff:- Too few tokens → Unnatural prosody, choppy speech
- Too many tokens → Higher latency
2. Pre-warming with interim transcripts
Deepgram provides interim (partial) transcripts before the speaker finishes. We could:- Pre-fetch relevant knowledge base content
- Prime the LLM context
- Speculatively start generating (and discard if the transcript changes)
3. Conversation summarization triggers
When do we summarize older turns? Options:- Fixed window (every N turns)
- Token budget exceeded
- Topic change detected
- Explicit “let me summarize” moment in conversation
4. Voice Activity Detection tuning
VAD determines when the caller stopped speaking. Too aggressive → We cut them off. Too conservative → Added latency. The optimal setting likely varies by:- Call type (quick Q&A vs. detailed explanation)
- Caller speech patterns (fast talker vs. slow)
- Audio quality (noisy environment vs. quiet)
Conclusion
Voice AI sits at the intersection of several hard problems:- Real-time systems (everything has to be fast)
- LLM applications (context management, tool use, coherence)
- Distributed systems (multiple services, failure handling)
- Telecommunications (audio codecs, telephony protocols)
Further Reading
If you want to go deeper:- LiveKit Agents documentation: https://docs.livekit.io/agents/
- Deepgram streaming guide: https://developers.deepgram.com/docs/streaming
- Anthropic streaming API: https://docs.anthropic.com/claude/reference/streaming
- Chatterbox GitHub: https://github.com/resemble-ai/chatterbox
- WebRTC fundamentals: https://webrtc.org/getting-started/overview
- aiortc (Python WebRTC): https://github.com/aiortc/aiortc
This document reflects the architecture as of 2026-01-16. Voice AI is moving fast — some details may evolve as we learn more in production.