‹ Guides
Barge-in
Let users talk over the avatar and stop it mid-sentence.
Talk over the avatar and it stops mid-sentence, then listens: that is barge-in.
- The CLI and the Python agent: the voice model’s turn detection hears you start talking and cancels its reply; LiveKit Agents then clears the avatar’s buffered audio and frames, so the mouth stops with the voice. In the Python agent it is
interrupt_response=Trueon the turn detection, shown in Voice agent in Python. - Your own loop in Python: when your speech detection fires, call
interrupt()on the runtime and clear any reply audio you still hold.run()carries on with idle frames. With OpenAI Realtime, the event to watch isinput_audio_buffer.speech_started:
# excerpt: barge-in, in the event loop of conversation.py
elif event.type == "input_audio_buffer.speech_started":
# the user started talking: drop the rest of the reply
runtime.interrupt()
- On the device:
interrupt()in Swift and Flutter;resetState(true)for Expression 2 andresetAudio()for Essence 2 on Android (Companion app). - Pipecat:
BitHumanVideoServicehandlesInterruptionFrame: the avatar drops the reply in flight and goes back to idle (Pipecat). - A cloud avatar without the plugin: perform the RPC
lk.clear_bufferon the avatar (Cloud avatar).
Barge-in does not change billing: a session bills active session time, talking or idle, to the second.