跳转到内容
EN

列出线程

先调用「创建会话」,用返回的会话 ID 替换示例 ID。

GET/agent/v1/sessions/{session_id}/threads◐ 部分支持

Claude 官方文档 ↗

请求参数

  • session_idstring必填

    path: 会话 ID(sesn_...),由 sessions.create 或 sessions.list 返回。资源和线程调用的 session_id 查询参数也接受同一 ID,且必须与路径值一致。

  • limitnumber可选

    query: Number of items per page.

  • pagestring可选

    query: 不透明分页游标:原样传入上一响应的 next_page 值。第一页省略。来自不同查询或格式错误的游标返回 400。

返回

200

按 created_at 升序返回主线程及全部子线程。线程 id 为 sthr_ 加所属会话 id 的后缀;子线程的 parent_thread_id 指向主线程,session_id 始终为父会话。agent 是实际运行的定义,内置类型的 name 为类型名,未注册的 id/version 为 null。归档子线程的 status 为 terminated,archived_at 为归档时间;stats/usage 无线程级追踪时如实为 null。

错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码

请求示例

curl
# 先调用「创建会话」,用返回的会话 ID 替换示例 ID。
curl https://api.deepraxis.com/agent/v1/sessions/sesn_123/threads \
  -H "Authorization: Bearer $PRAXIS_API_KEY"
Python
# 先调用「创建会话」,用返回的会话 ID 替换示例 ID。
import requests

opts = dict(
    base_url="https://api.deepraxis.com/agent",
    api_key="$PRAXIS_API_KEY",
)

# /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
resp = requests.get(
    f"{opts['base_url']}/v1/sessions/sesn_123/threads",
    headers={"Authorization": f"Bearer {opts['api_key']}"},
)
print(resp.status_code, resp.json())
TypeScript
// 先调用「创建会话」,用返回的会话 ID 替换示例 ID。
const opts = {
  baseURL: "https://api.deepraxis.com/agent",
  apiKey: "$PRAXIS_API_KEY",
};

// /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
const resp = await fetch(`${opts.baseURL}/v1/sessions/sesn_123/threads`, {
  headers: { Authorization: `Bearer ${opts.apiKey}` },
});
console.log(resp.status, await resp.json());

响应示例 200

{
  "data": [
    {
      "id": "sthr_c9b6077486644badbfc0694a2d224abc",
      "type": "session_thread",
      "parent_thread_id": null,
      "session_id": "sesn_c9b6077486644badbfc0694a2d224abc",
      "agent": {
        "id": "agent_7838e080-8ac6-471d-887c-a7595de1afcb",
        "type": "agent",
        "name": "文档助手(已更新)",
        "description": null,
        "system": "用一句话简短回答。",
        "model": {
          "id": "deepseek-flash"
        },
        "version": 2,
        "tools": [],
        "skills": [],
        "mcp_servers": []
      },
      "archived_at": null,
      "created_at": "2026-09-29T08:30:16.285Z",
      "updated_at": "2026-09-29T08:30:21.522Z",
      "status": "idle",
      "stats": null,
      "usage": null
    }
  ],
  "next_page": null
}

响应

HTTP 200

Successful response

application/json

名称 类型 说明
data array<object> Items of this page, in the order requested by the call.
data[].id string Unique identifier for this thread.
data[].agent object The resolved agent a session_thread runs.
data[].archived_at null | string A timestamp in RFC 3339 format
data[].created_at string A timestamp in RFC 3339 format
data[].parent_thread_id null | string Parent thread that spawned this thread. Null for the primary thread.
data[].session_id string The session this thread belongs to.
data[].stats null | object Timing statistics for a session thread.
data[].status string SessionThreadStatus enum
data[].type string Always session_thread. An execution thread of a session.
data[].updated_at string A timestamp in RFC 3339 format
data[].usage null | object Cumulative token usage for a session thread across all turns.
next_page string | null Opaque cursor for the next page: pass it unchanged as page to continue. Null when this is the last page.