Get a turn's result

Replays a finished turn as its persisted SSE events, in emission order

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Returns the turn's status plus every event it emitted, in the order it emitted them — so a client that missed the live stream can reconstruct the turn exactly as if it had watched it.

Pairs with Get a turn's status: poll status until the turn settles, then read it here.

Basic Usage

GET /v2/projects/../stream/agent_ask/7/result
{
  "threadResponseId": 7,
  "threadId": 5,
  "status": "FINISHED",
  "events": [
    { "sseEventType": "thinking", "block_id": 1, "content": "The customers table has a customer_state column." },
    { "sseEventType": "thinking_done" },
    { "sseEventType": "tool_call", "block_id": 2, "id": "toolu_01A", "name": "execute_sql", "sql": "SELECT customer_state, COUNT(*) AS customers FROM olist_customers_dataset GROUP BY customer_state ORDER BY customers DESC LIMIT 5" },
    { "sseEventType": "tool_result", "block_id": 3, "id": "toolu_01A", "name": "execute_sql", "columns": ["customer_state", "customers"], "rows": [["SP", 41746], ["RJ", 12852]], "rowCount": 5 },
    { "sseEventType": "answer", "block_id": 4, "content": "São Paulo leads by a wide margin with 41,746 customers." },
    { "sseEventType": "done", "session_id": "9c537507-9cec-46ed-b877-07bfa6322bed", "trace_id": "f218b1f7-4623-4a56-8b66-18d544797b20", "version": 1 }
  ]
}

Each entry is one persisted SSE payload with a sseEventType field naming the frame it came from. The payloads are identical to the live ones — see Event Types for each shape.

To render the answer, concatenate the answer entries that share a block_id, in array order.

Reading it back

const { status, events } = await getResult(threadResponseId);

// The answer, reassembled.
const answer = events
  .filter((e) => e.sseEventType === 'answer')
  .map((e) => e.content)
  .join('');

// Anything the agent produced along the way.
const artifacts = events.filter((e) => e.sseEventType === 'artifact');

A turn that failed still has a result — the error event is in events, and status is FAILED.

🔗

Learn more


Path Params
integer
required
Responses

Language
Credentials
Bearer
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json