When a user speaks over your agent, you need to know quickly whether to stop. "Wait, no" is a claim on the floor; "mm-hm" is a backchannel and your agent should keep going.
Barge-in works on every /v2 endpoint. In a room it reacts to anyone in the room speaking over your agent.
-
Subscribe
Addbargeintosignalsinsession.start. Ifsession.started.models.bargeinisnull, barge-in is unavailable for this session and no barge-in events will arrive.{ "type": "session.start", "api_key": "baton_...", "eot": {"profile": "cutoff_5pct"}, "signals": ["vad", "eot", "bargein"] } -
Tell Baton when your agent talks
Messages are timestamped on arrival against the audio received so far.{"type": "agent.speech", "phase": "start", "utterance_id": "sp_1"} {"type": "agent.speech", "phase": "end", "utterance_id": "sp_1"}phase: "end"drops an interruption that has not been classified yet. -
Act on the classification
On{"type": "bargein.onset", "seq": 7, "t": 12.1, "agent_speaking": true, "utterance_id": "sp_1"} {"type": "bargein.class", "seq": 8, "t": 12.4, "class": "claim", "p_claim": 0.9, "decided_after_ms": 300, "utterance_id": "sp_1"}claim, stop speaking and listen. Onbackchannel, keep going.
How it decides
- The onset is the start of user speech while your agent is speaking.
- Baton classifies the interruption as soon as it is confident, typically a few hundred milliseconds in.
decided_after_msreports how long it took. p_claimis the confidence that the user is claiming the floor. It isnullwhen the user stopped too soon to judge; that case is reported as a backchannel.
Stop on bargein.onset if you want the fastest reaction, and resume if bargein.class says backchannel. Stop on bargein.class if you want your agent never to stutter on an "mm-hm".