important-judge-78504
10/28/2025, 1:13 PMmax_endpointing_delay get compared against last_speaking_time to determine turn end?tall-airline-16756
10/28/2025, 1:13 PMtall-airline-16756
10/28/2025, 1:14 PMmax_endpointing_delay is indeed compared directly with last_speaking_time to figure out when a turn should end. The system works out the wait time using this formula:
• Python: extra_sleep = last_speaking_time + endpointing_delay - time.time()
• JavaScript: const extraSleep = lastSpeakingTime + endpointingDelay - Date.now();
When the turn detection model isn't very confident that the user has finished speaking, it uses max_endpointing_delay as the endpointing_delay. This helps the system decide how much longer to wait before finalizing the turn, based on the last speech it detected.
If you'd like, I’m here to walk you through more details about how the turn detection process works—just let me know!
Sources: livekit-agents/livekit/agents/voice/agent_session.py | agents/src/voice/audio_recognition.ts | Turn detection and interruptions | LiveKit Docsimportant-judge-78504
10/28/2025, 1:16 PMlast_speaking_time isn't getting updated. so when the agent runs an end of turn prediction, and determines that it isnt the end of turn, that actually gets overriden because the last_speaking_time is stale and so max_endpointing_delay is compared against thattall-airline-16756
10/28/2025, 1:17 PMlast_speaking_time might not be updating. There are a few common reasons this can happen:
• No Speech Activity Detected: If no audio is sent or if VAD or STT doesn’t pick up any speech, the timestamp simply won’t update.
• VAD or STT Not Enabled: It’s a good idea to double-check that either VAD or STT is turned on in your settings.
• Event Propagation Issues: Sometimes, if VAD events like END_OF_SPEECH aren’t firing properly, the timestamp won’t show any speech activity.
• Silent or Corrupted Audio Input: Extended silence or problems with the audio input can also stop updates from happening.
• Task Interruptions: If background tasks like _vad_task or _stt_task aren’t running, the audio frames won’t get processed.
Here’s a simple way to troubleshoot this:
1. Make sure VAD or STT is enabled and set up correctly.
2. Take a look at your logs for VAD events such as START_OF_SPEECH and END_OF_SPEECH.
3. Confirm that your audio input is working well and isn’t just silent.
4. Check that audio frames are flowing through and being processed as expected.
5. Review your settings for min_endpointing_delay and max_endpointing_delay to ensure they’re appropriate.
If you’d like, I’m happy to walk you through any of these steps or provide more details. Just let me know!
Sources: livekit-agents/livekit/agents/voice/agent_session.py | Understanding "silence detected on local audio track" warning