AIChatGetRun¶
GET ai/chat/run
Returns the state of a run and, when it is finished, the answer. This is both the polling path for interfaces without streaming and the recovery path after a lost connection — the full answer is never sent through the event channel.
Access Control¶
Allowed: client, manager, admin. Only runs started by the current session.
Request¶
GET https://{broker_domain}/ai/chat/run?runId=run_55b…
Authorization: <JWT_TOKEN>
{
"command": "AIChatGetRun",
"extID": "1",
"data": { "runId": "run_55b…" }
}
const run = await platform.AIChatGetRun({ runId });
Parameters¶
| Parameter | Type | Description |
|---|---|---|
runId |
string | Run id returned by AIChatSendMessage |
accountLogin |
int | Account context. Required for a client session of an account owner |
Response Data¶
{
"runId": "run_55b…",
"conversationId": "cnv_8f3a…",
"state": "completed",
"model": "anthropic/claude-sonnet-4.5",
"result": {
"content": "The position was closed by stop out…",
"sources": [
{ "id": "trading.trade-close-reasons", "title": "Why a position was closed", "section": "Trading", "scope": "global", "score": 14.2 }
],
"actions": [
{
"id": "act_9f2c1b7d4e5a6b80",
"type": "platform.route.open",
"version": 1,
"mode": "button",
"risk": "none",
"label": "Open trades",
"payload": { "route": "/backoffice/trades" },
"idempotencyKey": "run_55b…:platform.route.open:1a2b3c4d"
}
],
"blocks": [ { "type": "table", "schema": 1, "source": "get_open_trades", "columns": [], "rows": [] } ],
"tools": [ { "tool": "get_open_trades", "state": "ok" } ],
"messageId": "msg_1c7…"
},
"usage": { "inputTokens": 1840, "outputTokens": 120, "cost": 0.0042 },
"errorCode": null,
"errorMessage": null,
"startedAt": "2026-09-17 10:12:21",
"completedAt": "2026-09-17 10:12:40"
}
state |
Meaning |
|---|---|
queued |
waiting for a slot |
running |
the model is answering |
completed |
the answer is in result |
failed |
generation failed; see errorCode |
cancelled |
stopped by AIChatCancelRun |
interrupted |
the service restarted mid-generation; the question has to be asked again |
sources are the knowledge documents behind the answer, actions are typed requests to
the interface from a closed catalogue (see Interface actions), blocks are tables, metric tiles and chart
series built from the platform response, and tools is the trace of platform data the
assistant read. What to render from each is described in
Chat integration and Answer blocks.
StScript assistant runs¶
A run of a StScript assistant conversation also has top-level
capability and, while the run is queued or running, progress:
{
"runId": "run_…",
"state": "running",
"capability": "stscript.assistant",
"progress": { "phase": "validating", "attempt": 1, "maxAttempts": 3, "sequence": 8, "updatedAt": "2026-10-15T12:00:01.000Z" }
}
result adds capability, protocolVersion, operation (as sent), resolvedOperation
(what the answer actually did; decided by the assistant for auto), artifacts (at most one
descriptor of a stscript.source_proposal) and analysis. The full source is never in
the run — load it with AIChatGetArtifact. Polling again returns the
same artifact ids. See Read the result.
After a run is accepted, its own failures arrive here in errorCode, not as an HTTP
status of this method: AI_STSCRIPT_VALIDATOR_UNAVAILABLE, AI_OUTPUT_INVALID,
AI_OUTPUT_TRUNCATED, AI_RUN_TIMEOUT, AI_CONTEXT_TOO_LARGE.
Errors¶
| Code | Error | Description |
|---|---|---|
403 |
AI_ACCESS_DENIED |
The session may not use the assistant |
404 |
AI_RUN_NOT_FOUND |
Unknown run, or a run of another session |