读取线程
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
GET
/agent/v1/sessions/{session_id}/threads/{thread_id}◐ 部分支持请求参数
session_idstring必填path: 会话 ID(sesn_...),由 sessions.create 或 sessions.list 返回。资源和线程调用的 session_id 查询参数也接受同一 ID,且必须与路径值一致。
thread_idstring必填path: 执行线程 ID(sthr_...),取自 sessions.threads.list;主线程 ID 与会话自身的线程相同。未知或其他组织的 ID 返回 404。
session_idstring必填query: 会话 ID(sesn_...),由 sessions.create 或 sessions.list 返回。资源和线程调用的 session_id 查询参数也接受同一 ID,且必须与路径值一致。
返回
200
返回本会话的主线程或子线程,与列表项逐字段一致。其他会话的线程、未知线程或非 sthr_ id 一律返回 404,不泄露其存在性。
错误按 Anthropic 错误格式返回(type / message / request_id),参见 错误码
请求示例
curl
# 先调用「创建会话」,用返回的会话 ID 替换示例 ID。
curl https://api.deepraxis.com/agent/v1/sessions/sesn_123/threads/sthr_123 \
-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/sthr_123",
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/sthr_123`, {
headers: { Authorization: `Bearer ${opts.apiKey}` },
});
console.log(resp.status, await resp.json());响应示例 200
{
"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
}响应
HTTP 200
Successful response
application/json
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this thread. |
| agent | object | The resolved agent a session_thread runs. |
| agent.model | string | object | The advisor model id. / Model identifier and configuration. |
| agent.type | string | Always advisor. An advisor whose model is consulted for advice in a separate thread (at most one per coordinator). / Always agent. A roster member that refers to an agent by id and pinned version. |
| agent.id | string | Agent id (agent_...). Pass it as agent when creating a session and as agent_id in agent calls. |
| agent.description | null | string | Free-text description of what the agent is for; null when none was set. |
| agent.mcp_servers | array<object> | Praxis extension: HTTP, SSE or trusted stdio MCP servers paired with mcp_toolset entries and saved with the agent version. |
| agent.name | string | Display name of the agent, as set on create or update. It is a label, not a unique key. |
| agent.skills | array<object> | Custom skills attached to the agent, each {type: "custom", skill_id, version?}: skill_id comes from skills.create or skills.list, at most 20 skills, no repeated skill_id. Omit version, or send "latest", to use the skill's newest version at the moment a session starts; a pinned version stays fixed. type anthropic returns 400: upload the skill and attach it as custom. On update, omit the field to keep the list, send an array to replace it, or send [] or null to clear it. |
| agent.system | null | string | System prompt given to the model at the start of every session of this agent; null when none was set. |
| agent.tools | array<object> | Tools of the agent: one agent_toolset_20260401 entry for the native tools (all resolved settings are returned, ready to send back on update), plus mcp_toolset entries and custom tool definitions. Custom calls emit agent.custom_tool_use and wait for user.custom_tool_result. Keep bash enabled to use codemode, skill and subagents. |
| agent.version | number | The latest saved version of the agent, the editable head; it differs from active_version after a save with apply false. Starts at 1 and increments each time the agent is modified. |
| archived_at | null | string | A timestamp in RFC 3339 format |
| created_at | string | A timestamp in RFC 3339 format |
| parent_thread_id | null | string | Parent thread that spawned this thread. Null for the primary thread. |
| session_id | string | The session this thread belongs to. |
| stats | null | object | Timing statistics for a session thread. |
| stats.active_seconds | number | Cumulative time in seconds the thread spent actively running. Excludes idle time. |
| stats.duration_seconds | number | Elapsed time since thread creation in seconds. For archived threads, frozen at the final update. |
| stats.startup_seconds | number | Time in seconds for the thread to begin running. Zero for child threads, which start immediately. |
| status | string | SessionThreadStatus enum |
| type | string | Always session_thread. An execution thread of a session. |
| updated_at | string | A timestamp in RFC 3339 format |
| usage | null | object | Cumulative token usage for a session thread across all turns. |
| usage.active_seconds | number | Cumulative time in seconds this thread spent in running status. Equal to stats.active_seconds; surfaced here so a thread's usage carries every quantity its cost is priced on. |
| usage.cache_creation | object | Prompt-cache creation token usage broken down by cache lifetime. |
| usage.cache_read_input_tokens | number | Total tokens read from prompt cache. |
| usage.input_tokens | number | Total input tokens consumed across all turns. |
| usage.list_cost | null | object | A monetary amount in a specific currency. |
| usage.output_tokens | number | Total output tokens generated across all turns. |
| usage.server_tool_use | null | object | Cumulative count of server-executed tool invocations, broken down by tool. |