can i safely await session.say(..., allow_interrup...
# ask-ai
k
can i safely await session.say(..., allow_interruptions=False) from within a tool call?
t
Thanks for reaching out, Ethan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — good question. You're asking whether it's safe to
await session.say(..., allow_interruptions=False)
from inside a tool call. Yes — you can safely await
session.say(...)
from within a tool.
session.say()
returns a
SpeechHandle
that you can await to wait until the spoken audio finishes playing. Using
allow_interruptions=False
on that call ensures the particular utterance is not interrupted by user input while it playouts. If your tool is long-running and you want to prevent any user speech from interrupting any part of the tool (not just that single
say
), you can also call
run_ctx.disallow_interruptions()
at the start of the tool to enforce no interruptions for the tool's duration. Using both approaches together keeps behavior consistent: the
SpeechHandle
await lets your tool continue only after speech completes, and
run_ctx.disallow_interruptions()
prevents user input from interrupting the broader tool execution. If you want, tell me: • which SDK/language you're using, and • whether the tool needs to remain responsive to other events during the wait and I can provide a short code example or point out any subtle concurrency considerations for that environment. Sources: Agent speech and audio | LiveKit Documentation | Uninterruptable Agent | LiveKit Documentation | Tool definition and use | LiveKit Documentation