Why I can't interrupt cascaded model. It says `rai...
# ask-ai
i
Why I can't interrupt cascaded model. It says
raise RuntimeError("This generation handle does not allow interruptions")
t
Thanks for reaching out, Jan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The error
raise RuntimeError("This generation handle does not allow interruptions")
occurs when you attempt to interrupt a speech or generation handle that was created with
allow_interruptions=False
. This setting prevents interruptions for critical speech segments. To allow interruptions, ensure that you set
allow_interruptions=True
when creating the speech handle. For example:
Copy code
await session.say("This speech can be interrupted", allow_interruptions=True)
If you need to change this setting on an existing handle, you can set:
Copy code
handle.allow_interruptions = True
For cascaded or realtime models with server-side turn detection, interruptions are always enabled and you cannot set
allow_interruptions=False
. If you require non-interruptible speech in these cases, you must disable server-side turn detection and use VAD instead. Before attempting to interrupt, check if the current speech handle allows interruptions:
Copy code
if session.current_speech and not session.current_speech.allow_interruptions:
    print("Current speech cannot be interrupted")
Set
allow_interruptions=True
before calling
interrupt()
to avoid this error. Sources: livekit-agents/livekit/agents/voice/events.py | Agent speech and audio | LiveKit Docs
i
It's after
self.session.commit_user_turn
. After that, I tried
self.session.interrupt()
and the log says
Copy code
WARNING livekit.agents - 2025-07-22 01:28:35,062 - WARNING livekit.agents - skipping reply to user input, current speech generation cannot be interrupted
How can I interrupt the speech generated by commit_user_turn? I am using cascaded model
t
Hey there! Let me break down how speech interruptions work with
commit_user_turn
. It's pretty straightforward – by default, it follows the session or agent's
allow_interruptions
setting. If interruptions aren't allowed, any attempts to interrupt will be quietly skipped with a quick warning. Want to make sure you can interrupt speech smoothly in a cascaded model? I've got you covered with a few friendly approaches: • Set
allow_interruptions=True
at the session or agent level
when you're creating your session. This makes all generated speech – including from
commit_user_turn
– totally interruptible:
session = AgentSession(allow_interruptions=True, ...)
• Manually enable interruptions on the current speech handle right before you want to interrupt:
Copy code
if session.current_speech:
    session.current_speech.allow_interruptions = True
    session.interrupt()
• Manual interruption via
session.interrupt()
is always an option
, no matter what the
allow_interruptions
setting says. This will stop the current speech and any speech waiting in line. Pro tip: For the most reliable interruption after
commit_user_turn
, I recommend either setting
allow_interruptions=True
in your session config or quickly updating the current speech handle's
allow_interruptions
property before interrupting. Easy peasy! Sources: Agent speech and audio | LiveKit Docs | livekit-agents/livekit/agents/voice/agent_activity.py | VoicePipelineAgent | LiveKit Docs
i
I tried your suggestions
Copy code
self.session.commit_user_turn(
    transcript_timeout=20
)
if self.session.current_speech:
    self.session._activity._current_speech.allow_interruptions = True
    self.session.interrupt()
await self.session.generate_reply(
    user_input=NOT_GIVEN,  # no user input in cascaded model to work correctly
    instructions="Generate an interruption script because the user is speaking too long. ",
    tool_choice=tool_choice,
    allow_interruptions=False,  # has to be False for cascaded API to work correctly
)
The error is still the same as above. Not easy peasy
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
i
Try looking again