crooked-dawn-90821
09/23/2025, 9:49 AMtall-airline-16756
09/23/2025, 9:49 AMtall-airline-16756
09/23/2025, 9:50 AMSpeechHandle object, which you get from methods like say() or generate_reply(). This handy object helps you coordinate so that the TTS audio finishes playing before any tools start executing.
Here’s a simple way to do it:
• First, capture the SpeechHandle when you start the TTS.
• Then, use await handle.wait_for_playout() or await speech_handle.wait_if_not_interrupted([audio_output.wait_for_playout()]) to pause your process until the TTS audio has fully played.
This approach ensures your client-side tools kick in only after the TTS has wrapped up, keeping everything in the right order and avoiding any interruptions. If you need any more help with this, feel free to ask—I’m here to support you!
Sources: livekit-agents/livekit/agents/voice/agent_activity.py | agents/src/voice/agent_activity.ts | Agent speech and audio | LiveKit Docs