Loading…
Topic
Conversation Relay
7 posts about Conversation Relay. Every summary links to the original.
- 7 posts
- 1 company
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
Newest first
Posts
How to Build a Production Voice AI agent: A Reference Architecture
A production voice AI agent requires more than a model and prompt; callers expect fluid conversation, interruption handling, and safe system actions. Twilio provides the Conversations Layer for Voice AI, handling connectivity, call control, speech, turn-taking, shared context, and handoff infrastructure. The customer builds and owns the agent runtime, including models, prompts, tools, guardrails, and business logic. Twilio’s six rules for AI agents include being agentic where possible and deterministic where required, keeping authority out of the model, and testing the agent like code. The architecture is designed to maximize the number of calls the agent resolves independently, with clean handoff to a human when needed.
Using Conversation Relay for Graceful AI to Human Handoff
A 2026 statistic shows 65% of AI-to-human handoffs still require customers to repeat themselves. Twilio Conversation Relay addresses this by preserving call context during the transfer. The tutorial builds a .NET web application that uses an OpenAI-powered AI agent to handle initial calls. When the caller requests a human, the AI generates a conversation summary and stores it as TaskAttributes in Twilio TaskRouter. The call is then seamlessly handed off to a human agent along with the stored context. The solution uses ngrok for local tunneling and requires a Twilio account with a voice-enabled phone number.
Built for Banking, Powered by Twilio: The Next Generation of Voice AI for Banks and Credit Unions
Legacy IVR systems in banking put the burden on customers, creating frustrating experiences despite being cost-effective on paper. Voice AI for banking must meet three strict requirements: deep understanding of banking operations, security and compliance as foundations, and natural human-like conversation without awkward delays. Posh AI, which works exclusively with banks and credit unions and powers 40-50 million conversations annually across 150+ institutions, partnered with Twilio and migrated its voice streams to Conversation Relay. The migration improved speech recognition accuracy, eliminated dead air and premature interruptions, and enabled audience playback during AI processing, making interactions feel natural. Clients reported significant results: Citadel Credit Union saved over $663,000 in a year and increased NPS by six points, while other institutions replaced legacy phone systems entirely and saw caller “thank you” rates grow four to five times.
Best Practices for Conversation Relay Provider Failover
Twilio Conversation Relay uses separate third-party providers for transcription (ASR) and text-to-speech (TTS), each of which can fail under high load or during outages. To maintain uninterrupted Voice AI calls, developers must implement an application-level failover strategy that switches providers when errors occur. Failures manifest differently depending on timing: startup failures end the session with an ErrorCode, while mid-call TTS failures keep the call alive and require the WebSocket server to detect the error and send an end message with handoffData. The action URL handler must branch on specific error codes (64114 for ASR, 64111/64112 for TTS) and return new TwiML with alternative providers. To prevent infinite loops, the strategy limits retry attempts, changes providers on each attempt, and includes a final fallback that does not use Conversation Relay, such as or .
Integrate Claude, Anthropic’s AI Assistant, with Twilio Voice Using Conversation Relay
Twilio’s Conversation Relay enables real-time voice applications with AI LLMs over a WebSocket connection. This tutorial demonstrates integrating Claude, Anthropic’s AI model, with Twilio Voice using Conversation Relay. The setup uses a Node.js server with Fastify, the Anthropic SDK, and a system prompt that instructs the model to spell out numbers and avoid special characters for better text-to-speech. The server exposes two endpoints: /twiml for TwiML instructions and /ws for the WebSocket relay. The tutorial tests the integration with Claude Sonnet 5.5 and Haiku 5.5 at low effort, both handling real-time voice well. The result is a functioning voice assistant that can be called via a Twilio phone number.
Add Token Streaming and Interruption Handling to a Twilio Voice Anthropic Integration
This tutorial extends a basic Twilio Conversation Relay voice assistant that uses Anthropic Claude in Node.js by adding token streaming and interruption-aware conversation tracking. The author replaces the aiResponse() function with aiResponseStream(), which uses anthropic.messages.stream() to receive content_block_delta text chunks and forwards each token to Conversation Relay with last: false before sending an empty final token with last: true. The prompt handler now awaits the streamed response and pushes the assistant role and content into local session storage. To handle interruptions, the app listens for Conversation Relay interrupt messages and uses utteranceUntilInterrupt to find the last assistant message containing the heard text, truncating that message and removing later assistant turns so the model knows how far the caller heard. Testing requires an ngrok tunnel, a Twilio number configured with a /twiml webhook, and a phone call to verify the changes.
How to Test and Fix Voice AI Agent Prompts with Twilio Conversation Relay and Cekura
This tutorial demonstrates building a voice AI agent with Twilio Conversation Relay, Node.js, and the OpenAI API, then testing and fixing its prompts using Cekura automated platform, a Twilio Startup Searchlight award winner. Conversation Relay manages real-time voice tasks like speech-to-text, text-to-speech, interruption detection, and turn management over WebSockets, while developers control business logic, tools, and AI integration. Cekura defines evaluation metrics, generates test conversations with realistic caller scenarios—interruptions, topic changes, and unexpected requests—and runs baseline tests to uncover prompt gaps. After analyzing failure reports, developers update the system prompt and re-run tests; fixing a fee-waiver bug raised the pass rate from below 70% to the 90-95% target in one refinement. The tutorial emphasizes that prompts are source code requiring version control and automated testing for reliable voice AI agent behavior.
Related topics
All topics →Weekly digest
The best engineering reads, once a week.