Skip to main content
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:
Notice that nowhere in this pipeline can we afford to wait for a full response. Everything streams.

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
That’s a lot of conversation turns. At ~100 tokens per exchange, a 20-minute call could accumulate 8,000+ tokens of conversation history — and that’s before we add the system prompt, knowledge base content, and function calling schemas. Our approach:
For long calls, we implement a summarization strategy:
This keeps the context window manageable while preserving the information needed for coherent conversation.

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:
  1. Stop the AI’s audio immediately
  2. Capture what the caller is saying
  3. Incorporate the interruption naturally
Our approach:
The key insight is that interruption is not an error. It’s natural conversational flow. The AI should handle it gracefully:

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.
For truly slow operations, we use a conversational stall pattern:

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
The AI needs to maintain coherent understanding across all of this. Our approach: Structured conversation state alongside raw history.
This structured state is injected into the system prompt, giving Claude explicit access to “what we know so far” beyond just the raw conversation history.

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.
The goal is that the caller never knows something went wrong. They might experience slightly degraded quality (slower response, different voice), but the call continues.

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.
The tricky part is token buffering for TTS. You can’t synthesize a single token like “The” — you need enough text for natural prosody. But you also can’t wait too long or latency suffers. We’ve found ~20 tokens is a good balance.

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
Isolation strategy:
Resource isolation: For now, tenants share infrastructure (same LiveKit Cloud, same RunPod instance). If a tenant needs guaranteed capacity or isolation, we duplicate the infrastructure stack for them (at premium pricing).

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:
Latency dashboards show:
  • 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)
Conversation quality metrics:
  • 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
Is there a smarter approach? Sentence boundary detection? Prosodic phrase detection?

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)
How aggressive should we be? What’s the wasted compute vs. latency savings tradeoff?

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
What preserves coherence best?

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)
Can we adapt dynamically?

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)
The current generation of AI models (Claude, GPT-4) are good enough to have useful conversations. The speech technology (Deepgram, Chatterbox) is good enough to sound natural. The infrastructure (LiveKit, WebRTC) is good enough for real-time. What’s been missing is the integration layer that puts it all together with the right latency, reliability, and cost structure for production use. That’s what we’re building.

Further Reading

If you want to go deeper:
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.