hundreds-journalist-9108
09/08/2025, 7:27 AMtall-airline-16756
09/08/2025, 7:27 AMtall-airline-16756
09/08/2025, 7:28 AMhundreds-journalist-9108
09/08/2025, 7:30 AMtall-airline-16756
09/08/2025, 7:31 AMhundreds-journalist-9108
09/08/2025, 7:33 AMagent_session.output.audio = DataStreamAudioOutput(
room=room,
destination_identity=self._avatar_participant_identity,
sample_rate=SAMPLE_RATE,
wait_remote_track=rtc.TrackKind.KIND_VIDEO,
)
i'm trying to find an event or signal that tells me when it stops/ends talkingtall-airline-16756
09/08/2025, 7:34 AMDataStreamAudioOutput, you can simply listen for the playback_finished event from the audio output instance. This event fires as soon as the avatar confirms that the audio playback is done.
Here’s a quick example to get you started:
@session.output.audio.on("playback_finished")
def on_playback_finished(ev: PlaybackFinishedEvent) -> None:
logger.info(
"playback_finished",
extra={
"playback_position": ev.playback_position,
"interrupted": ev.interrupted,
},
)
This event gives you:
• playback_position: The exact time (in seconds) when playback wrapped up.
• interrupted: A True/False flag showing if the playback got cut off early.
With this, you can easily sync up your app’s next steps or keep the conversation flowing smoothly once the avatar is done talking. If you want me to walk you through anything else, just let me know—I’m here to help!
Sources: livekit-agents/livekit/agents/voice/agent_session.py | Bringing AI avatars to voice agents | How to detect when an agent has finished speakinghundreds-journalist-9108
09/08/2025, 7:54 AMtall-airline-16756
09/08/2025, 7:54 AMhundreds-journalist-9108
09/08/2025, 8:04 AM