I'm having problems getting a self-hosted agent to...
# ask-ai
r
I'm having problems getting a self-hosted agent to join a room. This is in my local dev environment and I have conducted many successful sessions in the past. I'm not sure what could have changed, but now when I start the agent service it boots as normal (finishing with a
registered worker
log message), but when I join a room the agent is never dispatched. Any ideas why this could be?
t
Thanks for reaching out, Riley. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I hear you: the agent boots (shows "registered worker") but is never dispatched when you join a room. I’ll help narrow this down. Quick checklist of the most common causes (please tell me which apply): • Is your agent decorated with an explicit name (which disables automatic dispatch)? For example:
Copy code
@server.rtc_session(agent_name="your-agent-name")
If yes, the agent will only join when explicitly dispatched. • How are you creating/joining the room? ◦ Do you generate a token with a
RoomConfiguration
that includes
RoomAgentDispatch
for the agent name? ◦ Or are you expecting automatic dispatch (no explicit token config)? • Have you tried a manual API dispatch? Example:
Copy code
await lkapi.agent_dispatch.create_dispatch(
    api.CreateAgentDispatchRequest(agent_name=agent_name, room=room_name, metadata='{}')
  )
If manual dispatch works, the issue is in token/automatic dispatch config. • Confirmed matching agent name: does the agent_name in the decorator exactly match the name used in dispatch requests/tokens? • Agent permissions and grants: are tokens/credentials used for dispatch including the proper agent grants/room join permissions? • Recent changes: Any SDK/server version updates, docker/server rebuilds, or env var changes (like LIVEKIT_URL) since it last worked? What I need from you to continue: 1. The agent entrypoint snippet showing
@server.rtc_session(...)
and how you start the worker (small code paste). 2. How you create the room / token (snippet or description — especially any
RoomConfiguration
usage). 3. Any LiveKit server logs around the time a participant joins (errors or dispatch request logs), and the agent logs beyond the "registered worker" line. If you prefer, start by pasting the two small code snippets (entrypoint + token creation) and one relevant server log block — I’ll point out the precise mismatch or next step. Sources: Agent dispatch | LiveKit docs | Agent server | LiveKit docs | Simple Call Answering Agent | LiveKit docs
r
1. We are specifying an agent name:
@server.rtc_session(agent_name=AGENT_NAME)
2. We create the token on the server and have the "Automatically create rooms on participant join" project setting enabled. The room configuration has an
agents
field with a single entry, and that entry only has
agent_name
and
metadata
set. The name used here is the same as
AGENT_NAME
in step 1) above 3. There are no logs after the "registered worker" line. I can see in the dashboard that a session is being created, but the only participants are me and the egress participant
t
Thanks — this is helpful. You’ve confirmed: explicit
agent_name
is set, the room token includes
agents
with the matching name, the project auto-create-room setting is on, and the agent logs stop at "registered worker" while the dashboard shows only you + egress participant. That narrows things well. Next steps so I can pinpoint the issue — please share the following (small snippets / logs): 1) Token creation code (the exact snippet you use server-side to build the JWT). I’m specifically looking for the grants you include (VideoGrants/room join, and the
with_room_config(...)
call that sets
agents
). 2) The agent entrypoint snippet (the
@server.rtc_session(...)
decorator and the
cli.run_app(server)
or equivalent startup code). 3) LiveKit server logs for the timeframe when you join the room — include any lines around the participant join and any lines mentioning dispatch, agents, or errors. If the logs are large, paste a 50–100 line excerpt around the join time. What I’ll check once you share those: • That the token actually includes room join and agent dispatch grants (missing grants prevent dispatch). • That the
agent_name
strings match exactly and there are no subtle mismatches (case/whitespace). • Whether the server received a dispatch request and if it logged an error before delivering it to the worker. • Whether the agent’s worker registration looks correct and is subscribed to the right job queue. If you prefer, paste the three items above and I’ll point out any mismatches or the exact field that’s blocking dispatch.