Voice assistant starts speaking before user finishes - turn detection issue
Hi LiveKit team,
I'm building a voice assistant using LiveKit's AgentSession, and it's working well in general. However, I’m facing some issues with turn detection and endpointing that are impacting the user experience.
Problems I'm facing:
- The assistant starts speaking while the user is still talking — especially when users speak slowly or take pauses between words.
- Even if users speak quickly or say longer sentences, the assistant sometimes interrupts and starts responding in between.
- The agent interrupts too much, even when users are just thinking or hesitating — for example, when they say "emmm", "uhh", or pause to gather their thoughts.
- There’s no reliable way to ensure the user has finished speaking before the assistant starts talking.
- This leads to a frustrating user experience where the assistant blabbers or responds prematurely.
What I've tried:
- Using the built-in silero VAD but it doesn't handle slow speech or longer sentences well.
- Adjusting some session parameters but I haven't found the right configuration.
- Looking into the turn detection model mentioned in the docs, but I need further guidance on implementation and tuning.
session = AgentSession(
llm=openai.LLM(model="gpt-4.1-mini"),
stt=openai.STT(model="gpt-4o-transcribe"),
tts=elevenlabs.TTS(
voice_id="wqS2JTzjt7fARO3ZxCVZ",
model="eleven_multilingual_v2",
),
turn_detection=MultilingualModel(),
vad=ctx.proc.userdata["vad"],
preemptive_generation=True,
)
Thanks for your support!
As an update, I’ve also tried using OpenAI’s semantic_vad with eagerness="low" in the turn detection settings. It’s a bit better at reducing interruptions, but it still interrupts too soon on longer pauses or when users hesitate.
Here’s the session setup I’m using:
session = AgentSession(
llm=openai.realtime.RealtimeModel(
modalities=["text"],
turn_detection=TurnDetection(
type="semantic_vad",
eagerness="low",
create_response=True,
interrupt_response=True, # same with False
),
),
tts=elevenlabs.TTS(
voice_id="wqS2JTzjt7fARO3ZxCVZ",
model="eleven_multilingual_v2",
),
)
I’ve also tried AssemblyAI’s stt turn detection, but it’s not as effective as OpenAI’s model in this case.
Is there any way to further tune the eagerness or other settings to make the agent more patient and avoid interrupting during long pauses or while users are thinking?
maybe similar issue to https://github.com/livekit/agents/issues/3382, you can try to increase the min_endpointing_delay to let the agent to wait for a longer time before start speaking (https://github.com/livekit/agents/issues/3382#issuecomment-3268566593)
Hey, we are encountering the same problem. And I think it's linked to the issue but not exactly the same.
I also realized that this is a tradeoff between how easy is to interrupt the agent, and occurrences of the agent speaking over the user.
Maybe it's a candidate for change in livekit-agents, maybe if there is a vad event in the thinking state, it should always interrupt, the agent activity, as in fact the previous trigger was to soon, as the user is still speaking.
@longcw what you think? If it makes sense maybe I could implement it soon.
@Bnowako do you mean to have a lower threshold for VAD interruption (min_interruption_duration) when the agent state is thinking?
Yes, I think it should be either parametrized, or in thinking any vad event should interrupt thinking. In our case, I would probably want to test it with min_interruption_duration=0. Currently if you want the agent to be less interruptible, if human is speaking with long breaks the agent will speak over the user.
I am fairly new to the agents repo, but if I understand correctly it would require som additional logic here
https://github.com/livekit/agents/blob/d0c84e8cc3a150f32dd2457034f7267253d485b3/livekit-agents/livekit/agents/voice/agent_activity.py#L1137
def on_vad_inference_done(self, ev: vad.VADEvent) -> None:
if self._turn_detection_mode in ("manual", "realtime_llm"):
# ignore vad inference done event if turn_detection is manual or realtime_llm
return
if ev.speech_duration >= self._session.options.min_interruption_duration:
self._interrupt_by_audio_activity()
Then maybe I could add those additional parameters for the thinking state.
@longcw would be very grateful for your guidance here, we moved recently 100% of our traffic to livekit, and this is getting very problematic. Maybe there is also other way of solving that, but I am also happy to contribute
so perhaps interruption options (min_interruption_duration and min_interruption_words ) need to be different when agent is speaking or not speaking (thinking state). When agent is speaking we use a higher threshold, and lower when speaking not started.
Yes @longcw created this issue https://github.com/livekit/agents/issues/3427 as it is not exactly the same problem as we are having
we reverted the adjustment of min_endpointing_delay in recent versions, close this issue for now.