agents icon indicating copy to clipboard operation
agents copied to clipboard

Handle STT error tolerance in AgentSession

Open jmolz opened this issue 5 months ago • 1 comments

Summary

  • add an STT unrecoverable-error counter to AgentSession
  • apply max_unrecoverable_errors to stt_error the same way it already applies to LLM and TTS errors
  • reset the STT counter alongside the existing LLM/TTS counters when the session closes or the agent starts speaking
  • add a focused regression test for the STT tolerance behavior

Fixes livekit/agents#5665.

Tests

  • uv run pytest tests/test_agent_session.py::test_stt_errors_use_session_tolerance_before_closing
  • uv run pytest tests/test_agent_session.py::test_interruption_detection_error_is_not_session_error tests/test_agent_session.py::test_stt_errors_use_session_tolerance_before_closing tests/test_agent_session.py::test_vad_fallback_uses_next_vad_inference_event
  • uv run ruff format --check livekit-agents/livekit/agents/voice/agent_session.py tests/test_agent_session.py
  • uv run ruff check livekit-agents/livekit/agents/voice/agent_session.py tests/test_agent_session.py

jmolz avatar Jun 07 '26 22:06 jmolz

CLA assistant check
All committers have signed the CLA.

CLAassistant avatar Jun 07 '26 22:06 CLAassistant