Hey folks, I want to use LiveKit cloud, but I want...
# cloud
n
Hey folks, I want to use LiveKit cloud, but I want to host my own Agent Server distributed globally. https://docs.livekit.io/agents/server/options/ ☝️ Here, it seems there is no "region" or long/lat parameter that I can give, which can be used to assign the job to the Agent Server closest to the SFU handling the LiveKit room. When the Agent connects using the Project/LiveKit URL, does it automatically connect to the geographically closest LiveKit deployment and while assigning the Job, LiveKit prefers the Agent Servers connected to the same DC?
Copy code
{
  "agent_name": "",
  "id": "...",
  "url": "...",
  "region": "...",
  "protocol": 16
}
I see that there is a region parameter present when the worker is registered.
r
The WebRTC is usually pretty fast regionally through the globally distributed SFU. I think you are better to optimize for locality to model provider if possible. There are far more round trips for the various model inferences where usually the other interaction is direct.
n
Thanks, we have regional availability of the models we want to use. Our rooms will have two participants. A human user and an Agent. Let us assume the user is connecting from Region A, and we have a fleet of Agent Servers running in regions A and B. The Agent Servers will also use models hosted in the corresponding regions A and B. In this case, will LiveKit automatically prioritise the Agent Servers that are also connecting to LiveKit from region A over B?
Given that the LiveKit <-> Agent Server media track communication is based on WebRTC, will I gain significant benefits in terms of latency if I run the Agent Server globally? I guess network latency from Agent Server and processing time of the model providers and MCP Servers will be more crucial.
r
Right the WebRTC distance is less critical than the MCP, Agent interactions because there are a lot of round trips for a single input or response.
In a perfect World both would have proximity but if you have to choose then agent should be close to the services that have the most round trips.