Voice Agents
|
This content was generated with the assistance of AI and should be verified against the official documentation of each tool and framework before being relied on in production. This section’s bibliography lists the reference material consulted while preparing these pages. |
This sub-section was written on 2026-10-01 against LangChain 1.4.3 (with langchain-core 1.6.6 and langgraph 1.2.12)
and FastAPI 0.142.2 on Python 3.12, Spring AI 2.0.1 on Spring Boot 4.1.x with Java 21, Pipecat 1.12.0, LiveKit Agents
1.8.3, OpenAI GPT-Live (gpt-live-1) and the Realtime API (gpt-realtime-2.1), the Gemini Live API (gemini-3.8-live),
the ElevenLabs Python SDK 2.70.0, Twilio ConversationRelay and Media Streams, and Asterisk 23.5, 22.11 and 20.21; the full
list is in the version baseline below. Versions and model names were read from PyPI, npm, Maven
Central, GitHub releases and the vendors' own documentation on that date, and hosted model names change quickly, so every
page tells you which model page to check before you copy an identifier. The code on the pages is illustrative: it is
written from the official documentation of each platform and is not compiled by this repository. Real-time audio, Twilio
and Asterisk could not be tested here, and each page says in its lead paragraph which steps were documented from official
documentation only.
A retrieval-augmented assistant that only answers in a text box is not yet a product for people who are driving, cooking, walking through a warehouse or phoning a help line. The RAG Systems in Production sub-section builds the assistant, and Conversational Channels puts it behind chat surfaces. This sub-section adds the spoken channel: how audio gets to the assistant, how the answer gets back as speech quickly enough to feel like a conversation, and how that works in a browser and on a telephone.
Voice is not chat with a microphone
A text conversation tolerates a two-second pause, long answers, tables and links. A spoken conversation does not. People expect a reply to start within a second or so of finishing a sentence, they interrupt when the answer is wrong or too long, they cannot skim, and they cannot see a citation. Five consequences shape every page that follows:
-
Latency is the user experience. The time from the end of the user’s speech to the first audible word is a sum of network, end-of-turn detection, the model’s first token and the speech synthesiser’s first audio byte; each stage has to stream. The Voice Architectures page builds the budget.
-
Turn-taking is a feature, not a detail. Deciding when the user has finished, and stopping instantly when they interrupt, decides whether the agent feels attentive or rude. See Turn-Taking and Interruptions.
-
Answers are written for the ear. Short sentences, no markdown, numbers and identifiers spelled so that they can be spoken, and citations read as "according to the installation guide" rather than as links.
-
The channel is lossy. Telephone audio is 8 kHz mu-law, browsers add echo cancellation, and recognition errors propagate into retrieval, so the assistant must confirm what it understood when the stakes are high.
-
Recording and consent are legal matters. Calls are regulated differently in each jurisdiction; the production page links the rules rather than summarising them.
The idea: one core, many voices
Every page uses the same running scenario, call DocsAssistant. The assistant answers questions about this site’s documentation and its core is the same channel-agnostic operation used by the other sub-sections:
ask(conversationId, userId, text) -> stream of { token | citation | done }
Source: Serving RAG as an API (the operation and its streaming contract) and Channel-Agnostic Architecture (the same core behind chat channels).
The core is implemented twice, as in the RAG Systems sub-section: in Python with LangChain create_agent, a retriever
tool, a Postgres checkpointer and FastAPI, and in Java with the Spring AI ChatClient, the RAG advisor, JDBC chat memory
and Spring Boot. The voice layer sits in front of it and has to turn audio into the text argument and the token stream
back into audio. The scenario follows four paths:
-
Browser. A WebRTC voice widget on a documentation page speaks to a Pipecat or LiveKit worker, or directly to a realtime API.
-
ElevenLabs Agent. A hosted agent calls the DocsAssistant core as its custom LLM or as a tool.
-
Phone call through Twilio. First with ConversationRelay, where Twilio does the speech work and your WebSocket exchanges text; then with Media Streams, where raw audio goes through Pipecat or a hand-written Spring pipeline.
-
Company PBX. An Asterisk extension streams audio through External Media or
chan_websocketto a Python (Pipecat) or Java (Spring) voice service.
Choosing an approach
The table below turns the map into the questions that usually decide the matter.
| Question | Hosted voice platform | Realtime API | Open-source framework | Hand-rolled pipeline |
|---|---|---|---|---|
Examples |
ElevenLabs Agents |
OpenAI GPT-Live and Realtime, Gemini Live, Azure Voice Live |
Pipecat, LiveKit Agents |
Spring Boot or FastAPI with a WebSocket, VAD, STT, your LLM call and TTS |
Time to a first working agent |
Hours. |
Hours to days. |
Days. |
Weeks. |
Control of the speech models |
Chosen from the platform’s catalogue. |
One speech-to-speech model per vendor. |
Any STT, LLM and TTS service, hosted or local. |
Anything you can call. |
How the RAG core is reached |
Custom LLM endpoint, server tool or MCP tool. |
Function tools, remote MCP or a delegated backend. |
The LLM step of the pipeline, or a tool the LLM calls. |
A direct call between STT and TTS. |
On-premises or air-gapped |
No. |
No. |
Yes, with local models. |
Yes, with local models. |
Telephony |
Native Twilio integration and SIP trunking. |
SIP to the vendor, or a bridge through a partner. |
Twilio, Telnyx and other serializers, LiveKit SIP. |
Whatever you implement. |
What you operate |
Almost nothing. |
Session-minting endpoint and tools. |
Voice workers and their scaling. |
Everything, including turn detection and echo handling. |
Main cost driver |
Per conversation minute (see the platform’s pricing page). |
Per audio token or per second of audio. |
Model hosting plus per-minute STT and TTS. |
Model hosting plus your engineering time. |
Page |
Prices are deliberately not quoted: they change often and differ by plan and region, so each page links the vendor’s own pricing page and the production page gives the method for estimating cost per minute instead of figures.
Reading path
Read the pages in navigation order on a first pass. Shorter paths:
A voice widget on a web page
A phone number that answers questions
-
Telephony with Twilio, starting with ConversationRelay.
-
ElevenLabs Agents if you prefer a hosted agent with a native Twilio link.
An agent behind your company PBX
-
Speech to Text and Text to Speech for local models.
A fully on-premises agent
-
Speech to Text and Text to Speech, with the speech models catalogue.
-
Pipecat with faster-whisper, a local LLM and Kokoro.
-
Production Voice Agents for GPU sizing.
What’s covered
Foundations
-
Voice Architectures — cascaded, speech-to-speech and hybrid designs, where RAG fits in each, streaming every stage, sentence chunking and the latency budget.
-
Turn-Taking and Interruptions — voice activity detection, semantic turn detection, barge-in with history truncation, echo cancellation, DTMF and silence handling.
Speech models
-
Speech to Text — streaming versus batch, hosted and local recognisers, accuracy factors and the word error rate.
-
Text to Speech — streaming synthesis, voices and cloning, SSML, hosted and local voices with their licences, audio formats and resampling.
Hosted platforms
-
Realtime APIs — OpenAI GPT-Live and Realtime, Gemini Live and Azure Voice Live, ephemeral credentials, tools and remote MCP.
-
ElevenLabs Agents — agent configuration, a custom LLM pointing at the DocsAssistant core, tools, workflows, SDKs, Twilio and SIP.
Frameworks
-
Pipecat — pipelines and frames, services, transports, a LangChain agent as the LLM step, a fully local stack, Smart Turn and Flows.
-
LiveKit Agents — rooms, workers,
AgentSession, the turn detector, tools and LiveKit SIP. -
Building a Voice Pipeline by Hand — a minimal cascaded pipeline in Spring Boot and in Python asyncio, and what frameworks save you.
Web delivery
-
Voice in the Browser —
getUserMedia, WebRTC to a voice server, the WebSocket PCM alternative, the Web Speech API and mobile caveats.
Telephony
-
Telephony with Twilio — TwiML, ConversationRelay, Media Streams, outbound calls, transfer and signature validation.
-
Telephony with Asterisk and SIP — SIP trunks, ARI, External Media, AudioSocket,
chan_websocket, FreeSWITCH, Jambonz and security.
Operations
-
Production Voice Agents — scaling, GPUs, cost per minute, recording and consent, PII, observability, testing, human fallback and accessibility.
Cheat sheet
-
Cheat Sheet (PDF) — a one-page A4 summary.
LLMOps & Evaluation covers evaluating and operating voice agents in production; AI Security & Responsible AI covers prompt injection and governance for them.
Version baseline
Every version below was read on 2026-10-01 from PyPI, npm, Maven Central, Hugging Face or GitHub releases, or from the vendor’s own documentation. Each page repeats the subset it uses in its lead paragraph; if a page and this table ever disagree after an update, this table wins.
| Area | Versions |
|---|---|
LangChain (Python) |
|
Web layer (Python) |
FastAPI 0.142.2; |
Spring AI |
2.0.1 through |
OpenAI |
Two voice APIs. GPT-Live (model |
Gemini Live API over WebSockets with function calling, session management and ephemeral tokens; the models page lists
|
|
Azure |
Voice Live API (speech recognition, generative model and speech synthesis behind one interface, with noise suppression, echo cancellation, semantic end-of-turn detection and avatars) and the Azure OpenAI realtime audio route; documented under Foundry Tools on Microsoft Learn. |
ElevenLabs |
ElevenAgents documentation under |
Pipecat |
|
LiveKit |
|
Other frameworks |
TEN Framework 0.11.73 and TEN VAD 1.0; Kyutai Unmute and Moshi (the |
Speech to text |
|
Text to speech |
Kokoro-82M (Apache-2.0); Piper through |
Twilio |
Programmable Voice with |
Asterisk |
Current releases 23.5.0, 22.11.0 and 20.21.0 (a 24.0.0 release candidate exists). The |
Other telephony |
Jambonz (its |
Web platform |
Browser APIs as specified by the W3C WebRTC recommendation, MDN for |
Where the books are out of date
No requester-provided book covers real-time voice in depth. Only the chapters named in the bibliography are used, and only for concepts. The differences that matter:
-
Spring AI audio. Spring AI in Action (Chapter 8) targets Spring AI 1.0. In 2.0
TranscriptionModelextendsStreamingTranscriptionModel, the text-to-speech interfaces areTextToSpeechModelandStreamingTextToSpeechModel(theSpeechModelof the book is gone), OpenAI speech streams real chunks, ElevenLabs is a provider, and the Azure OpenAI module was removed. The pages show the current API. -
Hugging Face pipelines. Hugging Face in Action covers ASR pipelines and Gradio audio widgets; the speech catalogue and current idioms live on the speech models page.
-
Real-time voice. Turn-taking, barge-in, realtime APIs, WebRTC audio and telephony are not covered by any of the five books; those pages rely on official documentation alone.
-
OpenAI. Anything written about the Realtime API before 2026 describes the earlier preview models and event names; GPT-Live is a newer, separate API. The Realtime APIs page follows the current documentation.
Bibliography
The following sources were consulted while preparing the pages of this sub-section. Every code example was written from
the current official documentation of the platform it uses — never copied from a book. Every documentation page cited on
the pages is listed here once. All links below were requested on 2026-10-01 and resolved, except the two oreilly.com
publisher pages, which answer automated fetches with an HTTP 403 response. Several addresses redirect to a newer location,
and this list gives the current one: the ElevenLabs custom LLM page moved from agents-platform to eleven-agents, the
OpenAI realtime SIP guide is now the Telephony and SIP guide, the Pipecat Flows page moved under pipecat/flows, the
ElevenLabs examples repository is now elevenlabs/examples, and the Gemini ephemeral tokens page now lives under
live-api.
Requester-provided books
No requester-provided book covers real-time voice agents in depth. Only the chapters named below are consulted, for concepts. Their text and code are not reproduced; concepts are paraphrased and credited on the page that uses them.
-
Albada, Ben. Building Applications with AI Agents: Designing and Implementing Multiagent Systems. O’Reilly Media, 2025. ISBN 978-1-098-17650-1. Publisher page: https://www.oreilly.com/library/view/building-applications-with/9781098176495/. Chapter 3 (voice as a modality and synchronous experiences) consulted.
-
Lee, Wei-Meng. Hugging Face in Action. Manning Publications, 2026. ISBN 978-1-63343-671-8. Publisher page: https://www.manning.com/books/hugging-face-in-action. Official code repository: https://github.com/weimenglee/HuggingFaceInAction. Consulted for Gradio audio widgets and speech-recognition pipelines.
-
Mendelevitch, Ofer, and Forrest Sheng Bao. Hands-On RAG for Production: Design, Develop, and Deploy Production-Ready RAG Applications. O’Reilly Media, 2026. ISBN 979-8-341-62171-8. Publisher page: https://www.oreilly.com/library/view/hands-on-rag-for/9798341621701/. Official code repository: https://github.com/ofermend/hands-on-rag. Chapter 8 (audio and video RAG through Whisper) consulted.
-
Polzer, Dominik. RAG with Python Cookbook: Practical Recipes from Data Preprocessing to LLM Agents. O’Reilly Media, 2026. ISBN 979-8-341-60056-0. Publisher page: https://www.oreilly.com/library/view/rag-with-python/9798341600553/. Official code repository: https://github.com/polzerdo55862/RAG-with-Python-Cookbook. Chapter 3 (loading audio through transcription) consulted.
-
Walls, Craig. Spring AI in Action. Manning Publications, 2026. ISBN 978-1-63343-611-4. Publisher page: https://www.manning.com/books/spring-ai-in-action. Official code repository: https://github.com/habuma/spring-ai-in-action-samples. Chapter 8 (
TranscriptionModel, speech models and voices, audio input and output) consulted.
oreilly.com answers automated fetches with an HTTP 403 response, but the publisher pages above are live pages when
opened in a browser.
Official documentation
ElevenLabs
-
Agents overview: https://elevenlabs.io/docs/eleven-agents/overview
-
Custom LLM: https://elevenlabs.io/docs/eleven-agents/customization/llm/custom-llm
-
Knowledge base: https://elevenlabs.io/docs/eleven-agents/customization/knowledge-base
-
Tools: https://elevenlabs.io/docs/eleven-agents/customization/tools
-
Native Twilio integration: https://elevenlabs.io/docs/eleven-agents/phone-numbers/twilio-integration/native-integration
-
SIP trunking: https://elevenlabs.io/docs/eleven-agents/phone-numbers/sip-trunking
-
WebSocket API: https://elevenlabs.io/docs/eleven-agents/libraries/web-sockets
-
Text to speech: https://elevenlabs.io/docs/overview/capabilities/text-to-speech
-
Examples: https://github.com/elevenlabs/examples
OpenAI
-
Voice agents (choosing an architecture): https://developers.openai.com/api/docs/guides/voice-agents
-
Getting started with GPT-Live: https://developers.openai.com/api/docs/guides/live
-
Getting started with the Realtime API: https://developers.openai.com/api/docs/guides/realtime
-
gpt-realtimemodel: https://developers.openai.com/api/docs/models/gpt-realtime -
Voice over WebRTC: https://developers.openai.com/api/docs/guides/voice-webrtc
-
Telephony and SIP: https://developers.openai.com/api/docs/guides/voice-sip
-
Realtime with tools: https://developers.openai.com/api/docs/guides/realtime-mcp
-
Agents SDK voice agents: https://openai.github.io/openai-agents-js/guides/voice-agents/
-
Gemini Live API: https://ai.google.dev/gemini-api/docs/live-api
-
Gemini Live ephemeral tokens: https://ai.google.dev/gemini-api/docs/live-api/ephemeral-tokens
-
Gemini Live model: https://ai.google.dev/gemini-api/docs/models/gemini-3.8-live
Azure
-
Voice Live: https://learn.microsoft.com/en-us/azure/ai-services/speech-service/voice-live
-
Azure OpenAI realtime audio: https://learn.microsoft.com/en-us/azure/foundry/openai/how-to/realtime-audio
-
Azure Speech: https://learn.microsoft.com/en-us/azure/ai-services/speech-service/
Pipecat
-
Documentation: https://docs.pipecat.ai/overview/introduction
-
Pipecat Flows: https://docs.pipecat.ai/pipecat/flows/introduction
-
Smart Turn: https://github.com/pipecat-ai/smart-turn
-
Repositories: https://github.com/pipecat-ai/pipecat and https://github.com/pipecat-ai/pipecat-examples
LiveKit
-
Agents documentation: https://docs.livekit.io/agents/
-
Turn handling: https://docs.livekit.io/agents/logic/turns/
-
Telephony: https://docs.livekit.io/telephony/
-
Repositories: https://github.com/livekit/agents, https://github.com/livekit/agents-js and https://github.com/livekit/livekit
Other open-source frameworks and voice activity detection
-
TEN Framework: https://github.com/TEN-framework/ten-framework
-
Kyutai Unmute: https://kyutai.org/unmute/
-
Kyutai Moshi: https://github.com/kyutai-labs/moshi
-
Silero VAD: https://github.com/snakers4/silero-vad
Speech to text
-
Whisper: https://github.com/openai/whisper
-
faster-whisper: https://github.com/SYSTRAN/faster-whisper
-
whisper.cpp: https://github.com/ggml-org/whisper.cpp
-
Moonshine: https://github.com/moonshine-ai/moonshine
-
NVIDIA Parakeet: https://huggingface.co/nvidia/parakeet-tdt-0.6b-v3
-
Deepgram Flux: https://developers.deepgram.com/docs/flux/quickstart
-
AssemblyAI streaming: https://www.assemblyai.com/docs/streaming/getting-started/transcribe-streaming-audio
Text to speech
-
Piper (GPL fork): https://github.com/OHF-Voice/piper1-gpl
-
Coqui TTS (idiap fork): https://github.com/idiap/coqui-ai-TTS
-
XTTS-v2 model licence: https://huggingface.co/coqui/XTTS-v2
-
Sesame CSM: https://github.com/SesameAILabs/csm
Spring AI
-
Audio: https://docs.spring.io/spring-ai/reference/api/audio.html
-
Transcriptions: https://docs.spring.io/spring-ai/reference/api/audio/transcriptions.html
-
Speech: https://docs.spring.io/spring-ai/reference/api/audio/speech.html
-
ElevenLabs speech: https://docs.spring.io/spring-ai/reference/api/audio/speech/elevenlabs-speech.html
LangChain
Web platform
-
getUserMedia: https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia -
RTCPeerConnection: https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection -
AudioWorklet: https://developer.mozilla.org/en-US/docs/Web/API/AudioWorklet
-
Web Speech API: https://developer.mozilla.org/en-US/docs/Web/API/Web_Speech_API
-
aiortc: https://github.com/aiortc/aiortc
Twilio
-
Media Streams: https://www.twilio.com/docs/voice/media-streams
-
Media Streams WebSocket messages: https://www.twilio.com/docs/voice/media-streams/websocket-messages
-
ConversationRelay: https://www.twilio.com/docs/voice/conversationrelay
-
ConversationRelay WebSocket messages: https://www.twilio.com/docs/voice/conversationrelay/websocket-messages
-
ConversationRelay best practices: https://www.twilio.com/docs/voice/conversationrelay/best-practices
-
Twilio Java SDK: https://github.com/twilio/twilio-java
Asterisk
-
ARI Channels REST API: https://docs.asterisk.org/Latest_API/API_Documentation/Asterisk_REST_Interface/Channels_REST_API/
-
ARI configuration: https://docs.asterisk.org/Configuration/Interfaces/Asterisk-REST-Interface-ARI/
-
External Media and ARI: https://docs.asterisk.org/Development/Reference-Information/Asterisk-Framework-and-API-Examples/External-Media-and-ARI/
-
AudioSocket: https://docs.asterisk.org/Configuration/Channel-Drivers/AudioSocket/
-
WebSocket channel driver: https://docs.asterisk.org/Configuration/Channel-Drivers/WebSocket/
-
Examples: https://github.com/asterisk/asterisk-websocket-examples and https://github.com/asterisk/asterisk-external-media
Other telephony
-
mod_audio_stream(third-party FreeSWITCH module): https://github.com/amigniter/mod_audio_stream -
Jambonz: https://docs.jambonz.org/welcome
-
Vonage WebSockets: https://developer.vonage.com/en/voice/voice-api/concepts/websockets
WebRTC in Java
-
Jitsi Videobridge: https://github.com/jitsi/jitsi-videobridge
Specifications and standards
-
RFC 3261, SIP: Session Initiation Protocol: https://www.rfc-editor.org/info/rfc3261/
-
RFC 3550, RTP: A Transport Protocol for Real-Time Applications: https://www.rfc-editor.org/info/rfc3550/
-
RFC 8825, Overview: Real-Time Protocols for Browser-Based Applications: https://www.rfc-editor.org/info/rfc8825/
-
W3C, WebRTC 1.0: Real-Time Communication Between Browsers: https://www.w3.org/TR/webrtc/
Papers and engineering articles
-
Radford et al., Robust Speech Recognition via Large-Scale Weak Supervision (Whisper): https://arxiv.org/abs/2212.04356
-
Défossez et al., Moshi: a speech-text foundation model for real-time dialogue: https://arxiv.org/abs/2410.00037
-
LiveKit, turn detection in voice agents: https://livekit.com/blog/turn-detection-voice-agents-vad-endpointing-model-based-detection
-
Deepgram, introducing Flux: https://deepgram.com/learn/introducing-flux-conversational-speech-recognition
The requester-provided books are consulted references, not the primary source of any example on these pages. On any discrepancy between a book and the official documentation of a tool or framework, the official documentation is authoritative. No book PDF is committed or attached anywhere in this repository.
References
-
RAG Systems in Production — the assistant these voice agents expose.
-
Conversational Channels — the same core behind chat surfaces, including WebRTC data channels.
-
Hugging Face speech models — the catalogue of local recognisers and voices.
-
LangChain — Multimodality and Voice and Spring AI — Audio Transcription & Speech — the framework-side audio APIs.