RealtimeAgent: Low-latency live voice conversations
When RealtimeAgent beats STT -> LLM -> TTS chains
Chaining separate transcription, LLM, and TTS APIs adds 2–4 seconds of awkward pause between every sentence. RealtimeAgent connects directly to streaming speech-to-speech models over WebSockets for sub-second conversational turn-taking.
Example
from praisonai import RealtimeAgent
voice_bot = RealtimeAgent(
name='Receptionist',
instructions='Greet callers warmly in under 2 short sentences.',
)
# Run inside an async voice session with live audio credentials:
# await voice_bot.start()Example explained
- RealtimeAgent — Manages bidirectional streaming audio sessions with interruption handling.
- under 2 short sentences — Voice prompts must stay brief — long paragraphs feel unnatural when spoken aloud.
Design rules for voice-first prompts
Never ask a voice agent to read URLs, long JSON blobs, or numbered 10-item tables. Keep replies conversational, confirm key details (like dates or order numbers), and hand heavy visuals to a companion screen.
Common pitfall: attaching slow synchronous tools to a live voice loop
A 6-second database query causes dead air on a phone call. Keep voice tools under 500ms or speak a quick filler acknowledgment while fetching.
Reference: documentation