agreeable-dream-41746
10/10/2025, 9:49 PMtall-airline-16756
10/10/2025, 9:51 PMtall-airline-16756
10/10/2025, 9:52 PMconversation_item_added event usually fires after both text generation and TTS processing are done. But if you're looking to detect when text generation finishes on its own, without waiting for TTS playback, here are a few friendly tips you can try:
• Keep an Eye on SpeechHandle Generation: You can use the SpeechHandle class to know exactly when text generation wraps up. For instance, hooking into the _mark_generation_done() method is a great way to catch that moment.
• Watch Real-time Text Channels: Monitoring text channels like text_ch lets you see incremental updates as they happen. Once generation is complete, a completion signal will be sent your way.
• Use Transcription Nodes: These are super handy for gathering generated text in real time, so you get access to the text as it’s created.
When you want to grab the generated text, you can pull it from the conversation_item_added event payload, or try enabling use_tts_aligned_transcript in your session config to get TTS-aligned transcription forwarding.
If you’d like me to walk you through any of these steps or if you have more questions, just let me know—I’m here to help!
Sources: livekit-agents/livekit/agents/tts/stream_pacer.py | How to capture real-time agent transcriptions during conversations | Events and error handling | LiveKit Docs | Text and transcriptions | LiveKit Docs | How to detect when an agent has finished speakingagreeable-dream-41746
10/10/2025, 9:56 PMtall-airline-16756
10/10/2025, 9:57 PMsync_transcription=False in RoomOutputOptions.
If you’d like a hand with setting this up or customizing the transcription node further, please don’t hesitate to reach out—I’m here to help!
Sources: Text and transcriptions | LiveKit Docs | livekit-agents/livekit/agents/voice/transcription/synchronizer.py | Pipeline nodes and hooks | LiveKit Docsagreeable-dream-41746
10/10/2025, 9:59 PMtall-airline-16756
10/10/2025, 10:00 PMsync_transcription=False in the transcription node doesn’t directly tell us when text generation is finished. What it does is make sure transcriptions are sent right away as they become available, without waiting to sync up with the audio playback. The actual completion of text generation is tracked internally, using methods like _mark_current_generation_done() or flags such as turn_complete.
2. The text_ch (text channel) helps by signaling completion through closing the channel once text generation is done. Sometimes, an empty string is sent just before the channel closes. Plus, text_ch gives you the generated text bit by bit as it’s created, so you can access partial results during the process.
If you’d like me to walk you through this further or help with the implementation, just let me know—I’m here to help!
Sources: Text and transcriptions | LiveKit Docs | livekit-plugins/livekit-plugins-ultravox/livekit/plugins/ultravox/realtime/... | How to detect when an agent has finished speakingagreeable-dream-41746
10/10/2025, 10:02 PMtall-airline-16756
10/10/2025, 10:03 PMtext_ch would work well in your situation. I'm here to help!agreeable-dream-41746
10/10/2025, 10:04 PMtall-airline-16756
10/10/2025, 10:04 PM