Your Voice Agent Has Two Clocks. Don't Make the Caller Wait for the Slow One.
A natural voice agent needs a fast interaction loop and a slower work loop. Separate turn-taking from retrieval and reasoning, cancel stale work on barge-in, and make conversation state match what the caller actually heard.
On this page
A voice agent can answer correctly and still feel broken.
The usual reason is not model quality.
It is dead air.
The caller finishes speaking. The system waits for endpoint detection, retrieval, tool calls, reasoning, and text-to-speech. Only after all of that does the first sound come back.
Every step may be individually reasonable.
The architecture is still wrong for conversation.
Voice has two clocks:
- the interaction clock — how quickly the system must react so the caller knows it is listening;
- the work clock — how long retrieval, tools, and reasoning actually need.
I do not want the interaction clock blocked by the work clock.
That is the reason for a dual-loop voice architecture.
The fast loop owns the conversation
The fast loop should own everything that has to react immediately:
microphoneturn detectionpartial transcriptbarge-inaudio playbackshort acknowledgementsIt should not wait for a database query or a large reasoning call before it can react.
The slow loop owns the expensive work:
retrievaltool callsbusiness logicreasoningfinal answer constructionThe contract between them is small:
the fast loop dispatches work, then immediately goes back to listening.
That is the part I care about more than which speech or reasoning model is underneath it.
OpenAI's current live voice stack takes the same general direction: full-duplex voice can keep listening and speaking while deeper reasoning or tool work is delegated behind the live interaction layer. That is a much better mental model than one sequential pipeline that has to finish everything before the caller hears anything.
The runtime should look like this
The fast loop is not a fake progress bar.
It has real responsibilities.
If the slow loop finishes quickly, stream the answer.
If it is still working, the fast loop may use a small acknowledgement such as:
"Let me check that."The acknowledgement must be content-free.
Do not say:
"Yes, that charge is refundable."before the refund policy lookup has completed.
A filler can confirm that work is happening.
It should never guess the result.
Do not make the fast loop await the answer
The simplest bug is also the easiest to write:
async function handleTurn( turn: UserTurn,) { const answer = await slowLoop.respond(turn); await speaker.say(answer);}That code is logically correct.
It is conversationally slow.
The fast loop should race useful work against a short interaction timer instead:
const ACK_AFTER_MS = 350;async function handleTurn( turn: UserTurn,) { const controller = new AbortController(); const answerTask = slowLoop.respond( turn, controller.signal, ); const ackTimer = sleep(ACK_AFTER_MS); const first = await Promise.race([ answerTask.then( () => "answer" as const, ), ackTimer.then( () => "ack" as const, ), ]); if (first === "ack") { await speaker.say( "Let me check that.", ); } const answer = await answerTask; await speaker.stream(answer);}The exact timer is a product decision.
The design is the important part: slow work does not own the microphone.
Barge-in is a cancellation problem
The real test of a voice agent is not whether it can speak.
It is whether it can stop speaking correctly.
When the caller starts talking over the agent, I want three things to happen immediately:
- stop current playback;
- cancel work that now belongs to the interrupted turn;
- make conversation state match what the caller actually heard.
The third one is easy to miss.
Suppose the model generated:
Your refund is approved.It will return to your card in five days.I have also closed the duplicate ticket.The caller interrupts after hearing only:
Your refund is approved.If your transcript stores all three generated sentences, the next turn reasons over information that was never actually spoken.
That creates a subtle state bug.
The source of truth should be played audio, not generated text.
Track committed speech
I like to treat generated text and committed speech as different state.
type SpokenTurn = { generated: string; committed: string;};class SpeechState { current: SpokenTurn = { generated: "", committed: "", }; onGenerated(text: string) { this.current.generated += text; } onPlayed(text: string) { this.current.committed += text; } interrupt() { this.current.generated = this.current.committed; }}Your audio layer may track frames, timestamps, tokens, or character offsets instead.
That is an implementation detail.
The invariant is what matters:
After barge-in, conversation history must contain only speech the caller actually heard.
Cancellation has to reach the slow loop
Stopping the speaker is not enough.
If the caller changes direction while the previous retrieval or tool workflow keeps running, that stale work can arrive later and overwrite the new turn.
The interruption should propagate.
async function onBargeIn( session: VoiceSession,) { await session.speaker.stop(); session.activeTurn?.abort(); session.speechState.interrupt(); session.beginListening();}The slow loop also has to respect cancellation.
HTTP requests, retrieval calls, and tool wrappers should either accept cancellation directly or check that the turn is still current before committing results.
Otherwise you have "cancelled" work that still mutates state.
I use a turn ID for that boundary.
async function commitResult( session: VoiceSession, turnId: string, result: ToolResult,) { if ( session.currentTurnId !== turnId ) { return; } await session.state.save(result);}That one check prevents a lot of strange "the bot answered the previous question" failures.
Start expensive work before the caller finishes
The dual loop hides latency.
Speculation can remove some of it.
Partial transcripts arrive while the caller is still speaking. If the intent is becoming obvious, you can warm likely retrievals before the final endpoint.
For example:
"I need to change my flight from Oslo to..."You may already know that flight-policy or booking retrieval is likely.
Do not run ten speculative searches.
Pick one or two cheap candidates and measure whether they are useful often enough to justify the wasted misses.
async function warmLikelyContext( partial: string,) { if (partial.length < 40) { return; } const intents = await classifyLikelyIntent( partial, ); for ( const intent of intents.slice(0, 2) ) { void retrievalCache.warm( intent.query, ); }}This is speculative execution.
It should have a budget.
Track:
prefetch attemptsprefetch hit ratesaved retrieval latencywasted retrieval costIf the hit rate is poor, narrow the trigger.
Measure the two loops separately
One "voice latency" number hides too much.
I want separate spans for the fast loop and slow loop.
For the fast path:
speech start detectionspeech end / endpoint decisionbarge-in stop latencyfirst audio backFor the slow path:
retrievaltool latencyreasoningfirst answer chunkfull answer completionA caller can perceive the system as responsive even when the slow loop takes a second, as long as the interaction layer reacts immediately and honestly.
The reverse can also happen.
Your reasoning may finish quickly, but poor endpoint detection or slow audio playback still makes the agent feel awkward.
OpenAI's own real-time infrastructure work emphasizes stable low media latency and low jitter because users hear those failures immediately as delayed turn-taking and clipped interruptions.
Interruptibility should depend on the action
Not every spoken turn should be interruptible in the same way.
For normal conversation, barge-in should usually win.
For some workflows, letting the caller interrupt the agent while a critical step is happening can be unsafe or confusing.
Examples include:
payment confirmationlegal disclaimersecurity verificationone-time-code instructionsElevenLabs exposes this distinction explicitly with tool interruption modes, including allowing interruptions, disabling them only during tool execution, or disabling them for the whole tool turn.
I would keep the same concept even if you are not using ElevenLabs.
Interruptibility belongs in tool policy, not one global voice setting.
Full duplex changes the implementation, not the invariants
Newer live voice models can listen and speak at the same time.
That removes some of the machinery older pipelines needed for rigid turn detection.
It does not remove the architectural responsibilities.
You still need to know:
- which work is current;
- which work has become stale;
- what audio was actually heard;
- whether a tool may be interrupted;
- whether a speculative result still belongs to this turn.
OpenAI's GPT-Live-1 explicitly supports full-duplex conversation while delegating deeper reasoning and actions to backend models and tools.
That makes the dual-loop idea even cleaner:
the live model owns interaction; the backend owns expensive work.
The production rule I would keep
A natural voice agent is not one pipeline made faster.
It is a responsive interaction loop wrapped around a slower work loop.
The fast loop owns the caller's attention.
The slow loop owns correctness.
Barge-in cancels both speech and stale work.
Conversation state records what was actually heard, not what the model intended to say.
And expensive work can start speculatively before the caller has completely finished, as long as the speculation has a measured budget.
That is the architecture I want before I start shaving another 100 milliseconds off the model call.
Because in voice, the user does not experience your average backend latency.
They experience whether the system knows when to listen, when to speak, and when to stop.
References
KEEP READING
Related engineering notes
A Failover Route Is Not a Recovery Path: Proving Independence in AI Infrastructure
Two LLM providers can share the same failure domain. Build an evidence-backed recovery graph that checks cloud, networking, identity, control-plane and capacity dependencies before admitting fallback routes, then test correlated outages without weakening safety.
Read articleAn Eval Platform Sunset Can Erase Your Release Evidence: Build an Evidence-Escrow Migration Gate
When a hosted LLM evaluation platform retires, switching runners is not enough. Preserve the historical evidence, reconstruct grader semantics, validate scoring parity, and enforce a fail-closed release gate that survives the service shutdown.
Read articleWhen the Package Runs Before Your App: Quarantining AI Framework Releases
The 2026 agent-framework PyPI compromise exposed a blind spot in AI build pipelines: Python startup hooks execute before application imports. Design an artifact-quarantine gate, inspect wheels without installing them, separate credentials, and recover from suspected exposure.
Read article