Is there a particular error we get if we dispatch ...
# ask-ai
a
Is there a particular error we get if we dispatch a call and we have no available agents? ie: our agents are at max capacity
t
Thanks for reaching out, Jakob. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I completely understand how frustrating it can be when a call is dispatched but no agents are available because they've reached their max capacity. What usually happens is the system logs a message saying it's "not dispatching agent job since no worker is available." Instead of immediately returning an error, the system patiently waits for an agent to become available. If none accept the job within 10 seconds, it then times out and shows this error: "The room connection was not established within 10 seconds after calling job_entry." To help avoid this situation, here are a few friendly suggestions you might find useful: • Try running multiple agent instances for each
agent_name
to boost availability. • Consider implementing proper load balancing and auto-scaling to manage demand smoothly. • Keep an eye on worker availability to make sure agents are ready and waiting to accept jobs. • Set appropriate load thresholds to prevent any one agent from getting overwhelmed. Sources: pkg/agent/client.go | agents/src/worker.ts | Troubleshooting & Common Issues | livekit/livekit_composite | DeepWiki | Operational Guidance & Best Practices | livekit/livekit_composite | DeepWik...
a
is there a web hook or programmatic way to recover from such errors?
t
Thanks for reaching out! While there isn't a specific webhook documented for handling the "no agents available due to max capacity" errors, don’t worry—there are some great programmatic ways to detect and manage these situations: • Agents update their status automatically to show whether they’re available or at full capacity. You can keep an eye on these status changes programmatically. • Error handling can catch conditions like "no workers available" or "no workers with sufficient capacity." • The system also emits availability change events (like
stt_availability_changed
), which you could extend to monitor agent capacity. • LiveKit’s webhook system supports error handling and retry mechanisms, which can be set up for general error recovery. To make sure I guide you in the best way possible, could you please share a bit more about what you’re aiming to do? For example: • Would you like to be notified when all agents hit their capacity? • Are you looking to programmatically scale up agents when capacity is maxed out? • Do you want to set up fallback behavior for when no agents are available? • Or are you interested in monitoring worker status changes through existing systems? Sources: examples/voice_agents/error_callback.py | pkg/service/agentservice.go | Webhook & Event System | livekit/livekit_composite | DeepWiki
a
I want to set up fallback behavior for when no agents are available so I have the ability to re-queue the failed request
t
I’m glad you reached out! To help you set up fallback behavior for when no agents are available, here are a few approaches you might find useful: • You can use the built-in server-level job distribution, which automatically retries dispatching jobs to available workers if the first attempt doesn’t go through. • Another option is to monitor worker statuses programmatically (like using
WS_AVAILABLE
or
WS_FULL
) to know when agents are busy and then create custom queuing logic based on that. • Also, consider adapting the
FallbackAdapter
pattern (commonly used with AI services) to manage agent availability by re-queuing any failed requests and trying again with backup agents or after a short delay. To make sure I guide you in the best way possible, could you please clarify a few things? • Are you aiming to re-queue jobs at the application level before dispatching, or do you want to implement retry logic after a job dispatch fails? • What specific situations should trigger the re-queuing? For example, is it when no workers are available or when job dispatch times out? • Do you need a queue that persists even if the application restarts, or would an in-memory queue work for you? • What kind of retry strategy do you have in mind? Something like exponential backoff or fixed intervals? Looking forward to your answers so I can assist you further! Sources: Events and error handling | LiveKit Docs | livekit-agents/livekit/agents/_exceptions.py | Deploying to custom environments | LiveKit Docs | pkg/agent/client.go | Troubleshooting & Common Issues | livekit/livekit_composite | DeepWiki
a
I just need to know in my external system if a dispatch has failed due to capacity issues so I can re-queue it for later
t
I'm here to help you get notified when a dispatch fails due to capacity issues using LiveKit's webhook system. Let's walk through the setup together: • First, you'll want to configure a webhook endpoint in your external system to receive these notifications. You can use the
ResourceURLNotifier
to send important events like
agent_dispatch_failed
or
worker_capacity_exceeded
directly to your system. • Next, it's a good idea to set up retry logic with exponential backoff to make sure these webhook events are delivered reliably, even if there are temporary hiccups. • Also, keep an eye on Prometheus metrics such as
dispatch_failure
and
dispatch_drop
. These can help you track capacity-related issues and trigger alerts when needed. If you'd like, I can provide detailed steps on how to configure the webhook or help you integrate it with your external system. Just let me know! Sources: Webhook & Event System | livekit/livekit_composite | DeepWiki | livekit-agents/livekit/agents/worker.py | pkg/agent/client.go | Web and mobile frontends | LiveKit Docs | webhook/notifier.go