Hey, fast question, how can I dispatch an agent wi...
# ask-ai
s
Hey, fast question, how can I dispatch an agent with curl request?
Copy code
curl --location '<https://myurl/twirp/livekit.SIP/RoomAgentDispatch>' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data '{
	"agent_name": "agent-name",
	"room": "room-name",
	"metadata": "my_job_metadata"
}
g
The curl request you provided is not aligned with the correct API endpoint for dispatching an agent in LiveKit. To dispatch an agent, you should use the
AgentDispatchService
API, which is accessible via the
/twirp/livekit.AgentDispatchService/CreateDispatch
endpoint. Here's how you can structure your curl request:
Copy code
curl --location 'https://your-livekit-url/twirp/livekit.AgentDispatchService/CreateDispatch' \
--header 'Authorization: Bearer <your-token>' \
--header 'Content-Type: application/json' \
--data '{
    "agent_name": "agent-name",
    "room": "room-name",
    "metadata": "my_job_metadata"
}'
This request will create an explicit dispatch for an agent to join a specified room. Ensure that the
agent_name
is registered and the room exists or will be created automatically during the dispatch process. Would you like more details on this process? Sources: - https://docs.livekit.io/agents/build/dispatch/ - https://docs.livekit.io/server-sdk-js/classes/AgentDispatchClient.html 👍 1 button 👎 0 button 💡 Hint: Mention @millions-hair-24956 in the thread for followups.