can a livekit agent interrupt user turn? Let's say...
# ask-ai
r
can a livekit agent interrupt user turn? Let's say I want to say a keyphrase if I hear a keyword
t
Thanks for reaching out, Ivan. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Yes — a LiveKit agent can interrupt a user’s turn and say a keyphrase when a keyword is detected, but you must implement that logic. What to do: 1. Enable real-time transcription (STT) so you receive partial/streaming transcripts. 2. Monitor incoming transcription chunks (pipeline node or transcription callback). 3. When your code detects the keyword, call
session.interrupt()
to stop the user’s current turn. 4. Call
session.say()
with your keyphrase to have the agent speak. Notes: • By default the agent waits for VAD/STT endpointing;
session.interrupt()
overrides that to seize the turn. • Ensure your STT/transcription events are enabled so you can act on partial results. Would you like a short code example in the language you’re using (Python or JavaScript)? Sources: Turn detection and interruptions | LiveKit Docs