straight-jelly-92105
11/01/2025, 11:48 AMtall-airline-16756
11/01/2025, 11:48 AMtall-airline-16756
11/01/2025, 11:48 AMAgentDispatchService through LiveKit’s server-side SDKs. This gives you more precise control over which agent gets dispatched.
Here’s a quick rundown of the steps to help guide you:
• First, make sure the agent is registered with an agent_name. This step disables automatic dispatch and allows you to dispatch agents explicitly via the API.
• Then, use the createDispatch method from the AgentDispatchService, providing the room_name and agent_name. You can also add metadata if you want to pass extra information to the agent.
Here’s a simple example in Python to illustrate:
from livekit import api
async def create_dispatch():
lkapi = api.LiveKitAPI()
dispatch = await lkapi.agent_dispatch.create_dispatch(
api.CreateAgentDispatchRequest(
agent_name="my-agent",
room="my-room",
metadata='{"user_id": "123", "name": "Alice"}'
)
)
print("Dispatch created:", dispatch)
Just double-check that your API calls have the right agent_name and room_name so the correct agent gets dispatched. And if you run into any other questions or need a hand, please don’t hesitate to reach out—I’m here to help!
Sources: Authentication | LiveKit Docs | lib/livekit/agent_dispatch_service_client.rb | Agent dispatch | LiveKit Docs | packages/livekit-server-sdk/src/AgentDispatchClient.ts | livekit-api/livekit/api/agent_dispatch_service.py