white-scientist-30911
06/27/2025, 9:51 AMtall-airline-16756
06/27/2025, 9:51 AMtall-airline-16756
06/27/2025, 9:51 AMwhite-scientist-30911
06/27/2025, 9:52 AMtall-airline-16756
06/27/2025, 9:52 AM@session.on("error")
def on_error(ev: ErrorEvent):
if ev.error.recoverable:
return # Continue if error is recoverable
# Handle unrecoverable errors
<http://logger.info|logger.info>(f"session is closing due to unrecoverable error {ev.error}")
# Provide a fallback response
session.say(
"I'm having trouble connecting right now. Let me transfer your call.",
audio=audio_frames_from_file(custom_error_audio),
allow_interruptions=False,
)
• Error Classification: Errors are like different types of hiccups in your system. Some are no big deal, while others need more attention:
◦ TTS and LLM errors are usually pretty chill - they can be marked as recoverable since these components get a fresh start each time.
◦ STT stream errors might need a bit more TLC, possibly resetting the agent to keep the conversation flowing.
• Automatic Retries: The framework is like that friend who never gives up! It has built-in retry mechanisms for API errors, automatically retrying with smart intervals and keeping you in the loop with helpful logs.
These strategies are like having a safety net for your code. Want to dive deeper or need some personalized advice? I'm totally here to help you navigate through any tricky error situations! Sources: GitHub::livekit::agents | livekit-agents/livekit/agents/tts/tts.pywhite-scientist-30911
06/27/2025, 9:53 AMtall-airline-16756
06/27/2025, 9:53 AMwhite-scientist-30911
06/27/2025, 9:55 AMtall-airline-16756
06/27/2025, 9:56 AM