Barge-in occurs when a caller speaks while the agent is still talking. A prompt can tell the model to acknowledge a correction and avoid repeating a long answer, but the audio runtime must cancel or truncate unsent playback and identify the part already heard. Do not leave a generated sentence in conversation history as if the user heard it in full. The next turn should be based on the caller's new utterance and the last confirmed state. If an earlier tool call is in flight, interruption of speech does not cancel the server effect; handle the tool result separately. Distinguish noise from a genuine user interruption before discarding useful playback.
Voice interruptions: stop stale speech before handling a new turn
Operational case
The library agent begins, 'BK-421 is due on the twenty—' when the patron cuts in: 'Wait, do not renew it; I only wanted the due date.' The runtime stops the remaining audio and records that the due-date sentence was incomplete. The agent treats the new turn as a correction. If no renewal call was made, it reports the date without changing the loan. If a renewal request was already sent, stopping the voice is not a rollback; it must check the receipt and tell the patron what happened. A cough near the microphone should not erase the answer without a confirmed speech start or a follow-up cue.
Playback: 'BK-421 is due on the twenty—' [cancelled].
Caller: 'Do not renew; due date only.'
Conversation state: spoken text truncated; new intent=read due date.
In-flight renewal? check receipt; audio cancellation is not undo.Performance and operating cost
For N queued audio chunks, cancellation is O(N) queue cleanup in a simple implementation, while detecting barge-in adds continuous audio monitoring and can raise false interrupts in noisy rooms. Record the playback cursor or completed chunk count so dialogue state reflects what was delivered. Keep evaluation pairs for true interruption and incidental sound. Generating shorter spoken turns lowers the amount of stale audio that must be cancelled, yet overly fragmented speech can feel choppy. A prompt cannot guarantee timing; test the actual runtime with network jitter and a real microphone path.
Common Mistakes
- Do not assume cancelled playback reverses an in-flight tool call.
- Do not summarize unheard audio as if it reached the caller.
- Do not treat every noise burst as a user correction.
Connected lessons
- Prompt engineering applications
- Prompt Engineering
- Voice prompts: do not commit an action from interim speech
- Conversation checkpoints: resume from verified state
- Tool effects: reconcile receipts before retrying
- Spoken confirmations: repeat the risky field, not the whole form
- Voice tool waits: report progress without inventing an outcome
- Real-time voice evaluations: test timing and state, not transcript fluency
- Project: a voice call that renews the right library item
- Real-time voice prompt decisions
