Skip to main content

Dispatch Agents

Dynamically assign your AI agents to meetings using the VideoSDK dispatch API.

How It Works

  1. Your app calls the dispatch API
  2. VideoSDK backend finds an available worker
  3. Worker spawns a job/process to join the meeting
  4. 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:

  1. Registered with register=True
  2. Connected to VideoSDK backend
  3. 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

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")

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