Voice enables agents to communicate through natural speech, supporting real-time voice conversations, voice commands, and audio-based interactions.
Overview
The Voice primitive transforms text-based agents into voice-enabled conversational AI systems. With built-in speech-to-text (STT) and text-to-speech (TTS) capabilities, agents can understand spoken language and respond with natural-sounding speech, enabling hands-free interactions and accessibility features. Voice is essential for:- Voice Assistants: Build Alexa/Siri-style voice interfaces
- Phone Systems: Create AI-powered phone support and IVR systems
- Accessibility: Make applications accessible to visually impaired users
- Hands-Free Interactions: Enable voice commands for hands-free operation
- Natural Conversations: Provide more natural, human-like interactions
- Multilingual Support: Communicate in multiple languages with native accents
Real-Time STT
Convert speech to text in real-time with high accuracy and low latency
Natural TTS
Generate natural-sounding speech in multiple voices, languages, and accents
Voice Streaming
Stream audio input and output for low-latency conversational experiences
Voice Customization
Customize voice characteristics, speed, pitch, and speaking style
How Voice Works
When you enable voice for an agent:- Audio Input: User speaks into microphone or phone
- Speech-to-Text: Audio is transcribed to text in real-time
- Agent Processing: Agent processes text and generates response
- Text-to-Speech: Response is converted to natural speech
- Audio Output: Generated speech is played to user
- Streaming: For real-time conversations, audio streams continuously
Low Latency: Voice streaming enables natural conversation flow with minimal delay between speaking and response.
Voice Capabilities
Speech-to-Text (STT)
Convert spoken words to text:Text-to-Speech (TTS)
Generate natural speech from text:Code Examples
Basic Voice Conversation
Real-Time Voice Streaming
Voice with Multiple Languages
Custom Voice Characteristics
Phone Integration
Voice with Interruption Handling
Use Cases
1. Customer Service Phone System
AI-powered phone support:2. Voice-Enabled Personal Assistant
Hands-free assistant for daily tasks:3. Language Learning Tutor
Interactive language practice:4. Healthcare Voice Interface
Accessible medical information:5. Voice-Activated Navigation
Hands-free driving assistance:6. Conference Room Assistant
Meeting room voice control:Best Practices
Voice Design
Keep Responses Concise
Keep Responses Concise
Design for Interruptions
Design for Interruptions
Use Natural Language
Use Natural Language
Provide Audio Feedback
Provide Audio Feedback
Voice Selection
Error Handling
Privacy and Security
Integration with Other Primitives
With Memory
Remember conversation context:With Custom Tools
Access external services:With Multi-Agent
Transfer between voice agents:Performance Considerations
Latency Optimization
Bandwidth Management
Cost Management
Troubleshooting
Poor Audio Quality
Poor Audio Quality
Problem: Voice output sounds robotic or distortedSolutions:
- Increase sample rate (24kHz or 48kHz)
- Use neural voices instead of standard
- Check network bandwidth
- Reduce speed/pitch modifications
- Use appropriate audio format for medium
High Latency
High Latency
Problem: Delay between speaking and responseSolutions:
- Enable streaming for input and output
- Reduce endpointing delay
- Optimize agent response time
- Use closer geographic region
- Enable voice activity detection
Transcription Errors
Transcription Errors
Problem: Speech not transcribed correctlySolutions:
- Specify correct language
- Improve audio quality (reduce noise)
- Use appropriate dialect
- Add custom vocabulary
- Enable noise reduction
Interruption Not Working
Interruption Not Working
Problem: Agent continues speaking when interruptedSolutions:
- Enable interruptible output
- Configure interruption handling
- Reduce VAD sensitivity
- Check audio pipeline configuration
Advanced Features
Emotion Detection
Detect user emotion from voice:Voice Biometrics
Identify speakers by voice:Multi-Party Conversations
Handle multiple speakers:Related Primitives
Sessions
Maintain voice conversation context
Memory
Remember user preferences and history
Multi-Agent
Transfer between voice specialists
Custom Tools
Integrate external services in voice flows
Additional Resources
API Reference
Complete voice API documentation
Voice Design Guide
Best practices for voice UX
Examples
Voice integration examples