How to prevent automatic agent dispatch in a parti...
# ask-ai
b
How to prevent automatic agent dispatch in a particular room.
t
Thanks for reaching out, Masayuki. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I’m happy to help you with preventing automatic agent dispatch in a particular room! To achieve this, you’ll want to configure your agent worker to disable automatic dispatch globally, and then you can explicitly dispatch agents to specific rooms as needed. Here’s a simple way to do it: 1. Set an
agent_name
in the
WorkerOptions
configuration. This will disable automatic dispatch globally for that agent worker. 2. Then, use the AgentDispatchService API to explicitly dispatch agents to the rooms you want. For example:
Copy code
# Explicitly dispatch to a specific room
await lkapi.agent_dispatch.create_dispatch(
    api.CreateAgentDispatchRequest(
        agent_name="selective-agent", 
        room="specific-room", 
        metadata="my_metadata"
    )
)
Just a quick note: automatic dispatch is a global setting for each agent worker, so it can’t be turned off for some rooms while staying on for others. If you want more room-specific control, you might consider running separate agent workers with different settings or adding some application logic to manage explicit dispatch. Please don’t hesitate to reach out if you’d like me to walk you through this setup or if you have any other questions. I’m here to help! Sources: Agent dispatch | LiveKit Docs | livekit-protocol/livekit/protocol/room.pyi | SIP dispatch rule | LiveKit Docs | Agents telephony integration | LiveKit Docs