quiet-airline-99283
10/24/2025, 1:43 PMTo explicitly interrupt the agent, call theHowever, after runningmethod on the handle or session at any time. This can be performed even wheninterrupt()is set toallow_interruptions.False
interrupt() with allow_interruptions=False, I got the following error
This generation handle does not allow interruptionsHow to disable interruptions from the user while allowing programmatic interruptions?
tall-airline-16756
10/24/2025, 1:43 PMtall-airline-16756
10/24/2025, 1:43 PMAgent class, just set allow_interruptions=False. This way, user interruptions won’t disrupt the process, but you’ll still be able to interrupt programmatically using session.interrupt().
• Disable Interruptions for Specific Speech: If you want to prevent interruptions for particular speech segments, use allow_interruptions=False in methods like say() or generate_reply(). For example:
speech_handle = session.say("This will not be interrupted by the user.", allow_interruptions=False)
• Allow Programmatic Interruptions: You can still call interrupt() on the session or speech handle to interrupt programmatically, even when allow_interruptions is set to False. For example:
await session.interrupt()
By setting things up this way, you can comfortably disable user interruptions while keeping full control through your programmatic logic. If you have any questions or need further help, feel free to ask!
Sources: agents/src/voice/speech_handle.ts | Tool definition and use | LiveKit Docs | Turn detection and interruptions | LiveKit Docs | pipeline-llm/interrupt_user.py | livekit-agents/livekit/agents/voice/agent.pyquiet-airline-99283
10/24/2025, 1:45 PMThis generation handle does not allow interruptions
tall-airline-16756
10/24/2025, 1:46 PMSpeechHandle that was created with allow_interruptions=False, and the interrupt() method is being called without the force=True parameter. I completely understand how this can be a bit confusing!
Here are some friendly suggestions to help you work around this:
• Use `force=True`: You can call speech_handle.interrupt(force=True) to forcibly interrupt the speech, which will bypass the allow_interruptions restriction.
• Modify Interruptions Setting: Another option is to enable interruptions dynamically by setting speech_handle.allow_interruptions = True before calling interrupt(). This gives you more flexibility.
• Session-Level Interruption: If you want to interrupt all speech regardless of individual handle settings, try using session.interrupt(force=True).
By trying these approaches, you should be able to smoothly interrupt speech even when user interruptions are disabled. If you have any questions or need a hand with this, feel free to ask—I'm here to help!
Sources: livekit-agents/livekit/agents/voice/agent_activity.py | pipeline-llm/interrupt_user.py | Turn detection and interruptions | LiveKit Docs | Agent Session & Client Integration | livekit/livekit_composite | DeepWiki | agents/src/voice/speech_handle.ts