Skip to main content
GET

Behavior

Works without a key on shared sessions.

Polling rules

Poll /changes until status is terminal and a poll returns no events.
  • The server holds the request open until something new arrives or wait_for_seconds expires.
  • Each call returns only what is new since from_index. 204 means no new events yet.
  • status can read completed before you reach the page with the final events and the answer, so a terminal status alone doesn’t end the loop.
  • For a finished session, read latest_answer instead, or let the SDK helper run the loop.

Path parameters

string
required
The session ID.

Query parameters

integer
default:"0"
Event index to start from. Pass the next unread index to resume where you left off.
integer
Maximum number of events to return. Minimum 0.
boolean
default:"true"
Whether to include event details in the response.
integer
default:"0"
How long the server holds the request waiting for changes, 0 to 25 seconds. 0 returns immediately, and 20 to 25 gives efficient long polling.

Response

200 with the changes object, or 204 No Content if no new events arrive within the wait.
string
Current session status.
string | null
When the agent started executing.
string | null
When the session reached a terminal state.
string | null
Short, stable error message if the session failed or timed out. Branch on error_code, not on this text.
string | null
Failure category when the session failed or timed out: environment_error, no_answer, answer_validation, timeout, insufficient_credit, or internal.
string | null
The agent’s self-assessed outcome, reported with its final answer: success, partial, infeasible, or blocked.
string | object | null
The agent’s final result once produced: a string, or an object matching the agent’s answer_format. It can arrive after status turns terminal (Polling rules). Mirrored on the session’s latest_answer.
object
Usage and cost so far. Costs are in USD and null when a model’s price is unavailable, so null-check before summing.
integer
number | null
number | null
number | null
number | null
object[]
Per-model usage and cost.
string
integer
integer
integer
integer
number | null
number | null
number | null
number | null
object[]
Events since from_index, each an Event object (type, data, timestamp).
integer | null
Index of new_events[0]. Your next from_index is first_index plus the number of new_events. It equals from_index in the cloud. A local runtime session keeps a window of recent events, so it can be higher there when older events were dropped.
object[]
The custom tool calls the agent is waiting on, as on status. Empty unless the status is awaiting_tool_results, or paused while calls are pending.
string
object
string | null

Long-polling pattern

The SDK helper runs the polling loop for you: it advances from_index, handles 204 responses, and returns once the session is terminal or idle and every event is read.

Errors