Does livekit provide an api to monitor how many wo...
# ask-ai
b
Does livekit provide an api to monitor how many worker available?
t
Thanks for reaching out, Jura. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m responding to your question about whether LiveKit provides an API to monitor how many workers are available. Short answer: There isn’t a single API call that returns “available worker count,” but LiveKit provides several APIs and signals you can use to infer or build that metric depending on your deployment (LiveKit Cloud vs self‑hosted). What you can use • LiveKit Cloud ◦ Use the Agent Dispatch APIs (e.g.,
list_dispatch()
) to list active agent dispatches for rooms. Seeing which agents are assigned and how many dispatches exist helps infer current capacity and assignment status. ◦ The LiveKit Cloud console also shows real‑time agent/session metrics (agent session count, status, uptime, CPU/memory) which can be used to assess available capacity. • Self‑hosted Agent Server ◦ The agent server exposes a built‑in health check endpoint (default `http://0.0.0.0:8081/`) that returns 200 when healthy and 503 when there’s a problem. Use this in orchestration/monitoring to know which worker instances are up. ◦ You can configure
load_fnc
and
load_threshold
on each agent to report current load (0 to 1). The server stops accepting new jobs when load >
load_threshold
. Aggregating these reported loads across instances lets you compute available capacity. How teams commonly implement “available worker” metrics • Aggregate health checks across agents to count healthy instances. • Use dispatch listings to count agents currently assigned to jobs and subtract from total healthy instances. • Expose/collect each agent’s load (via
load_fnc
) into your metrics system (Prometheus/Grafana) and compute available capacity from load values and thresholds. • Use Cloud console metrics when on LiveKit Cloud for a quick view of sessions and resource usage. If you’d like, I can help with next steps — for example: • Which deployment are you using (LiveKit Cloud or self‑hosted)? • If self‑hosted, do you already have metrics collection (Prometheus)? I can outline a step‑by‑step approach to compute available worker count from health, dispatch, and load data. Sources: Self-hosted deployments | LiveKit Documentation | Agent deployment overview | LiveKit Documentation | Server options | LiveKit Documentation | Deploy and scale agents on LiveKit Cloud | LiveKit
b
Cloud
t
Thanks — since you’re on LiveKit Cloud, here’s how you can monitor worker (agent) availability. Quick summary • There isn’t a single API that returns an “available worker count.” • You can use the Agent Dispatch API plus Cloud console metrics to infer capacity and monitor worker availability in real time. What to use on LiveKit Cloud • Agent Dispatch API (
list_dispatch()
): returns active agent dispatches (which agents are currently assigned to rooms). By inspecting dispatches you can see how many agents are currently handling jobs and which rooms they’re attached to. • LiveKit Cloud console (Agents section): shows real‑time metrics such as agent session count, agent status/uptime, and resource usage (CPU/memory). This gives an operational view of capacity without needing to aggregate API calls yourself. How teams typically derive “available workers” • Count healthy agent instances using the Cloud console metrics (or agent registration state) as your total capacity. • Use
list_dispatch()
to count currently assigned/occupied agents. • Compute available = total healthy instances − currently assigned agents. • Optionally, combine with agent CPU/memory metrics from the console to factor in partial capacity (e.g., mark an agent as “available” only if load < threshold). If you want, I can: • Show an example flow to compute available workers using the Dispatch API plus console metrics. • Help design a small polling or metrics pipeline (e.g., how often to call
list_dispatch()
and which fields to inspect). Which would you prefer—an example implementation using the Dispatch API, or a high‑level monitoring design for the Cloud console metrics?
b
can i list all sessions/room?
t
Thanks — responding to your question about listing all sessions/rooms on LiveKit Cloud. Short answer: • You can list all active rooms via the server API. • You cannot list every client “session” across the whole server in a single call; you can list participants (sessions) for a specific room. What to use • List all active rooms: ◦ Use the RoomService API method
listRooms()
(SDK names vary:
roomService.listRooms()
in Node/Java/Kotlin,
room_service.list_rooms()
in Python,
ListRooms
in Go, etc.). This returns metadata about currently active rooms. • List participants (sessions) in a specific room: ◦ Use the appropriate room/participant listing method (for example,
listParticipants(roomName)
in server SDKs) to get active participant connections for that room. How teams commonly use this • Admin dashboard: call
listRooms()
to show active rooms, then call participant listing per room when you need session-level details. • Monitoring: poll
listRooms()
periodically and query participant lists only for rooms of interest to avoid high API load. If you want, I can: • Provide a code example in the SDK you’re using (Node, Python, Go, etc.). • Suggest a polling cadence and efficient pattern for dashboards (e.g., list rooms every 30s, fetch participants for top N rooms). Which SDK or language are you using? Sources: Server-side | livekit/livekit_composite | DeepWiki | server-sdk-ruby | livekit/livekit_composite | DeepWiki | server-sdk-js | livekit/livekit_composite | DeepWiki