Polls an agent turn's status without holding the SSE stream open
| Time | Status | User Agent | |
|---|---|---|---|
Retrieving recent requests… | |||
Returns where a turn has got to, without holding a stream open.
This is for clients that cannot consume SSE — a serverless function that would time out, a webhook worker, a batch job. Fire agent_ask, keep the threadResponseId from the init frame, disconnect, then poll here until the turn settles and read it with Get a turn's result.
Basic Usage
GET /v2/projects/../stream/agent_ask/7/status{
"threadResponseId": 7,
"threadId": 5,
"answerId": "3f1c9a52-7d4e-4b8a-9c61-2e5f0b7a8d13",
"status": "FINISHED"
}Status values
| Status | Meaning |
|---|---|
NOT_STARTED | The turn is provisioning or still running. Keep polling. |
FINISHED | The turn completed. Read it with Get a turn's result. |
FAILED | The turn errored. The error event is in the result. |
INTERRUPTED | The turn was cancelled, or the client disconnected mid-turn. |
Polling pattern
// 1. Start the turn and read only the init frame, then close the connection.
const { threadResponseId } = await startTurnAndReadInit({
projectId: 1,
question: 'Which 5 states have the most customers?',
});
// 2. Poll until the turn settles.
let status = 'NOT_STARTED';
while (status === 'NOT_STARTED') {
await sleep(2000);
({ status } = await getStatus(threadResponseId));
}
// 3. Read the whole turn back.
const { events } = await getResult(threadResponseId);The API key is authorized against the project that owns the turn, so you do not pass a project id here.
Answer feedback
Answer feedback is currently available on self-hosted Wren AI. Coming soon to Wren AI Cloud.
The response carries the turn's answerId — the same one the init frame carried. A turn started before this deployment supported feedback has none. Pass it to Submit answer feedback to let your users rate the answer. See Getting an answerId for the rules every feedback-capable endpoint follows.
