Before you start
- An API token with
read_writemode, from Settings → API tokens (authentication). - The agent’s ID, visible on the agent page in the dashboard.
Create a run
Send the instruction ininput.message. If the run is reacting to an event, put the event’s payload in input.data — the agent receives it as data, never as instructions.
string
required
The instruction for the agent. Up to 128 KiB.
object
Free-form JSON with event data, up to 128 KiB. Framed as untrusted data for
the agent — use it for payloads coming from the outside world.
object
Up to 16 string keys (values up to 512 characters). Echoed back on the run
and in webhooks — use it to correlate with records in your system.
string
Continue an existing API session of this agent instead of starting a new
conversation. Runs on the same session are processed in order.
string
HTTPS URL notified when the run finishes. See
Completion webhooks.
string
Optional title for the new session, shown in the dashboard.
202 Accepted with the run resource:
Always send an
Idempotency-Key. If your request is retried, you get the
original run back instead of a duplicate. Details in the
API overview.Follow the run
Poll the URL fromurls.self until the status is terminal:
Non-terminal responses include a
retry-after header with a suggested polling interval. When the run completes:
A run in
waiting_approval resumes after someone approves the pending action
in the dashboard. If you registered a callbackUrl, you also receive a
run.waiting_approval event at that moment — useful to alert the approver.callbackUrl and receive a signed webhook on completion — see Completion webhooks.
List runs
{ "runs": [...], "nextCursor": "..." }, newest first. Pass cursor to fetch the next page and status to filter (for example status=failed).
Cancel a run
queued can be canceled. A run already executing returns 409 not_cancellable; canceling an already-finished run is harmless and returns the resource unchanged.
Continue a conversation
Each run without asessionId starts a fresh session. To keep context across runs — a back-and-forth with the same agent — reuse the sessionId returned by the first run: