agents
agents copied to clipboard
Handle STT error tolerance in AgentSession
Summary
- add an STT unrecoverable-error counter to
AgentSession - apply
max_unrecoverable_errorstostt_errorthe 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_closinguv 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_eventuv run ruff format --check livekit-agents/livekit/agents/voice/agent_session.py tests/test_agent_session.pyuv run ruff check livekit-agents/livekit/agents/voice/agent_session.py tests/test_agent_session.py