how can you get notified of exceptions happening?
# ask-ai
w
how can you get notified of exceptions happening?
t
Thanks for reaching out, Mohammad. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd love to understand better how you'd prefer to be notified about exceptions. Would email alerts work best for you, or maybe logging options, or perhaps you'd like to integrate with a monitoring tool? Let me know what feels right for you!
w
no i want to catch the errors in the backend, so where can i get access to those? for example if an error happened in the llm node
t
I'm here to help you catch backend errors, including those in the LLM node. You can access logs using the LiveKit CLI or handle errors programmatically. Let me walk you through the steps: • Access Runtime Logs: You can use the LiveKit CLI to stream logs from the latest running instance of your agent:
livekit-cli logs --agent-id <your-agent-id>
• Access Build Logs: To see logs from the Docker build process, use:
livekit-cli build-logs --agent-id <your-agent-id>
• Handle LLM-Specific Errors: It’s a good idea to listen for error events in your backend code. For example:
Copy code
@session.on("error")
def on_error(ev: ErrorEvent):
    if isinstance(ev.error, LLMError):
        print(f"LLM Error: {ev.error.error}, Recoverable: {ev.error.recoverable}")
• Forward Logs to External Services: For keeping your logs safe and accessible over time, consider forwarding them to platforms like Datadog, CloudWatch, or Sentry using LiveKit’s log forwarding feature. Just a quick note: runtime logs aren’t stored by LiveKit Cloud, so integrating with an external service is the best way to keep your logs long-term. If you want to dive deeper, the Log Collection documentation has all the details you might need. Sources: Log collection | LiveKit Docs | livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realti...