Skip to main content

AI Agents

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

note

New to agents? Build one with the AI Agents SDK and deploy it with Agent Cloud. This page covers driving those deployed agents from the Server SDK.

Dispatch an agent

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

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

Deploy a pre-built image

A single call runs the entire pipeline: it 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 (a tag string, or a full image object) (required), env, scaling (max ≤ 50), profile (cpu-small, cpu-medium, cpu-large), region, agentId, webhook.

Manage deployments

await client.agents.deployment.list({ agentId: "agent_123" });
await client.agents.deployment.get("dep_1");
await client.agents.deployment.getLatestVersion("dep_1");
await client.agents.deployment.delete("dep_1", { force: true });
await client.agents.deployment.setVersionActive(versionId, true); // false stops the version

Logs

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

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

The dispatch result

Returned by dispatch.

FieldTypeDescription
jobIdstringId of the created dispatch job.
statusstringDispatch status.
workerIdstringId of the worker handling the job.
roomIdstringRoom the agent joined.
agentIdstringThe dispatched agent id.
successbooleanWhether the dispatch was accepted.

The deployment object

Returned by agents.deployment.list and get. agents.deploy returns these same fields plus the created version (a version object), and a secretId when env vars were set.

FieldTypeDescription
idstringThe deployment id.
agentIdstringId of the agent this deployment runs.
namestringDeployment name.
templatestringTemplate the deployment was created from.
statusstringDeployment status.
envSecretstringId of the attached env secret, if any.

The version object

Returned by agents.deployment.getLatestVersion, and nested as version on a deploy result.

FieldTypeDescription
idstringThe version id.
deploymentIdstringId of the parent deployment.
regionstringRegion the version runs in.
minReplicanumberMinimum replica count.
maxReplicanumberMaximum replica count.
statusstringVersion status.
activebooleanWhether this is the active, running version.
versionTagstringYour version tag, if set.

The log entry

Returned by agents.deployment.logs.

FieldTypeDescription
logstringThe log line text.
timestampstringWhen the line was emitted.
metadataobjectStructured context for the entry, if any.

Got a Question? Ask us on discord