is there a hook/event for interruptions
# ask-ai
i
is there a hook/event for interruptions
t
Thanks for reaching out, Ed. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm glad you asked about handling interruptions with LiveKit! There are several helpful hooks and events designed to make this easier for you: • Speech Recognition Hooks: You can use events like
on_start_of_speech()
,
on_end_of_speech()
, and
on_final_transcript()
to respond to interruptions based on voice activity and transcription. These are great for keeping things smooth. • Programmatic Interruption: If you want to manage interruptions directly, methods like
session.interrupt()
or
speech_handle.interrupt()
are available to help you take control. • False Interruption Recovery: Sometimes interruptions happen by mistake, and that’s totally understandable! You can use options like
resume_false_interruption
and
false_interruption_timeout
to handle and recover from those situations gracefully. • Interruption Control: There are flexible settings to enable, disable, or even force interruptions depending on what your scenario needs. If you'd like, I’m here to walk you through any of these in more detail—just let me know how I can support you! Sources: Agent Session & Client Integration | livekit/livekit_composite | DeepWiki | Tool definition and use | LiveKit Docs | Bringing AI avatars to voice agents | tests/test_agent_session.py | Turn detection and interruptions | LiveKit Docs
i
is there any proxy i can use to determine when an interruption happens and do something, like log something, when an interruption occurs
t
I'm glad you're exploring ways to handle interruptions with LiveKit! You can use LiveKit's event handlers to log or take action whenever an interruption happens. Here's a friendly overview: • Speech Recognition Events: You can override handlers like
on_start_of_speech()
or
on_end_of_speech()
to detect interruptions and keep a log of them. • Programmatic Interruption: If you want to manage interruptions yourself, methods like
session.interrupt()
come in handy to control and log these events. • Built-in Logging: LiveKit also has you covered by automatically logging interruption events, including useful details like speech ID and playback position. If you'd like a hand with setting up a specific logging system or customizing your event handlers, please don’t hesitate to reach out—I’m here to help! Sources: agents/src/voice/agent_activity.ts | livekit-agents/livekit/agents/voice/agent_activity.py | Turn detection and interruptions | LiveKit Docs | Agent Session & Client Integration | livekit/livekit_composite | DeepWiki | Bringing AI avatars to voice agents