When creating an agent using CLI, my agent has no ...
# ask-ai
b
When creating an agent using CLI, my agent has no name and can not be used in the dispatch rules, how can I set a name for the agent?
t
Thanks for reaching out, Jose. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're running into automatic dispatch because the agent has no explicit name. To make it selectable in dispatch rules, set the agent name in the agent code and redeploy — you cannot set it from the CLI at deploy time. Options: • Python: add
agent_name
to the
@server.rtc_session()
decorator:
Copy code
@server.rtc_session(agent_name="my-telephony-agent")
async def my_agent(ctx: JobContext):
    ...
• Node.js: set
agentName
in `WorkerOptions`:
Copy code
const opts = new WorkerOptions({
  agentName: "my-telephony-agent",
});
After changing the code, run:
Copy code
lk agent deploy
Use that exact name in your SIP dispatch rule or API dispatch (
agentName: "my-telephony-agent"
). Would you like an example of a dispatch rule JSON using your chosen agent name? Sources: Agent dispatch | LiveKit docs | SIP dispatch rule | LiveKit docs | Agents telephony integration | LiveKit Docs
b
It didnt specify the name that I used on the code so I entered it using the dashboard. However, when trying an inbound call the agent is unresponsive, what could cause this?
t
Thanks — I’m looking at why an agent named only in the dashboard is unresponsive to inbound calls. Short answer: naming the agent in the dashboard is not enough. For SIP dispatch to route calls to your agent you must: • Give the agent a name in the agent code (exact match): ◦ Python:
@server.rtc_session(agent_name="my-telephony-agent")
◦ Node.js:
new WorkerOptions({ agentName: "my-telephony-agent" })
• Ensure your dispatch rule references that exact name in
roomConfig.agents[].agentName
. • Redeploy the agent (
lk agent deploy
) and have the agent process running when the call arrives. Quick checks for diagnostics: • Is the agent code updated with the `agent_name`/`agentName` and redeployed? • Does the dispatch rule include the exact same agent name? • Is the agent process running at call time (dev run or deployed worker)? • Check LiveKit call/session logs and your PSTN provider logs for any routing/answer errors. Tell me: 1) Which language (Python or Node) your agent uses and the exact agent name you set in the dashboard. 2) Whether you’ve added that name to the code and redeployed, and if the agent process is running when you call. I’ll use that to guide the next troubleshooting steps. Sources: Agents telephony integration | LiveKit Docs | SIP troubleshooting guide | LiveKit docs | Create and configure a Plivo SIP trunk | LiveKit docs | Streamline Troubleshooting with Agent Observability