how to turn off allow intruption false for realtim...
# ask-ai
s
how to turn off allow intruption false for realtime agents
t
Thanks for reaching out, Rahul. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're asking how to disable interruptions for realtime agents — here are the ways you can do that. If you want to disable interruptions for a single utterance: • Python:
Copy code
await session.say("Hello, I cannot be interrupted.", allow_interruptions=False)
• TypeScript:
Copy code
await session.say('Hello, I cannot be interrupted.', { allowInterruptions: false });
To disable interruptions for an entire session: • Python:
Copy code
session = AgentSession(
  # ...other settings
  allow_interruptions=False
)
• TypeScript:
Copy code
const session = new voice.AgentSession({
  // ...other settings
  voiceOptions: { allowInterruptions: false }
});
Notes: • Real-time models with built-in turn detection may ignore
allow_interruptions
. • You can still force an interrupt programmatically using
session.interrupt()
or
handle.interrupt()
. • Interruption behavior also respects
min_interruption_duration
(default 0.5s) and
min_interruption_words
(default 0). Do you want the Python or TypeScript example adapted to your existing code or the session-level setting applied globally? Sources: Turn detection and interruptions | LiveKit Docs | examples/voice_agents | livekit/livekit_composite | DeepWiki
s
then what is allow early termination??
t
Regarding "allow early termination" — this setting controls whether the agent can stop its own speech output early when it determines the reply is complete, rather than always finishing the full generated audio. • Difference from "allow interruptions": ◦ allow_interruptions=False prevents external parties (users) from interrupting the agent's current speech. It blocks user-initiated interrupts. ◦ allow_early_termination lets the agent itself end its playback early when the model signals the response is finished (an internal stop), which can shorten silence or trailing audio. This is about the agent stopping its own output, not the user interrupting it. • Typical effects and notes: ◦ Enabling early termination can make conversations feel snappier by removing unnecessary trailing audio. ◦ Disabling it forces the agent to play the full generated audio even if the model would normally stop sooner. ◦ This setting applies to the agent's output behavior; it does not change the user interruption rules governed by
allow_interruptions
. If you’d like, tell me which SDK/method you’re using (
say()
,
generate_reply()
, or session-level settings and Python vs TypeScript) and I’ll show the exact code example to toggle
allow_early_termination
.
s
is allow_interruptions will work with realtime model like gemnai
t
For real-time models like Gemnai,
allow_interruptions
is typically ignored — real-time models use built‑in turn detection and handle their own turn‑taking, so the flag won’t reliably block or allow user interrupts. Use
allow_interruptions
for non–real-time agents to control user-initiated interrupts. For real-time models, rely on the model's turn-detection behavior or use programmatic interrupts (
session.interrupt()
/
handle.interrupt()
) if you need explicit control.