API reference

API reference · Agents

Follow a run's events

GET/v1/agents/{id}/runs/{run}/eventsAPI key

JSON after ?after=<n> (?limit, 100 at most), or with Accept: text/event-stream (or ?stream=true) server sent events whose ids are the event numbers: the stream replays from the larger of ?after and Last-Event-ID, follows the run, and closes at its end or after a few minutes, to be resumed. A 404 while hosted runs are off on the deployment.

Parameters

Path and query parameters
FieldTypeWhat it is
id (path)requiredstringThe agent's id; self on an agent's own key.
run (path)requiredstringThe run's id, run_ and 24 hex digits.
after (query)integerThe last event number seen.
limit (query)integerAt most 100, JSON only.
stream (query)stringtrue for server sent events.

Answer 200

The events.

Fields of the 200 answer
FieldTypeWhat it is
objectstringOne of "list".
dataarray of object
data[].objectstringOne of "agent.run.event".
data[].idintegerNumbered from 1 per run; the SSE id.
data[].typestringrun.created, run.in_progress, run.message, run.tool_call, run.tool_output, run.image, run.step.failed, run.requires_action, and one of run.completed, run.incomplete, run.failed, run.cancelled, run.expired last.
data[].createdinteger
data[].dataobject
has_moreboolean

Errors

  • 401OpenAI shaped error.
  • 403OpenAI shaped error.
  • 404OpenAI shaped error.

Every error answers in one shape, with its type, code and the field it names. The whole list is in the docs' Errors section.

Antimatter