Warning: stt end of speech received while vad is still in a speech segment, flushing vad

I’m getting

message: “stt end of speech received while vad is still in a speech segment, flushing vad | extras: vad_speech_start_time=1781089362.6959133, flushed=True”

as a warning but it seems like a common mode of operation, not something to worry about. Is there some way to silence this? It’s flooding my alerts for warnings and probably masking when something major is going on

Thanks!

FWIW, added some logic to demote these logs WARNING → INFO. But any input from the team would be useful :slight_smile:

You’re right, this is a normal mode of operation, not a problem.

It happens when you use turn_detection="stt" together with a VAD. The STT provider’s endpointing usually declares end-of-speech faster than the VAD’s silence threshold, so the VAD is often still “in a speech segment” at that moment. The framework then flushes/resets the VAD so its state machine doesn’t get stuck — and so that if the STT ended the turn too early, a fresh VAD speech-start can immediately interrupt the agent. You can see the logic and the explanatory comment in audio_recognition.py (search for “flushing vad”).

To keep it out of your alerts, filter that one message on the livekit.agents logger:

import logging

class DropVadFlushWarning(logging.Filter):
    def filter(self, record):
        return "stt end of speech received while vad is still in a speech segment" not in record.getMessage()

logging.getLogger("livekit.agents").addFilter(DropVadFlushWarning())

Agreed that warning is too loud for something this routine worth a GitHub issue suggesting it be demoted to debug.