can you queue an agent.say message to speak after ...
# ask-ai
c
can you queue an agent.say message to speak after the user finishes speaking, this way it doesn't interrupt the user's train of thought?
t
Thanks for reaching out, dexter. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're asking whether an
agent.say
can be queued so it plays only after the user finishes speaking — yes. What you can do • Outgoing speech is automatically queued when the user is speaking if
allow_interruptions=True
(default). The agent will wait until the user's turn ends (VAD/STT or a custom turn detector) before playing queued speech. • To force immediate replacement of agent speech, call
session.interrupt()
. • To coordinate explicitly, listen for the user's turn end (e.g.,
UserStateChangedEvent
where
new_state == "listening"
) or use the
SpeechHandle
returned by
say()
to manage timing and playback. If you want, tell me which SDK/lang you're using (JavaScript, Python, or server-side) and I’ll provide a short code example. Sources: Turn detection and interruptions | LiveKit Docs | Agent speech and audio | LiveKit docs
c
so if i do agent.say(allow_interruptions = true) and the user is speaking while this is called. It will be read after the user stops speaking?
t
Yes — if you call
agent.say(allow_interruptions = true)
while the user is speaking, the message will be queued and played after the user stops speaking (turn end detected via VAD/STT or your turn detector). If you’d like, I can show a short code example for JavaScript or Python to illustrate using
SpeechHandle
or listening for
UserStateChangedEvent
.