Skip to main content

AI Agents

The agents resource dispatches deployed agents into rooms (optionally placing an outbound call) and manages cloud deployments.

Dispatch an agent

const dispatch = await client.agents.dispatch({
agentId: "agent_123",
roomId: "abcd-efgh-ijkl", // or meetingId
roomOptions: { joinMeeting: true, vision: true },
});
dispatch.jobId;
dispatch.status;

Options: agentId (required), roomId / meetingId (one required), roomOptions, sipOptions (when present, the dispatch also places an outbound call), metadata, versionId, versionTag.

connect is an alias of dispatch. generalDispatch dispatches a managed/low-code agent and requires versionId.

Deploy a pre-built image

One call creates the deployment, its version (auto-activated), and, when env vars are set, a secret to hold them.

const deployment = await client.agents.deploy({
name: "voice-assistant",
image: "registry.videosdk.live/acme/agent:1.4",
env: { OPENAI_API_KEY: "sk-..." },
scaling: { min: 1, max: 20 },
});
deployment.id;

Options: name and image (required), env, scaling (max ≤ 50), profile (cpu-small, cpu-medium, cpu-large), region, agentId, versionTag, webhook.

Manage deployments

await client.agents.listDeployments({ agentId: "agent_123" });
await client.agents.getDeployment("dep_1");
await client.agents.getLatestVersion("dep_1");
await client.agents.deleteDeployment("dep_1", { force: true });
await client.agents.setVersionActive(versionId, true); // false stops the version

Logs

Historical console logs (default: the last 24 hours).

for await (const line of await client.agents.logs("dep_1", { roomId })) {
console.log(line.log);
}

Got a Question? Ask us on discord