API reference
Turns
GET /v1/agents/turns/{turnId}, and the turn's trajectory.
View as MarkdownReads the result of one turn. Every POST /message returns a turnId: the turn the message started, or the running turn it joined. See Structured output for the options that make a turn return typed output.
Authenticate with the same API key as the rest of /v1/agents.
Get a turn
GET /v1/agents/turns/{turnId}Answers at once. Poll it until status is succeeded or failed; every 2 to 5 seconds is enough.
json
{
"turnId": "turn_vzjz62w7j7jvOilZ6zBL",
"sessionId": "cs_02JAB",
"machineId": "m_7f2a",
"status": "failed",
"output": null,
"reason_code": "output_invalid",
"raw_answer": "I found two invoices for September: INV-1043 and INV-1051. The totals were not shown on the list page.",
"usage": { "inputTokens": 48210, "outputTokens": 1630 },
"recordTrajectory": false,
"trajectory": {
"recorded": false,
"url": "/v1/agents/turns/turn_vzjz62w7j7jvOilZ6zBL/trajectory"
},
"evidence": [],
"output_errors": ["/invoices/0 must have required property 'total'"],
"template": "Sign in to the {{vendor}} portal and list the invoices dated in {{month}}.",
"inputs": { "vendor": "Acme", "month": "September 2026" }
}The structured fields are extra fields on the same object, so code written for plain messages reads a structured turn unchanged.
Trajectory
Requires options.recordTrajectory: true on the message that started the turn.
GET /v1/agents/turns/{turnId}/trajectoryjson
{
"turnId": "turn_vzjz62w7j7jvOilZ6zBL",
"trajectory": {
"recorded": true,
"url": "/v1/agents/turns/turn_vzjz62w7j7jvOilZ6zBL/trajectory"
},
"steps": [
{
"index": 0,
"timestamp": "2026-10-10T18:02:11.204Z",
"title": "Open the Acme portal sign-in page",
"rationale": "The task starts at the portal, so I open its sign-in page first.",
"code": "await machine.browser.newtab('https://portal.acme.example/login')",
"screenshot": "/v1/agents/turns/turn_vzjz62w7j7jvOilZ6zBL/trajectory/screenshots/0"
},
{
"index": 7,
"final": true,
"timestamp": "2026-10-10T18:04:52.880Z",
"screenshot": "/v1/agents/turns/turn_vzjz62w7j7jvOilZ6zBL/trajectory/screenshots/7"
}
]
}steps is empty for a turn without recordTrajectory. At most 500 steps are listed.
Screenshot
GET /v1/agents/turns/{turnId}/trajectory/screenshots/{index}Returns the JPEG (Content-Type: image/jpeg).
Errors
Gotchas
finalizingis not done. Keep polling untilsucceededorfailed.status: succeededwithoutoutput_schemaorsuccess_criteriaonly means Sai finished with an answer. Readoutput.- A message sent while Sai was busy (
queued: true) joined the running turn, so itsturnIdis that turn's and so is the result. - A later message in the same session never changes a finished turn.