loud-art-83554
05/08/2026, 6:55 AMtall-airline-16756
05/08/2026, 6:55 AMtall-airline-16756
05/08/2026, 6:55 AMroom.serverRegion.
1) Recommended routing approach
• Explicitly dispatch to the agent in the same SFU region as the room. That minimizes media hop/latency when your agents are self‑hosted across regions.
• Determine the room’s assigned SFU region server‑side (see #3) and call AgentDispatchService.createDispatch with the region‑specific agent name.
2) Shared agent_name vs region-specific names
• Keep region‑specific agent names (e.g., agent-us-east, agent-eu-central) and explicitly select which to dispatch to.
• Do not rely on sharing one agent_name and expecting LiveKit Cloud affinity to route to the closest self‑hosted worker — geographic affinity only applies to LiveKit‑hosted agents.
3) Where to get the selected room/SFU region for Android
• Android SDK 2.25.1 does not expose room.serverRegion. The authoritative ways to get assigned region:
◦ Server-side: call the Room service (GetRoom) to read the room’s region field after creation/connection.
◦ Or read the region from the client’s Join/Connected event if your client SDK exposes connection details (Android currently does not expose region publicly).
• Recommended: perform region lookup on your backend (GetRoom) and use that to choose the agent.
4) Is calling /settings/regions and picking the first returned region supported?
• No — /settings/regions lists available/preferred regions; it does not guarantee the room was assigned to the first entry. It is not a reliable/authoritative source for the room’s assigned SFU region and should not be used alone to decide dispatch. Use the room’s region (GetRoom) instead.
5) Android equivalent to iOS room.serverRegion
• There is no public Android equivalent in SDK 2.25.1. The JoinResponse does contain the region internally, but it’s not exposed by the Android SDK.
• Workarounds:
◦ Use the backend GetRoom API to retrieve room.region (recommended).
◦ Patch/extend the Android SDK locally to expose region, or file/track a feature request on the Android SDK repo if you want native exposure in future releases.
Suggested implementation pattern (concise)
1. Client connects to LiveKit Cloud room.
2. Backend calls GetRoom (RoomService) to read room.region.
3. Backend calls AgentDispatchService.createDispatch with agent_name derived from region (e.g., agent-{region}).
4. Agent in same region handles the call.
If you’d like, tell me:
• how you currently create rooms (server API or via client), and
• whether your backend already calls any Room or RTC service APIs — I can give exact request examples and the minimal fields you need to read room.region. Sources: Why WebRTC beats WebSockets for realtime voice AI | LiveKit | Why WebRTC beats WebSockets for realtime voice AI | LiveKit | Understand and Improve Agent Latency | LiveKit | Agent dispatch | LiveKit Documentation, with interactive elementsloud-art-83554
05/08/2026, 7:10 AMtall-airline-16756
05/08/2026, 7:11 AM