wooden-beard-26644
08/18/2025, 1:53 PMtall-airline-16756
08/18/2025, 1:53 PMtall-airline-16756
08/18/2025, 1:53 PMcurrent_speech
property of the AgentSession
. Here’s a quick example to help you out:
current_speech = ctx.session.current_speech
if current_speech and not current_speech.done():
print("Agent is currently speaking.")
else:
print("Agent is not speaking.")
Here’s a little breakdown:
• `current_speech`: This gives you the active SpeechHandle
, or None
if the agent isn’t speaking at the moment.
• `done()`: This tells you if the speech has finished. If it returns False
, that means the agent is still talking.
So, with this, you can easily check if the agent is speaking and decide what to do next. Hope this helps!wooden-beard-26644
08/18/2025, 4:35 PMtall-airline-16756
08/18/2025, 4:36 PMawait
the `SpeechHandle`:*`handle = session.say("Your message here.")
await handle`This will pause things until the speech is done playing.
2. *Or use the wait_for_playout()
method:*`handle = session.generate_reply(instructions="Your instructions here.")
await handle.wait_for_playout()`This one waits for the whole assistant turn to finish playing, including any wrap-up steps.
Either way, you’ll make sure the speech finishes before moving on.
Sources: Agent speech and audio | LiveKit Docs | Agent speech | LiveKit Docs