Hello ai! When connecting to livekit cloud with tw...
# ask-ai
d
Hello ai! When connecting to livekit cloud with two agent app running ( two entrypoint waiting to be triggered ). Is it possible to indicate in some way that one should not trigger if the other one is triggering ?
t
Thanks for reaching out, W. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
LiveKit Cloud provides a built-in job distribution system that ensures only one agent app (worker) is triggered for a given job at a time. This system uses round-robin distribution and a single-assignment principle, so when a job (such as a new room or event) becomes available, it is assigned to only one worker. If that worker does not accept the job within a set timeout, it is reassigned to another available worker. This mechanism prevents both agents from triggering simultaneously for the same job. If you need more advanced coordination, you can also use LiveKit's real-time state and data features or RPC communication to implement custom logic between agents. However, for most scenarios, the built-in job distribution will handle mutual exclusion automatically. • Jobs are assigned to only one agent at a time • Automatic reassignment if an agent does not respond • Optional: Use real-time state or RPC for custom coordination No additional configuration is required for basic mutual exclusion between agent apps. Sources: Deploying to production | LiveKit Docs | Deployment and scaling | LiveKit Docs | Web and mobile frontends | LiveKit Docs
d
If I have two exact same agent with exact same livekit url, secret and key. How could I know which one will be triggered ,
t
Hey there! Let me break down how LiveKit handles agent assignments when you have multiple agents set up. It's pretty cool how they make sure the workload stays balanced and fair. • Imagine LiveKit as a smart matchmaker that looks at how busy each of your agents is right now. Agents with less on their plate get a better chance of getting the next job. • Then, it's like a little lottery where agents with lighter loads have better odds of being picked. Pretty neat, right? • Don't worry if an agent gets a job but can't jump on it right away - the system has a backup plan and will quickly reassign it to another available agent. • They even try to be location-smart, aiming to connect users with agents that are geographically closer when possible. Just a heads up - you can't really predict exactly which agent will get a specific job. But that's actually a good thing! This randomized approach helps keep things running smoothly and ensures no single agent gets overwhelmed. Think of it like a fair and friendly job-sharing system that looks out for all your agents. Sources: Deploying to production | LiveKit Docs | Deployment and scaling | LiveKit Docs | test/agent_test.go
d
Ok and is there a parameter that I could activate in development to activate priority over all other agent trying to reach the same url ?
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!