little-article-83676
07/07/2025, 9:50 AMtall-airline-16756
07/07/2025, 9:50 AMtall-airline-16756
07/07/2025, 9:50 AMlittle-article-83676
07/07/2025, 9:50 AMtall-airline-16756
07/07/2025, 9:51 AMFallbackAdapter
is like your trusty sidekick that automatically switches to a backup provider. It's basically making sure your conversation keeps flowing, while also keeping track of any services that might be acting up.
• Implement an error event handler: This is where you can create a really human-friendly way to handle unexpected hiccups. Check out this example: @session.on("error")
def on_error(ev: ErrorEvent):
if ev.error.recoverable:
return
# Handle unrecoverable error
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,
)
It's like having a warm, understanding friend who lets you know something's not quite right and is ready to help.
• Optionally mark errors as recoverable: For some components like TTS and LLM, you can actually tell the system "Hey, this isn't a big deal" by setting ev.error.recoverable = True
. It's like giving your system a little flexibility.
Just a heads up - by default, the system will close the session after too many unrecoverable errors. But don't worry, I'm here if you need any more guidance or want to walk through some examples together! 🤝 Sources: Events and error handling | LiveKit Docs | GitHub::livekit::agents | examples/voice_agents/error_callback.py