Install an SDK
- Node.js
- Python
- Node.js
- Python
Node.js
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 anagentId to run an existing Agent, along with per-run options like variables, resultSchema, and browserSettings.
- Node.js
- Python
- cURL
Node.js
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
- Python
Node.js
Passing variables
Usevariables 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%.
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 readresult:
- Node.js
- Python
- cURL
Node.js
Read or stream progress
To follow what the Agent is doing while it runs, poll List run messages. Save the response’snextSince and pass it back as since to fetch only newer messages:
- Node.js
- Python
- cURL
Node.js
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 thenextCursor 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
- Python
- cURL
Node.js
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