This question originally came up in our Slack community and the thread has been consolidated here for long-term reference.
When deploying an agent using lk agent deploy, the agent_name is empty. Setting agent.name in the livekit.toml doesn’t seem to work.
Where can I set a name for the agent?
You need to set the agent_name in WorkerOptions at runtime in your agent code, not in the configuration file.
See the documentation on explicit agent dispatch: Agent dispatch | LiveKit Documentation
Important: Setting an agent name has implications for dispatching and if an agent is given a name, you can also specify that agent name in the token when creating a room if you want the agent to join. Leaving an agent anonymous (no name) will have it join all rooms automatically.