Retrieve a subagent
Retrieve a single subagent to inspect its parent agent, public instructions, and lifecycle status.
Endpoint
Returns 200 with a single Subagent. The query does not start or resume a subagent, and does not create resources.
/agents/sessions/{session_id}/subagents/{subagent_id}Path parameters
session_idstringRequiredSession ID, for example sess_xxx
subagent_idstringRequiredStable subagent ID, for example subagent_xxx
The path hierarchy must match. If the subagent does not belong to the session, or belongs to another workspace, no data is returned.
Request example
curl "$BASE_URL/agents/sessions/sess_xxx/subagents/subagent_xxx" \
-H "Authorization: Bearer $DASHSCOPE_API_KEY"
subagent = client.beta.agents.sessions.subagents.retrieve(
"subagent_xxx", session_id="sess_xxx"
)
print(subagent.status)
Response fields
idstringStable subagent ID
objectstringSubagent object type, fixed as agent.session.subagent
session_idstringOwning session
parent_agent_idstringParent agent
namestring / nullDisplay name
instructionsarray / nullPublic instruction content
statusstringSubagent status: active or closed
opened_atintegerOpen time in Unix seconds
closed_atinteger / nullClose time in Unix seconds; null before the subagent is closed
active can be idle and waiting; it does not mean the subagent is continuously running. closed_at is null before the subagent is closed.
Response example
{
"id": "subagent_xxx",
"object": "agent.session.subagent",
"session_id": "sess_xxx",
"parent_agent_id": "agent_xxx",
"name": "researcher",
"instructions": null,
"status": "active",
"opened_at": 1794118835,
"closed_at": null
}
Error codes
| HTTP status | Error type / code | Solution |
|---|---|---|
404 | not_found_error / not_found_error | Confirm that the session and subagent 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 |