Retrieve a subagent turn
Retrieve a single turn for a specific subagent to inspect status, time boundaries, errors, and token usage.
Endpoint
Returns 200 with a single Turn. The query does not start or resume a subagent, and does not create resources.
/agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}Path parameters
session_idstringRequiredSession ID, for example sess_xxx
subagent_idstringRequiredStable subagent ID, for example subagent_xxx
turn_idstringRequiredPublic turn ID, for example turn_xxx
The path hierarchy must match. If the turn does not belong to the subagent or the session, no data is returned.
Request example
curl "$BASE_URL/agents/sessions/sess_xxx/subagents/subagent_xxx/turns/turn_xxx" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY"
turn = client.beta.agents.sessions.subagents.turns.retrieve(
"turn_xxx",
session_id="sess_xxx",
subagent_id="subagent_xxx",
)
print(turn.status)
Response fields
usage contains input_tokens, input_tokens_details.cached_tokens, output_tokens, output_tokens_details.reasoning_tokens, and total_tokens. If the related counts are incomplete, the entire usage is null.
idstringPublic turn ID
objectstringTurn object type, fixed as agent.session.turn
session_idstringOwning session
agent_idstringExecuting agent
subagent_idstring / nullThe corresponding subagent ID for a subagent turn
statusstringTurn status: in_progress, waiting, completed, failed, or cancelled
created_atintegerCreation time, Unix seconds
started_atinteger / nullStart time
completed_atinteger / nullCompletion time
errorobject / nullTurn-level error.
Properties
codestringError code
messagestringError description
usageobject / nullToken usage.
Properties
input_tokensintegerNumber of input tokens
input_tokens_detailsobjectInput token details.
Properties
cached_tokensintegerNumber of input tokens that hit the cache
output_tokensintegerNumber of output tokens
output_tokens_detailsobjectOutput token details.
Properties
reasoning_tokensintegerNumber of reasoning tokens
total_tokensintegerTotal number of tokens
waiting is not a successful terminal state. completed, failed, and cancelled are terminal. The SSE turn.created event can show queued; persisted turns start at in_progress.
Response example
{
"id": "turn_xxx",
"object": "agent.session.turn",
"session_id": "sess_xxx",
"agent_id": "agent_xxx",
"subagent_id": "subagent_xxx",
"status": "completed",
"created_at": 1794118835,
"started_at": 1794118836,
"completed_at": 1794118840,
"error": null,
"usage": {
"input_tokens": 512,
"input_tokens_details": {"cached_tokens": 0},
"output_tokens": 128,
"output_tokens_details": {"reasoning_tokens": 32},
"total_tokens": 640
}
}
Error codes
| HTTP status | Error type / code | Solution |
|---|---|---|
404 | not_found_error / not_found_error | Confirm that the session, subagent, and turn exist in the same workspace, and use matching path levels |
502 | server_error / agents_api_upstream_unavailable | Retry later. If it keeps failing, submit a ticket with the x-request-id from the response headers |