AnthropicClaude 托管智能体
归档线程
归档一个执行线程;归档后不再接收新事件。
先调用「创建会话」,用返回的会话 ID 替换示例 ID。
POST
/anthropic/v1/sessions/{session_id}/threads/{thread_id}/archive◐ 部分支持请求参数
session_idstring必填path: 会话 ID(路径或查询参数)。
thread_idstring必填path: 路径参数:线程 ID。
session_idstring必填query: 会话 ID(路径或查询参数)。
返回
200
主线程沿用会话归档动作;子线程仅归档对应子会话,不归档父会话或其他子线程。子线程归档后 status 为 terminated,带 archived_at;历史事件仍可读。
错误按 Claude Managed Agents 格式返回,参见 错误码
响应
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 | |
| agent.id | string | |
| agent.description | null | string | |
| agent.mcp_servers | array<object> | |
| agent.name | string | |
| agent.skills | array<object> | |
| agent.system | null | string | |
| agent.tools | array<object> | |
| agent.version | number | |
| 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 | |
| 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. |