Agent Name not picked up in Cloud Agent Creation ...
# ask-ai
m
Agent Name not picked up in Cloud Agent Creation with LK CLI
t
Thanks for reaching out, aigentzi. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m sorry you’re running into this with
lk agent create
. I’m responding to your report that the Agent Name isn’t being picked up when creating a Cloud Agent with the LiveKit CLI. What’s happening and what to check first • The
agent_name
must be defined in your agent code or configuration; the
lk agent create
command does not pass or override
agent_name
. • If an
agent_name
is set in code, the agent will require explicit dispatch (it will not auto-join rooms). If no
agent_name
is set, the agent uses automatic dispatch and will be assigned to new rooms. • The CLI deployment sends your code as-is. If you change the
agent_name
in code you must redeploy the agent (for example with
lk agent deploy
) for that change to take effect. Quick troubleshooting steps 1. Confirm
agent_name
is set in your agent code (example in Python):
Copy code
@server.rtc_session(agent_name="test-agent")
   async def my_agent(ctx: JobContext):
       ...
1. If you changed the code, redeploy the agent after editing: run your deploy command (for example
lk agent deploy
) so the runtime picks up the new value. 2. If you set
agent_name
, dispatch it explicitly to a room: ◦ Using the CLI dispatch creation:
lk dispatch create --agent-name test-agent --room my-room
◦ Or include
RoomAgentDispatch(agent_name="test-agent")
in the token config when generating a token. 1. Check `livekit.toml`—it contains project/agent metadata but does not set
agent_name
. The name must be in the agent code. 2. Inspect
lk agent logs
for any runtime errors or messages that show the agent starting and what name it registers with. I can dig deeper — please provide • The snippet of your agent code where
agent_name
is set (or confirm it’s absent). • The exact CLI commands you ran (
lk agent create
,
lk agent deploy
,
lk dispatch create
, etc.). • Any relevant logs or error output from
lk agent logs
or the CLI output when you created/deployed the agent. With those details I’ll tell you exactly what’s wrong and the minimal steps to get the agent name recognized and dispatched correctly. Sources: Agent dispatch | LiveKit Documentation | Google AI and LiveKit | LiveKit Documentation