how do I customize interruption handling?
# ask-ai
m
how do I customize interruption handling?
t
Thanks for reaching out, Alexander. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
If you want to customize how interruptions work in LiveKit, there are a few handy settings and techniques you can try depending on what fits your needs best: • AgentSession Configuration: You can tweak parameters like
allow_interruptions
,
min_interruption_duration
, and
min_interruption_words
to shape interruption behavior. For instance, setting
allow_interruptions=False
will stop interruptions altogether. • Manual Interruptions: You can also take control programmatically using methods like
session.interrupt()
or
agent.interrupt()
. • Customizing Behavior: If you want to prevent interruptions on certain responses, just use
session.say(..., allow_interruptions=False)
, or manage permissions on each speech with
SpeechHandle
. • Natural-Sounding Interruptions: For a smoother experience, you could add a volume fade-out by customizing the
AudioOutput
class. • Advanced Control: And if you need really precise handling, try manual turn detection with
session.clear_user_turn()
and
session.commit_user_turn()
. If you'd like me to walk you through any of these or share some examples, just give me a shout! Sources: livekit-agents/livekit/agents/voice/agent_activity.py | pipeline-llm/interrupt_user.py | How to Handle Speech Interruptions More Naturally | Bringing AI avatars to voice agents | Turn detection and interruptions | LiveKit Docs
m
but manual turn detection means that I no longer use the semantic turn detection plugin right? does it still use VAD though?
t
When you switch on manual turn detection by setting
turn_detection="manual"
, it turns off both the semantic turn detection plugin and VAD. This means you’re in full control of managing turns yourself, using methods like
session.interrupt()
,
session.clear_user_turn()
, and
session.commit_user_turn()
. This setup works really well for custom interfaces like push-to-talk, where turns are guided by external signals instead of audio analysis. If you’d like, I’m happy to walk you through more details or share some examples! Sources: Turn detection and interruptions | LiveKit Docs | livekit-agents/livekit/agents/voice/audio_recognition.py