how can i check if there is an available default a...
# ask-ai
s
how can i check if there is an available default agent worker running before I create a room? I want to essentially warm up a worker before i make room
t
Thanks for reaching out, John. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! If you want to check whether a default agent worker is up and running before creating a room, you can easily do this using the worker's built-in HTTP server endpoints: • GET /: This one will give you a 200 OK response if the worker is healthy and running. If there's no inference process running, you'll get a 503 response instead. • GET /worker: This endpoint shares more details about the worker, like its type, how many active jobs it has, the SDK version, and the project type. Here's an example:
Copy code
{
  "agent_name": "",
  "worker_type": "JT_ROOM",
  "active_jobs": 0,
  "sdk_version": "x.x.x",
  "project_type": "python"
}
Using these endpoints, you can programmatically make sure a worker is registered and ready to take on jobs before you go ahead and create a room. Also, just a heads up: make sure you don’t set an
agent_name
in the worker’s
WorkerOptions
if you want to keep the default automatic dispatch behavior. If you’re using a named agent, you’ll need to dispatch it explicitly with the
AgentDispatchService
. If you have any questions or want me to walk you through anything else, just let me know—I’m here to help! Sources: livekit-agents/livekit/agents/job.py | LiveKit Docs | Dispatching agents | LiveKit Docs | Agent deployment CLI reference | LiveKit Docs | agents/src/worker.ts
s
is there a way for me to query the livekit cloud server to know this instead of the worker's address?
t
Right now, there isn’t a direct API endpoint on the LiveKit cloud server to check if the default agent workers are available. The best way to do this is by using the worker’s local HTTP server endpoints (
GET /
and
GET /worker
) to see their status. If you have a particular situation in mind or need a hand with something else, just let me know—I’m here to help figure out the best solution for you.