Skip to main content

列出 Subagent Turn 的 Item

分页查询指定子 Agent Turn 的 Item,核对消息、工具调用和推理摘要。

接口

GET /agents/sessions/{session_id}/subagents/{subagent_id}/turns/{turn_id}/items 返回指定子 Agent Turn 的 Item。成功返回 200。查询不启动或恢复子 Agent,也不创建资源。

路径参数

session_id string (必选)Session ID,例如 sess_xxxsubagent_id string (必选)稳定的子 Agent ID,例如 subagent_xxxturn_id string (必选)公开 Turn ID,例如 turn_xxx路径上下级必须匹配。Turn 不属于该子 Agent 或该 Session 时不返回数据。

查询参数

limit integer (可选)每页数量,范围 1–100,默认 20order string (可选)排序方向,asc 或 desc,默认 descafter string (可选)上一页的 last_id;结果不包含游标项before 会被忽略,不用于反向分页。使用 order 和 after 翻页。

请求示例

curl --get "$BASE_URL/agents/sessions/sess_xxx/subagents/subagent_xxx/turns/turn_xxx/items" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  --data-urlencode "limit=20" \
  --data-urlencode "order=asc"

响应字段

列表信封:object string列表对象类型,固定为 listdata array<Item>当页 Item;空时为 []first_id string / null当页首项 ID。空页为 nulllast_id string / null当页末项 ID。空页为 null。后续 after 使用该值has_more boolean当前检索方向是否还有下一页每个 Item 都有 id、turn_id 和 type,业务字段平铺在对象顶层。Item 类型和内容片段说明见列出 Item。持久 Item 采用终结内容。SSE 的 item.added 可展示进行中状态,实时未完成 Item 不保证可在列表查询到。

响应示例

{
  "object": "list",
  "data": [
    {
      "id": "msg_xxx",
      "turn_id": "turn_xxx",
      "type": "message",
      "status": "completed",
      "role": "assistant",
      "phase": "final_answer",
      "content": [{"type": "output_text", "text": "完成"}]
    }
  ],
  "first_id": "msg_xxx",
  "last_id": "msg_xxx",
  "has_more": false
}
{
  "object": "list",
  "data": [],
  "first_id": null,
  "last_id": null,
  "has_more": false
}

错误码

HTTP 状态码错误类型 / 错误码解决方案
400invalid_request_error / invalid_request_error按查询参数说明修正 limit、order;使用本集合上一页返回的 last_id 作为 after
404not_found_error / not_found_error确认 Session、Subagent、Turn 存在且属于同一工作空间,并使用匹配的路径层级
502server_error / agents_api_upstream_unavailable稍后重试;持续失败时提交工单并提供响应头中的 x-request-id