Dispatch Agents
Dynamically assign your AI agents to meetings using the VideoSDK dispatch API.
How It Works
- Your app calls the dispatch API
- VideoSDK backend finds an available worker
- Worker spawns a job/process to join the meeting
- Agent starts and begins processing in the meeting
API Usage
Endpoint
POST https://api.videosdk.live/v2/agent/dispatch
Request
curl -X POST "https://api.videosdk.live/v2/agent/dispatch" \
-H "Authorization: YOUR_VIDEOSDK_AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"agentId": "MyAgent",
"meetingId": "room-123"
}'
Prerequisites
Your worker must be:
- Registered with
register=True
- Connected to VideoSDK backend
- Available (not at capacity)
Worker Configuration
from videosdk.agents import Options
options = Options(
agent_id="MyAgent", # Must match agentId in API call
register=True, # Required for dispatch
max_processes=10,
load_threshold=0.75,
)
Code Examples
- Python
- JavaScript
import requests
def dispatch_agent(agent_id, meeting_id, auth_token):
url = "https://api.videosdk.live/v2/agent/dispatch"
headers = {
"Authorization": auth_token,
"Content-Type": "application/json"
}
payload = {
"agentId": agent_id,
"meetingId": meeting_id
}
response = requests.post(url, headers=headers, json=payload)
return response.json()
# Usage
result = dispatch_agent("MyAgent", "room-123", "your-token")
async function dispatchAgent(agentId, meetingId, authToken) {
const response = await fetch("https://api.videosdk.live/v2/agent/dispatch", {
method: "POST",
headers: {
Authorization: authToken,
"Content-Type": "application/json",
},
body: JSON.stringify({
agentId: agentId,
meetingId: meetingId,
}),
});
return response.json();
}
// Usage
dispatchAgent("MyAgent", "room-123", "your-token");
Monitor Success
Check if your agent was dispatched:
# Check worker status
curl http://localhost:8081/worker
# Check active jobs
curl http://localhost:8081/stats
Common Issues
- Agent not found: Ensure
agent_id
matches between worker and API call - Worker unavailable: Check if worker is connected and has capacity
- Dispatch failed: Verify your auth token and meeting ID
Got a Question? Ask us on discord