cant i deploy an agent instance with custom agent ...
# ask-ai
b
cant i deploy an agent instance with custom agent name
t
Thanks for reaching out, Aman. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Could you please help me understand a bit more about what you mean by deploying an agent instance with a custom agent name? Are you talking about naming a particular component, service, or user within LiveKit? I’m here to help you through this!
b
i am talking about agent name
t
To deploy an agent instance with a custom agent name in LiveKit, here’s a simple guide to help you through the process: 1. Set the
agent_name
in Worker Options:
When you initialize your agent worker, make sure to specify the
agent_name
in the
WorkerOptions
. This step is key because it enables explicit dispatch and turns off automatic dispatch. Here’s how you can do it:
Copy code
# Python Example
from livekit.agents import WorkerOptions

options = WorkerOptions(
    worker_name="my-custom-agent",  # Optional identifier
    agent_name="sales-support-bot"  # Custom name for dispatch
)
Copy code
// Node.js Example
const options = {
  workerName: "my-custom-agent",
  agentName: "sales-support-bot"
};
1. Deploy the Agent Using LiveKit CLI: Next, you’ll want to deploy your agent to LiveKit Cloud using the
lk agent deploy
command. Just a heads-up, the CLI doesn’t let you specify a custom agent name during deployment directly.
Copy code
lk agent deploy [working-dir]
1. Dispatch the Agent by Name: After your agent is deployed, you can dispatch it using the
AgentDispatchService
with the
agent_name
you set earlier. Here’s how you can do this:
Copy code
# Python Example
from livekit.agents import dispatch_agent

await dispatch_agent(
    room=room,
    participant=participant,
    agent_name="sales-support-bot",
    metadata={"user_id": "12345"}
)
Copy code
// Node.js Example
await dispatchAgent({
  room,
  participant,
  agentName: "sales-support-bot",
  metadata: { user_id: "12345" }
});
This method gives you full control over when and how your named agent is called. If you have any questions or need a hand with any of these steps, feel free to reach out—I’m here to help! Sources: Agent dispatch | LiveKit Docs | Deploying to production | LiveKit Docs | protobufs/livekit_cloud_agent.proto | Agents telephony integration | LiveKit Docs