Skip to main content
Once you’ve built an Agent in the dashboard, you can integrate it into your application with the official SDK/API: manage reusable Agents, trigger runs, pass per-run values, track each run to completion, and read the result. Runs are asynchronous. You create a run, then track it to a terminal state by polling.

Install an SDK

Initialize the client once:
Node.js
See the Node.js SDK reference or Python SDK reference for every Agents SDK method, parameter, and response field.
To scaffold the integration quickly, open an Agent’s run view in the dashboard and use Build API in to open the Agent’s API prompt in a coding tool like Cursor.

Endpoints at a glance

Agents define reusable configuration. Runs are single executions of a task.

Trigger a run

Start a run with Run an Agent. Pass an agentId to run an existing Agent, along with per-run options like variables, resultSchema, and browserSettings.
Node.js
A call with no agentId creates a new Agent and its first run, returning both an agentId and a runId. See Run an Agent for every field.

Manage reusable Agents with the SDK

The SDKs support the complete reusable Agent lifecycle:
Node.js
Deleting an Agent doesn’t affect runs that already referenced it. Updates are partial: omitted fields remain unchanged.

Passing variables

Use variables to pass per-run dynamic values without writing them into the prompt. Each variable pairs a value the placeholder resolves to with an optional description that tells the Agent when to use it. Reference a variable in the task or system prompt as %variableName%.
Variables suit values like account numbers, dates of birth, and confirmation codes. The Agent fills the placeholder without the value appearing inline in the task.

Tracking a run to completion

A run moves through these states:
PENDING and RUNNING are active. The rest are terminal.

Poll for the result

Poll Get a run until the run reaches a terminal state, then read result:
Node.js

Read or stream progress

To follow what the Agent is doing while it runs, poll List run messages. Save the response’s nextSince and pass it back as since to fetch only newer messages:
Node.js
Messages conform to the AI SDK UIMessage format. Each item includes an id, createdAt, and a message with a role and content. Content can be text or typed parts such as reasoning, files, tool calls, and tool results.
Integration is poll-based today: track runs with Get a run and List run messages. Webhook notifications are planned.

Listing and filtering

Both list endpoints use cursor pagination. Pass the nextCursor from a response back as cursor to fetch the next page. List runs filters by agentId, status, and a startAt/endAt time range:
Node.js
List Agents pages through your Agents with the same cursor pagination pattern.

Next steps

Node.js SDK

Complete Agents SDK method and type reference

Python SDK

Complete Agents SDK method and type reference

Run an Agent

Full request and response reference for a run

List run messages

Stream a run’s step-by-step transcript

Managing files

Retrieve files an Agent downloads during a run

How it works

The execution loop, run lifecycle, and observability