Skip to main content
GET
Get session changes
Returns a stream of changes (events, status transitions, agent actions) that have occurred since your last request. Uses long polling: the server holds the connection open until new changes are available or the timeout expires. Returns 200 with a SessionChanges object, or 204 No Content if no new events arrive within the wait period. changes is a delta: each call returns only what’s new since from_index, and 204 when nothing new has arrived yet. Note that status can read completed while events (including the answer) are still unread on later pages, so keep advancing from_index until the session is terminal and a poll returns no further events. To skip the loop entirely and just read a finished run’s result, use latest_answer; the SDK helper drains for you.

Path parameters

id
string
required
The session ID.

Query parameters

from_index
integer
default:"0"
Event index to start from. Use this to resume from where you left off.
limit
integer
Maximum number of events to return.
include_events
boolean
default:"true"
Whether to include event details in the response.
wait_for_seconds
integer
default:"0"
How long the server should hold the connection waiting for changes, up to 25 seconds. The default 0 returns immediately; set 20 to 25 for efficient long polling.

Response

Response

Examples


Long-polling pattern

Long polling is more efficient than repeated status checks because the server only responds when something actually changes. The SDK ships a helper that runs the loop for you: it drives termination off status (authoritative) while streaming events from changes, resuming from_index and handling the 204 no-change responses automatically.
Long-poll changes to follow a run: it returns new events and the final answer with near-instant latency and far fewer calls than fixed-interval polling. Reach for status only when you want a cheap, one-off liveness check.