Turn detection for voice agents
Separate speech activity, end-of-turn decisions and interruptions. Evaluate pauses, corrections and recovery with labelled conversations.
“My order number is seven two…” The caller pauses to read the remaining digits. A silence timer expires and the agent starts answering before it has the whole identifier.
Turn handling has two decisions: when to respond, and when to stop responding. Evaluate them separately, then check that conversation state survives the transition.
Detection Layers
| Layer | What it establishes |
|---|---|
| Voice activity detection | Evidence of speech in the incoming audio |
| Recognition | A transcript hypothesis, possibly still changing |
| End-of-turn decision | Whether the application should allow a response |
| Interruption policy | Whether incoming activity should stop agent playback |
None of these signals alone proves the caller’s intention. LiveKit’s turn-handling overview separates user turn completion from agent interruptions and describes the available detection modes.
Endpoint Decisions
A silence threshold is a policy: after a specified gap, proceed. A shorter threshold can reduce waiting but may cut into pauses. A longer one can protect unfinished speech while delaying completed turns.
Semantic context and audio cues can help, but their reliability depends on language, transcription and the model. Measure the tradeoff on labelled examples. Do not assume a semantic detector knows that every number is incomplete, or that one human conversational average is a universal target.
Paused Entities
Include utterances with pauses inside names, addresses, codes and corrections. Annotate where the speaker intended to hold the turn and where it actually ended.
| Constructed utterance | Desired behaviour |
|---|---|
| “The code is seven two… [pause] nine.” | Retain the partial code and wait through the labelled internal pause. |
| “That’s everything.” | Permit a reply after the configured completion decision. |
| “Tuesday… no, Thursday.” | Keep the correction attached to the request. |
Task state helps: an application collecting a fixed-length identifier can notice that digits are missing. That is domain logic, not evidence that recognition itself was correct. Keep entity validation as a separate step.
Interruption Policy
“Mm-hmm” may acknowledge a reply; “No, Thursday” may correct it. Words, timing and context matter. A blanket rule to ignore short utterances can miss a meaningful “stop.”
Replay acknowledgements, corrections, background speakers and echo. Decide which cases should interrupt, then record false stops and missed interruptions. LiveKit’s tuning reference documents distinct endpointing and interruption controls; change the setting tied to the observed failure.
Recovery State
An accepted interruption should cancel obsolete generation, stop playback and clear queued audio where supported. Then update the conversation using what was actually spoken and the caller’s new input.
If the interruption was false, resume only when the conversation still warrants the unfinished reply. Do not restart an entire answer mechanically. Track pending tool operations too: stopping speech does not undo a booking already submitted.
Evaluation Plan
| Failure | Measurement |
|---|---|
| Premature response | Agent starts during a labelled within-turn pause |
| Delayed response | Intended turn end to first audible reply |
| False interruption | Playback stops for activity labelled non-interrupting |
| Missed interruption | Caller correction begins but playback continues |
| Broken recovery | Repeated, skipped or contradicted information after the stop |
Keep audio, transcripts, detector events and playback timestamps on a shared timeline. Report sample counts with each rate and inspect disagreements in the labels. The WebRTC guide shows why receiver buffering can change the timing you observe.
Related guides
Run these components on your own servers, end to end.
See the self-hosted offerDiscussion
Questions, corrections and war stories welcome. Sign in with GitHub to comment.