my web app is connecting to the room but no agent ...
# ask-ai
c
my web app is connecting to the room but no agent connects. I’m running an agent worker locally and it’s not receiving a request. What am I missing?
t
Thanks for reaching out, Guillaume. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi there! I understand it can be a bit tricky when an agent worker isn’t receiving requests. Let’s work through this together. Could you please check a few things for me? • Is the worker properly registered with the LiveKit server? For example, are the
ws_url
,
api_key
, and
api_secret
all correctly set? • Are you using explicit dispatch mode by setting the
agent_name
field in
WorkerOptions
? • Is the worker showing signs of high system load or maybe in drain mode? • Have you set up a
request_fnc
that could be rejecting job requests? Once you’ve had a chance to check these, just let me know. I’m here to help you get this sorted out! Sources: livekit-agents/livekit/agents/worker.py | Dispatching agents | LiveKit Docs | agents/src/cli.ts | Worker options | LiveKit Docs | Worker lifecycle | LiveKit Docs
c
how do I define the name of my agent
t
I'd be happy to help you define the name of your agent in LiveKit! You just need to set the
agent_name
field (in Python) or
agentName
(in Node.js) within the
WorkerOptions
when initializing your agent. Here are some examples to guide you: Python:
Copy code
from livekit.agents import WorkerOptions, cli

if __name__ == "__main__":
    cli.run_app(
        WorkerOptions(
            entrypoint_fnc=entrypoint,
            agent_name="inbound-agent",  # Define agent name here
        )
    )
Node.js:
Copy code
const opts = new WorkerOptions({
    entrypoint: entrypoint,
    agentName: "outbound-caller",  // Define agent name here
});
Once you’ve set the agent name, you can dispatch the agent to a room either explicitly using the
AgentDispatchService
API or by including the agent configuration in the room’s access token. If you have any questions or need a hand with this, just let me know—I’m here to help! Sources: examples/agent_dispatch.py | examples/agent-dispatch/index.ts | Dispatching agents | LiveKit Docs | Agent dispatch | LiveKit Docs | Accepting incoming calls | LiveKit Docs