Voice AI Systems. Lesson 4. Reconstruct an interrupted turn.

This educational session uses fictional healthcare operations examples. This session uses AI narration.

Silence is not the same as completion

A live agent must decide when to listen, when to respond and when to stop. Voice activity detection can identify likely speech, but a pause may be hesitation, a breath or an unfinished thought. Endpointing adds a policy for treating the input as a completed segment or turn. Some systems use semantic signals as well as timing. The useful outcome is not simply the shortest pause threshold; it is fewer interruptions and acceptable response latency for the intended callers.

A barge-in occurs when the caller begins speaking while the agent is speaking. Treat it as an event that changes the active turn. The application may need to cancel model generation, stop synthesis, clear transport buffers, record how much output played and start processing the new input. These operations involve different systems and may complete at different times.

Make response identity explicit

Assign identifiers to input turns, generated responses and tool operations. When a new turn invalidates an old response, mark that response canceled and reject late output associated with it. A socket can still deliver bytes after cancellation because they were already in transit. If the playback queue accepts them without checking identity, the agent can resume an obsolete sentence after the caller has corrected it.

A tool operation needs its own identity because its lifetime may outlast the voice response. Canceling a response does not prove the tool was canceled, and canceling a tool request does not prove an external side effect was rolled back. Record the operation as canceled only when the relevant system establishes that result. Otherwise retain an unknown or pending state and reconcile it before retrying or announcing success.

Keep model history consistent with the conversation

If an agent generated ten seconds but the listener heard two, retaining the full generated message as though it were delivered can distort the next turn. The model may refer to an explanation or question the caller never heard. Use the provider's supported interruption and history controls to align retained output with playback progress.

For example, OpenAI's Realtime documentation distinguishes transports: WebRTC and SIP can use server-managed playback tracking, while a WebSocket client must manage its own output and send the supported truncation information. The specific event names and responsibilities belong to that API version. The general design principle is broader: keep the amount generated, the amount transmitted and the amount heard distinct, and verify the provider contract for the transport you actually use.

Turn state and business state can diverge

Imagine a caller approves Tuesday at the north office, then interrupts with Actually, Thursday at the south office. The new utterance creates a different intended action. It invalidates any draft or approval tied to Tuesday at the north office. If the original write already committed, the system needs a fresh, authorized correction workflow; it cannot pretend the earlier action never happened. If the write is uncertain, first determine its state.

Test these sequences with controlled event ordering: interruption before dispatch, during dispatch, after commit but before receipt, and after receipt but before playback. Add duplicate events, delayed callbacks and a disconnect. A successful happy-path call tells you little about these races. The test should inspect both conversation history and the external ledger, because a natural-sounding recovery can still leave the wrong appointment in place.

Your decision exercise. A synthetic trace shows response R7 queued for playback, operation O nine, the letter O followed by nine, dispatched with approval for Tuesday at the north office, then caller interruption requesting Thursday/south. The client clears audio and receives a playback mark for R7. O nine times out without a receipt. A late R7 chunk arrives. The transport returns marks for both played and cleared media. Which state reconstruction is justified?

Option 1. The mark proves all of R7 was heard, and clearing audio proves O nine was canceled.

Option 2. The new request authorizes rewriting O nine in place with Thursday/south because it is the same conversation.

Option 3. R7 is canceled for playback; its late chunk is discarded. The mark must be interpreted in the clear epoch, and O nine remains uncertain until reconciled. Thursday/south needs its own validated action.

Pause here and commit to a choice. Name the decisive evidence and one limitation before continuing.

Reference analysis. The clear event changes playback semantics: a returned mark may acknowledge removal from the queue rather than successful listening. Track the clear epoch and response identity rather than treating every mark as proof of playback. O nine is a separate external operation; its timeout leaves the result uncertain. Reconcile it using its stable operation identity. The caller’s new request changes the payload, so the old Tuesday at the north office approval cannot authorize Thursday/south. A new proposed action must be validated against current state and the required confirmation policy.

Now change one fact. Change the trace so O nine has a verified commit receipt before the caller interrupts. Explain the new conversational response and why a correction must be recorded as another action rather than rewriting the historical receipt.

Walk through the trace aloud in timestamp order. For each event, say which state machine changes: listening, response generation, playback or the external task. Then describe the invariant that prevents an old audio chunk from becoming part of the new turn. Finally name the evidence required before changing an uncertain operation to canceled, failed or completed.
