status messages it sends and clear playback promptly.
How it works
-
User starts speaking while the agent is talking. The server’s VAD fires and opens a tentative barge-in: it stops sending new audio for the in-flight response, but does not cancel it, and sends
status: listening. It does not sendinterruptedyet, so keep playing the audio you already have. Most short sounds over an agent are not interruptions: a cough, a click, a “mhm”, or the agent’s own voice leaking back through the microphone (worst in the first second of a call, before the browser’s echo canceller has adapted). -
Playback stops once the interruption is real. The server sends
status: interruptedas soon as either:- the user has kept talking for 400 ms, or
- their utterance is confirmed once it ends: it is long enough (
MinWordsToInterrupt, relaxed for a single word when the GateTurn barge-in classifier scored the audio as a real interruption), is not noise, and is not an echo of the agent’s own voice.
interrupted. A confirmed barge-in also cancels the response, truncates the assistant’s context to what the user actually heard, sendstranscript_truncatedwith that text, and continues with atranscriptfor what they said. -
A false alarm never interrupts anything. If the utterance turns out to be noise, a backchannel or an echo, the server sends a
statusnaming what is true now (speakingif the response is still playing or resumes,thinkingif it was still being generated), and any held audio continues under the samegeneration. Because the client was never told to stop, the response simply plays on.
GateTurn is confirm-only
Earlier revisions of this pipeline let the fast classifier both confirm and resolve a tentative barge-in (i.e., proactively declare “false alarm, keep talking”). That resolve path was removed: on real call traffic, genuine interruption attempts scored in the same confidence band as backchannels often enough that the resolve path was vetoing real barge-ins, making the bot impossible to interrupt. GateTurn today only ever fast-tracks a confirm. It never resolves a tentative barge-in back down — that decision stays entirely with the pre-existing STT-based heuristics described in step 2 above, which is exactly how barge-in worked before GateTurn was introduced. A wrong confirm just costs one redundant interrupt (STT would likely have confirmed it a few hundred ms later anyway); a wrong resolve would cost the user their ability to interrupt at all, which is why the two paths aren’t symmetric. There is no separate “resolve” or “dismiss” message on the wire: a dismissed tentative barge-in is an ordinarystatus message (speaking or thinking).
Implementation
Best practices
- Clear audio queues and viseme timelines on
status: interrupted, and only then. Stopping onlisteningwould let every cough cut the agent off. - A fast 50ms volume fade-out sounds less jarring than a hard cut.
- Treat “a new
audiomessage arrives” as “we’re speaking again”, whatever UI state you are showing. - Don’t rely on
MinWordsToInterrupt-style precision from the client: single-word interjections (“stop”, “no”, “wait”) are still respected server-side if sustained, but very short noise and backchannels never reach you as an interrupt.