List a session's subagents and inspect names, status, and lifecycle timestamps.
Endpoint
GET /agents/sessions/{session_id}/subagents
Returns the session's subagent list. The root agent is not returned as a subagent. Returns 200 on success. The query does not start or resume a subagent, and does not create resources.
Path parameters
| Field | Required | Type | Description |
|---|---|---|---|
session_id | Yes | string | Session ID, for example sess_xxx |
Request parameters
| Field | Required | Type | Description |
|---|---|---|---|
limit | No | integer | Page size, range 1–100, default 20 |
order | No | string | Sort direction, asc or desc, default desc |
after | No | string | The last_id from the previous page; the cursor item is excluded |
before is ignored and is not used for reverse pagination. Use order and after to page.
Request example
Response example
Response fields
List envelope:
| Field | Type | Description |
|---|---|---|
object | string | List object type, fixed as list |
data | array<Subagent> | Subagents on this page; [] when empty |
first_id | string / null | First subagent ID on this page; null for an empty page |
last_id | string / null | Last subagent ID on this page; null for an empty page; use it as after |
has_more | boolean | Whether the current scan direction has another page |
id | string | Stable subagent ID |
object | string | Subagent object type, fixed as agent.session.subagent |
session_id | string | Owning session |
parent_agent_id | string | Parent agent |
name | string / null | Display name |
instructions | array / null | Public instruction content |
status | string | Subagent status: active or closed |
opened_at | integer | Open time in Unix seconds |
closed_at | integer / null | Close 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. History queries do not start or resume subagents.
Error codes
| HTTP status | Error type / code | Solution |
|---|---|---|
400 | invalid_request_error / invalid_request_error | Fix limit and order as described in the query parameters; use the last_id returned by the previous page as after |
404 | not_found_error / not_found_error | Use a session ID that exists and has not been deleted in the current workspace |
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 |