Skip to main content
A session is the record of work on a phone: its status, a step-by-step event log, a recording, and its output. Every turn creates one, and so does every session started without an agent.

What to read

Wait for the end

Poll the status every few seconds until it is final:
The status response has id, status, deviceId, startedAt, completedAt and error.

Statuses

completed, complete, failed and cancelled are final. A final session can still take a follow-up message.

Failure codes

When a session fails, error holds a code. Two you can act on:

Follow events as they happen

GET /v1/sessions/{id}/events returns every step of the session in data. Each event has an id, a type, a timestamp, and a data object whose content depends on the type. To read only new events, pass the timestamp of the last event you saw as since:
Each call returns only events after that time.

Artifacts

GET /v1/sessions/{id}/artifacts returns the session’s output, a list of screenshots (with each one’s step and time), and a list of uiStates. To read the UI tree the agent saw at one step, request GET /v1/sessions/{id}/ui-states/{step}.json, for example /ui-states/3.json. To view the screenshots themselves, use the step-by-step replay.

List sessions

GET /v1/sessions lists your workspace’s sessions, newest first. Filter it with query parameters: GET /v1/workspaces/{workspaceId}/devices/{deviceId}/sessions lists the sessions of one phone. To give a session a display name, send PATCH /v1/sessions/{id} with { "name": "…" }. Send "name": null to go back to a name taken from the prompt.

Breakdown

GET /v1/sessions/{id}/breakdown returns the session and its full event list as one JSON document. It is included on Hobby plans and above. Other plans get 403 with error: "detailed_breakdown_not_in_plan".

History window

How long a session’s prompt, output, events and screenshots stay readable depends on your plan. The session’s promptExpiresAt, outputExpiresAt, nameExpiresAt and errorExpiresAt fields say when each one expires. See Pricing for each plan’s history window.