How to stop current agent speech?
# ask-ai
f
How to stop current agent speech?
t
Thanks for reaching out, Taras. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It sounds like you want to interrupt the agent while it’s speaking. You have a few options: • Programmatically interrupt the session: call
session.interrupt()
to stop the current and queued speeches. You can force it to ignore
allow_interruptions
if needed. Docs • Interrupt a specific utterance: keep the
SpeechHandle
returned by `say()`/`generate_reply()` and call its interrupt/cancel method. You can also check
session.current_speech
to access the active handle. Guide • Let users interrupt by speaking: by default, the agent stops when user speech is detected (turn detection). Details If you’d like, I can share a minimal code snippet (Python or Node) for your setup. Sources: Agent Session & Client Integration | livekit/livekit_composite | DeepWiki | Agent speech and audio | LiveKit docs | Turn detection and interruptions | LiveKit Docs | How to detect when an agent has finished speaking
f
How can I can force it to ignore
allow_interruptions?
t
You’re asking how to interrupt even when
allow_interruptions=False
. • Use a forced session interrupt: call
session.interrupt()
in “force” mode to stop the current and queued speeches regardless of
allow_interruptions
. Details • Alternatively, interrupt via your orchestration layer with a forced interrupt (equivalent behavior): it cancels preemptive generation, stops current/queued/background speeches, and updates context. If you want a code snippet, tell me your language (Python or Node).
f
How do I interrupt a specific utterance?
t
It sounds like you want to stop just one utterance. You can interrupt the specific
SpeechHandle
for that utterance: • If you kept the handle from `say()`/`generate_reply()`, call its interrupt method (or cancel) to stop only that speech. You can also check
handle.interrupted
or await
handle.done()
. • If you don’t have the handle, use
session.current_speech
to get the active one and interrupt it there. For a global stop (affects current and queued speeches), use
session.interrupt()
. To override
allow_interruptions
, call the interrupt in forced mode. Would you like a short code snippet in Python or Node? See: Agent speech and audio, Turn detection and interruptions. Sources: Agent Session & Client Integration | livekit/livekit_composite | DeepWiki | Turn detection and interruptions | LiveKit Docs | Agent speech and audio | LiveKit docs