Anthropic 兼容接口

2026-10-20

Anthropic 兼容接口

基础地址

加载中…

接入

加载中…

端点

方法路径说明支持
POST/v1/messages发送消息● 支持
POST/v1/messages/count_tokens统计 token◐ 部分支持
GET/v1/models列出模型● 支持
POST/v1/files上传文件● 支持
GET/v1/files列出文件● 支持
GET/v1/files/{file_id}读取文件信息● 支持
DELETE/v1/files/{file_id}删除文件● 支持
GET/v1/files/{file_id}/content下载文件内容● 支持

与官方的差异

  • 发送消息:支持顶层 cache_control、top_k、metadata.user_id、output_config.format、thinking.display 与 anthropic-user-profile-id。仅原生 Anthropic 能表达的选项会限制路由;没有可保真供应时返回参数错误。anthropic-workspace-id 尚未支持,非空值返回 400。container、inference_geo 与 service_tier 接受并忽略;其他扩展见字段支持标注。 未知顶层字段原样转发给同协议上游,由上游决定是否接受;已声明字段的类型与取值范围仍会校验,不合法时返回 400 并点名字段。
  • 统计 token:按模型族校准的估算值(包括中文和工具定义),响应头为 x-praxis-token-count: estimated;不能用作精确用量或计费依据。
  • 列出模型:始终返回 capabilities、max_input_tokens、max_tokens;目录无法确定的值为 null,不将总上下文窗口冒充独立输入上限。非空 anthropic-workspace-id 返回 400;尚不按 anthropic-beta 选择目录版本。
  • 上传文件:SDK 0.128.0 上传参数为表单 file 和可选的表单 expires_in_seconds(3600–7776000 秒)。其他表单字段(包括 purpose)返回 400 invalid_request_error,消息形如 "purpose: Extra inputs are not permitted";查询参数只接受 SDK 自带的 beta,其他查询参数返回 400,查询参数 expires_in_seconds 会提示改放表单。平台将上传文件记为 user_data;不支持 anthropic-workspace-id,请求携带该头时返回 400。
  • 列出文件:按创建时间从新到旧排列。用 after_id / before_id 与 limit 分页(两者同时给返回 400),也可以用 page 游标(next_page);三者只能选一个。响应包含 data、has_more、first_id、last_id 与 next_page。ids(最多 100 个去重 ID)与 page、after_id、before_id、limit 互斥。scope_id 需要 anthropic-beta: managed-agents-2026-04-01 请求头;缺少该头返回 400,不存在的会话范围返回 404。anthropic-workspace-id 返回 400。
  • 下载文件内容:只有代码执行工具生成的文件可以下载;你自己上传的文件(用途为 user_data)下载会返回 400 invalid_request_error,这与 Anthropic 官方的行为一致。

参数与字段的权威定义以 Anthropic 官方文档为准。

错误按 Anthropic 格式返回,参见错误;额度与响应头参见限流。

发送消息

POST /anthropic/v1/messages● 支持

Anthropic 官方文档 ↗

请求体

  • modelstring必填◐ 部分支持

    Body param: The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

    deepseek-v4-pro、glm-5.3-flash、qwen3.8-flash、claude-opus-5 可调用;deepseek-v4-flash 在此协议面返回 400。

  • max_tokensnumber必填

    Body param: The maximum number of tokens to generate before stopping. Note that our models may stop _before_ reaching this maximum. This parameter only specifies the absolute maximum number of tokens to generate. Set to `0` to populate the [prompt cache](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pre-warming-the-cache) without generating a response. Different models have different maximum values for this parameter. See [models](https://platform.claude.com/docs/en/about-claude/models/overview) for details.

    限制输出 token,思考也占用预算。

  • messagesarray必填◐ 部分支持

    Body param: Input messages. Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. Example with a single `user` message: ```json [{ "role": "user", "content": "Hello, Claude" }] ``` Example with multiple conversational turns: ```json [ { "role": "user", "content": "Hello there." }, { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" }, { "role": "user", "content": "Can you explain LLMs in plain English?" } ] ``` Example with a partially-filled response from Claude: ```json [ { "role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" }, { "role": "assistant", "content": "The best answer is (" } ] ``` Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: ```json { "role": "user", "content": "Hello, Claude" } ``` ```json { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] } ``` See [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages). Note that if you want to include a [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. There is a limit of 100,000 messages in a single request.

    文本和工具往返生效;document 的托管 file_id 返回 400,qwen3.8-flash 可读取内联 PDF;图片有模型尺寸限制。

    ▸ 展开子字段(2)
    • contentstring | array必填

      Message content: a plain string (shorthand for one text block) or an array of content blocks such as text, image, document, tool_use and tool_result.

    • rolestring必填

      Who produced the message. Use user for your turns and assistant to replay earlier model turns; system-role messages are accepted by the shape but system instructions normally go in the top-level system field.

  • streamboolean可选◐ 部分支持

    Body param: Whether to incrementally stream the response using server-sent events. See [streaming](https://platform.claude.com/docs/en/build-with-claude/streaming) for details.

    流式正文和工具事件可用;可能在正文前出现额外 message_delta,message_start 的用量为 0。

  • systemstring | array可选

    Body param: System prompt. A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).

    已验证生效。

  • temperaturenumber可选
  • top_pnumber可选
  • top_knumber可选
  • stop_sequencesarray可选◐ 部分支持

    Body param: Custom text sequences that will cause the model to stop generating. Our models will normally stop when they have naturally completed their turn, which will result in a response `stop_reason` of `"end_turn"`. If you want the model to stop generating when it encounters custom strings of text, you can use the `stop_sequences` parameter. If the model encounters one of the custom sequences, the response `stop_reason` value will be `"stop_sequence"` and the response `stop_sequence` value will contain the matched stop sequence.

    deepseek-v4-pro、qwen3.8-flash 生效;glm-5.3-flash 文本截断但 stop_reason 和 stop_sequence 未准确反映。

  • toolsarray可选

    Body param: Definitions of tools that the model may use. If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)). Each tool definition includes: - `name`: Name of the tool. - `description`: Optional, but strongly-recommended description of the tool. - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. For example, if you defined `tools` as: ```json [ { "name": "get_stock_price", "description": "Get the current stock price for a given ticker symbol.", "input_schema": { "type": "object", "properties": { "ticker": { "type": "string", "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." } }, "required": ["ticker"] } } ] ``` And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: ```json [ { "type": "tool_use", "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", "name": "get_stock_price", "input": { "ticker": "^GSPC" } } ] ``` You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: ```json [ { "type": "tool_result", "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", "content": "259.75 USD" } ] ``` Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. See our [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) for more details.

    已验证生效。

  • ▸ 更多参数(16)
    • tool_choiceobject可选◐ 部分支持

      Body param: How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.

      qwen3.8-flash 四种模式生效;deepseek-v4-pro 忽略 any/tool/none;glm-5.3-flash 忽略 none。

      ▸ 展开子字段(3)
      • typestring必填
        取值 none
      • disable_parallel_tool_useboolean可选○ 当前不生效

        Whether to disable parallel tool use. Defaults to `false`. If set to `true`, the model will output exactly one tool use.

        接受但当前不生效。true 仍可能返回多个工具调用。

      • namestring必填

        The name of the tool to use.

    • metadataobject可选◐ 部分支持

      Body param: An object describing metadata about the request.

      接受 metadata;metadata.user_id 由同协议线路传递,不承诺上游回显。

      ▸ 展开子字段(1)
      • user_idstring可选

        An external identifier for the user who is associated with the request. This should be a uuid, hash value, or other opaque identifier. Anthropic may use this id to help detect abuse. Do not include any identifying information such as name, email address, or phone number.

    • cache_controlobject可选◐ 部分支持

      Body param: Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request.

      deepseek-v4-pro、qwen3.8-flash、glm-5.3-flash 有隐式缓存命中,但不能据此确认标记生效;claude-opus-5 未命中缓存,ttl=1h 未见效果。

      ▸ 展开子字段(2)
      • typestring必填

        Always `ephemeral`. Discriminator that marks this object as a CacheControlEphemeral in a `type`-tagged union.

        取值 ephemeral
      • ttlstring可选

        The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.

    • containerstring | object可选○ 当前不生效

      接受并忽略 container;平台尚未实现此能力。

      ▸ 展开子字段(2)
      • idstring可选

        Container id

      • skillsarray可选

        List of skills to load in the container

    • inference_geostring可选○ 当前不生效

      接受并忽略 inference_geo;平台尚未实现此能力。

    • output_configobject可选

      Body param: Configuration options for the model's output, such as the output format.

      ▸ 展开子字段(2)
      • effortstring可选◐ 部分支持

        All possible effort levels.

        deepseek-v4-pro 仅 high/xhigh 可用,其余返回 400;qwen3.8-flash 全档返回 400;glm-5.3-flash 接受各档但消耗不随档位单调变化。

      • formatobject可选◐ 部分支持

        A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)

        json_schema 在 deepseek-v4-pro、qwen3.8-flash 生效;glm-5.3-flash 与 thinking 同传返回 400。

    • service_tierstring可选○ 当前不生效

      接受并忽略 service_tier;平台尚未实现此能力。

    • thinkingobject可选◐ 部分支持

      Body param: Configuration for enabling Claude's extended thinking. When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.

      disabled 在 deepseek-v4-pro、qwen3.8-flash 生效;glm-5.3-flash 携带任何 thinking 都返回 400。adaptive 在已测的 deepseek-v4-pro、qwen3.8-flash 也返回 400。

      ▸ 展开子字段(3)
      • budget_tokensnumber必填◐ 部分支持

        Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. Must be ≥1024 and less than `max_tokens`. See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.

        deepseek-v4-pro、qwen3.8-flash 接受,但预算不构成可靠上限;glm-5.3-flash 返回 400。

      • typestring必填
        取值 adaptive
      • displaystring可选○ 当前不生效

        Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.

        接受但当前不生效。omitted 仍返回完整思考内容。

    • context_managementobject可选○ 当前不生效

      接受并忽略 context_management;平台尚未实现此能力。

    • diagnosticsobject可选○ 当前不生效

      接受并忽略 diagnostics;平台尚未实现此能力。

    • mcp_serversarray可选○ 当前不生效

      接受并忽略 mcp_servers;平台尚未实现此能力。

    • speedstring可选○ 当前不生效

      接受并忽略 speed;平台尚未实现此能力。

    • output_formatobject可选○ 当前不生效

      接受并忽略此旧字段;结构化输出使用 output_config.format。

    • compactionobject可选○ 未支持

      已识别 compaction;尚未实现,传入返回 400 并明确说明不支持。

    • fallback_credit_tokenstring可选○ 未支持

      已识别 fallback_credit_token;尚未实现,传入返回 400 并明确说明不支持。

    • fallbacksstring可选○ 未支持

      已识别 fallbacks;尚未实现,传入返回 400 并明确说明不支持。

返回

200

stream=true 时以 SSE 增量返回(text/event-stream)。

支持顶层 cache_control、top_k、metadata.user_id、output_config.format、thinking.display 与 anthropic-user-profile-id。仅原生 Anthropic 能表达的选项会限制路由;没有可保真供应时返回参数错误。anthropic-workspace-id 尚未支持,非空值返回 400。container、inference_geo 与 service_tier 接受并忽略;其他扩展见字段支持标注。 未知顶层字段原样转发给同协议上游,由上游决定是否接受;已声明字段的类型与取值范围仍会校验,不合法时返回 400 并点名字段。

错误按 Anthropic 格式返回,参见 错误码

响应

HTTP 200

Message created

application/json

名称类型说明
idstringUnique object identifier. The format and length of IDs may change over time.
containernull | objectInformation about the container used in the request (for the code execution tool)
container.idstringIdentifier for the container used in this request
container.expires_atstringThe time at which the container will expire.
container.skillsnull | array<object>Skills loaded in the container
contentarray<object>Content generated by the model. This is an array of content blocks, each of which has a `type` that determines its shape. Example: ```json [{ "type": "text", "text": "Hi, I'm Claude." }] ``` If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. For example, if the input `messages` were: ```json [ { "role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" }, { "role": "assistant", "content": "The best answer is (" } ] ``` Then the response `content` might be: ```json [{ "type": "text", "text": "B)" }] ```
content[].citationsnull | array<object>Citations supporting the text block. The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.
content[].textstringThe text generated by the model.
content[].typestringAlways `text`. Discriminator that marks this object as a TextBlock in a `type`-tagged union. / Always `thinking`. Discriminator that marks this object as a ThinkingBlock in a `type`-tagged union. / Always `redacted_thinking`. Discriminator that marks this object as a RedactedThinkingBlock in a `type`-tagged union. / Always `tool_use`. Discriminator that marks this object as a ToolUseBlock in a `type`-tagged union. / Always `server_tool_use`. Discriminator that marks this object as a ServerToolUseBlock in a `type`-tagged union. / Always `web_search_tool_result`. Discriminator that marks this object as a WebSearchToolResultBlock in a `type`-tagged union. / Always `web_fetch_tool_result`. Discriminator that marks this object as a WebFetchToolResultBlock in a `type`-tagged union. / Always `code_execution_tool_result`. Discriminator that marks this object as a CodeExecutionToolResultBlock in a `type`-tagged union. / Always `bash_code_execution_tool_result`. Discriminator that marks this object as a BashCodeExecutionToolResultBlock in a `type`-tagged union. / Always `text_editor_code_execution_tool_result`. Discriminator that marks this object as a TextEditorCodeExecutionToolResultBlock in a `type`-tagged union. / Always `tool_search_tool_result`. Discriminator that marks this object as a ToolSearchToolResultBlock in a `type`-tagged union. / Always `container_upload`. Discriminator that marks this object as a ContainerUploadBlock in a `type`-tagged union.
content[].signaturestringA value used to verify that this thinking block was generated by Claude when it is passed back to the API. This is an opaque field and should not be interpreted or parsed. When passing thinking blocks back to the API (required when using tools with extended thinking), pass them back exactly as received, with this field intact. See extended thinking for details.
content[].thinkingstringThe text of Claude's thinking process for this block.
content[].datastringThe contents of this redacted thinking block, returned when portions of the model's thinking were safety-redacted. This field is opaque and encrypted, with no readable content. Pass `redacted_thinking` blocks back to the API unchanged when continuing a multi-turn conversation. See extended thinking for details.
content[].idstringId of the tool call; send it back as tool_use_id in the tool_result block that answers it. / Id of the server tool call; the matching result block repeats it as tool_use_id.
content[].callerobjectWhich party invoked the tool: the model directly or a code execution tool. / Which party invoked the server tool: the model directly or a code execution tool. / Which party invoked the search: the model directly or a code execution tool. / Which party invoked the fetch: the model directly or a code execution tool.
content[].inputanyArguments the model chose, as a JSON object that follows the tool's input_schema. / Arguments the model passed to the server tool, as a JSON object.
content[].namestringName of the tool the model wants to call. / Name of the server tool the model called, such as web_search, web_fetch or code_execution.
content[].toolset_namenull | stringFor a toolset member tool_use, the toolset family.
content[].contentobject | array<object> | object | object | object | object | objectSearch results (array of web_search_result blocks) or an error object. / The fetched document or an error object. / Result of the code execution: a result block, an encrypted result block, or an error object. / Result of the bash command: a result block or an error object. / Result of the text editor command: a view, create or str_replace result block, or an error object. / Result of the tool search: a search result block that lists tool references, or an error object.
content[].tool_use_idstringId of the web_search server tool call this result belongs to. / Id of the web_fetch server tool call this result belongs to. / Id of the code_execution server tool call this result belongs to. / Id of the bash_code_execution server tool call this result belongs to. / Id of the text_editor_code_execution server tool call this result belongs to. / Id of the tool search server tool call this result belongs to.
content[].file_idstringId of the file that was uploaded into the code execution container.
modelstringThe model that will complete your prompt. See models for additional details and options.
rolestringConversational role of the generated message. This will always be `"assistant"`.
stop_detailsnull | objectStructured information about a refusal.
stop_details.categorynull | stringThe policy category that triggered a refusal. - `cyber` - The request could enable cyber harm, such as malware or exploit development. Benign cybersecurity work can also trigger this category. - `bio` - The request could enable biological harm, such as dangerous lab methods. Beneficial life sciences work can also trigger this category. - `frontier_llm` - The request could assist the development of competing AI models, which is restricted under Anthropic's commercial terms. Benign machine learning work can also trigger this category. - `reasoning_extraction` - The request asks the model to reproduce its internal reasoning in the response text. To get reasoning in a structured form instead, use adaptive thinking. - `general_harms` - The request could be related to an area that was determined as harmful. Benign work might sometimes trigger this category.
stop_details.explanationnull | stringHuman-readable explanation of the refusal. This text is not guaranteed to be stable. `null` when no explanation is available for the category.
stop_details.typestringAlways `refusal`. Discriminator that marks this object as a RefusalStopDetails in a `type`-tagged union.
stop_reasonnull | stringThe reason that we stopped. This may be one the following values: - `"end_turn"`: the model reached a natural stopping point - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated - `"tool_use"`: the model invoked one or more tools - `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. - `"refusal"`: when streaming classifiers intervene to handle potential policy violations - `"model_context_window_exceeded"`: we exceeded the model's context window In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise.
stop_sequencenull | stringWhich custom stop sequence was generated, if any. This value will be a non-null string if one of your custom stop sequences was generated.
typestringObject type. For Messages, this is always `"message"`.
usageobjectBilling and rate-limit usage. Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. For example, `output_tokens` will be non-zero, even for an empty string response from Claude. Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.
usage.cache_creationnull | objectBreakdown of cached tokens by TTL
usage.cache_creation_input_tokensnull | numberThe number of input tokens used to create the cache entry.
usage.cache_read_input_tokensnull | numberThe number of input tokens read from the cache.
usage.inference_geonull | stringThe geographic region where inference was performed for this request.
usage.input_tokensnumberThe number of input tokens which were used.
usage.output_tokensnumberThe number of output tokens which were used.
usage.output_tokens_detailsnull | objectBreakdown of output tokens by category. `output_tokens` remains the inclusive, authoritative total used for billing. This object provides a read-only decomposition for observability — for example, how many of the billed output tokens were spent on internal reasoning that may have been summarized before being returned to you.
usage.server_tool_usenull | objectThe number of server tool requests.
usage.service_tiernull | stringIf the request used the priority, standard, or batch tier.

text/event-stream — chunk / 事件对象

名称类型说明
deltaobjectFinal fields of the message sent with message_delta: why generation stopped and the container. / The incremental change to the content block at index.
delta.containernull | objectInformation about the container used in the request (for the code execution tool)
delta.stop_detailsnull | objectStructured information about a refusal.
delta.stop_reasonnull | stringWhy the model stopped; null while the message is still generating.
delta.stop_sequencenull | stringThe custom stop sequence that was matched; null unless stop_reason is stop_sequence.
delta.textstringText fragment to append to the text block.
delta.typestringAlways `text_delta`. Discriminator that marks this object as a TextDelta in a `type`-tagged union. / Always `input_json_delta`. Discriminator that marks this object as a InputJSONDelta in a `type`-tagged union. / Always `citations_delta`. Discriminator that marks this object as a CitationsDelta in a `type`-tagged union. / Always `thinking_delta`. Discriminator that marks this object as a ThinkingDelta in a `type`-tagged union. / Always `signature_delta`. Discriminator that marks this object as a SignatureDelta in a `type`-tagged union.
delta.partial_jsonstringFragment of the tool input JSON string; concatenate all fragments of a block and parse the result when the block stops.
delta.citationobjectThe citation to attach to the text block being streamed.
delta.thinkingstringThe incremental `thinking` text for this content block. Concatenate the `thinking` values of successive `thinking_delta` events to assemble the block's full `thinking` value.
delta.signaturestringThe `signature` for this thinking block: an opaque value used to verify that the block was generated by Claude when it is passed back to the API. Delivered in a `signature_delta` event just before the block's `content_block_stop` event.
typestringAlways `message_delta`. Discriminator that marks this object as a RawMessageDeltaEvent in a `type`-tagged union. / Always `content_block_delta`. Discriminator that marks this object as a RawContentBlockDeltaEvent in a `type`-tagged union. / Always `message_start`. Discriminator that marks this object as a RawMessageStartEvent in a `type`-tagged union. / Always `message_stop`. Discriminator that marks this object as a RawMessageStopEvent in a `type`-tagged union. / Always `content_block_start`. Discriminator that marks this object as a RawContentBlockStartEvent in a `type`-tagged union. / Always `content_block_stop`. Discriminator that marks this object as a RawContentBlockStopEvent in a `type`-tagged union.
usageobjectBilling and rate-limit usage. Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. For example, `output_tokens` will be non-zero, even for an empty string response from Claude. Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.
usage.cache_creation_input_tokensnull | numberThe cumulative number of input tokens used to create the cache entry.
usage.cache_read_input_tokensnull | numberThe cumulative number of input tokens read from the cache.
usage.input_tokensnull | numberThe cumulative number of input tokens which were used.
usage.output_tokensnumberThe cumulative number of output tokens which were used.
usage.output_tokens_detailsnull | objectBreakdown of output tokens by category. `output_tokens` remains the inclusive, authoritative total used for billing. This object provides a read-only decomposition for observability — for example, how many of the billed output tokens were spent on internal reasoning that may have been summarized before being returned to you.
usage.server_tool_usenull | objectThe number of server tool requests.
indexnumberZero-based index of the content block this delta applies to. / Zero-based index of the content block that starts. / Zero-based index of the content block that ends.
messageobjectThe complete Message object being started; its content is empty at message_start and filled by the following content_block events.
message.idstringUnique object identifier. The format and length of IDs may change over time.
message.containernull | objectInformation about the container used in the request (for the code execution tool)
message.contentarray<object>Content generated by the model. This is an array of content blocks, each of which has a `type` that determines its shape. Example: ```json [{ "type": "text", "text": "Hi, I'm Claude." }] ``` If the request input `messages` ended with an `assistant` turn, then the response `content` will continue directly from that last turn. You can use this to constrain the model's output. For example, if the input `messages` were: ```json [ { "role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" }, { "role": "assistant", "content": "The best answer is (" } ] ``` Then the response `content` might be: ```json [{ "type": "text", "text": "B)" }] ```
message.modelstringThe model that will complete your prompt. See models for additional details and options.
message.rolestringConversational role of the generated message. This will always be `"assistant"`.
message.stop_detailsnull | objectStructured information about a refusal.
message.stop_reasonnull | stringThe reason that we stopped. This may be one the following values: - `"end_turn"`: the model reached a natural stopping point - `"max_tokens"`: we exceeded the requested `max_tokens` or the model's maximum - `"stop_sequence"`: one of your provided custom `stop_sequences` was generated - `"tool_use"`: the model invoked one or more tools - `"pause_turn"`: we paused a long-running turn. You may provide the response back as-is in a subsequent request to let the model continue. - `"refusal"`: when streaming classifiers intervene to handle potential policy violations - `"model_context_window_exceeded"`: we exceeded the model's context window In non-streaming mode this value is always non-null. In streaming mode, it is null in the `message_start` event and non-null otherwise.
message.stop_sequencenull | stringWhich custom stop sequence was generated, if any. This value will be a non-null string if one of your custom stop sequences was generated.
message.typestringObject type. For Messages, this is always `"message"`.
message.usageobjectBilling and rate-limit usage. Anthropic's API bills and rate-limits by token counts, as tokens represent the underlying cost to our systems. Under the hood, the API transforms requests into a format suitable for the model. The model's output then goes through a parsing stage before becoming an API response. As a result, the token counts in `usage` will not match one-to-one with the exact visible content of an API request or response. For example, `output_tokens` will be non-zero, even for an empty string response from Claude. Total input tokens in a request is the summation of `input_tokens`, `cache_creation_input_tokens`, and `cache_read_input_tokens`.
content_blockobjectThe content block as it starts, with empty text or input to be filled by deltas.
content_block.citationsnull | array<object>Citations supporting the text block. The type of citation returned will depend on the type of document being cited. Citing a PDF results in `page_location`, plain text results in `char_location`, and content document results in `content_block_location`.
content_block.textstringThe text generated by the model.
content_block.typestringAlways `text`. Discriminator that marks this object as a TextBlock in a `type`-tagged union. / Always `thinking`. Discriminator that marks this object as a ThinkingBlock in a `type`-tagged union. / Always `redacted_thinking`. Discriminator that marks this object as a RedactedThinkingBlock in a `type`-tagged union. / Always `tool_use`. Discriminator that marks this object as a ToolUseBlock in a `type`-tagged union. / Always `server_tool_use`. Discriminator that marks this object as a ServerToolUseBlock in a `type`-tagged union. / Always `web_search_tool_result`. Discriminator that marks this object as a WebSearchToolResultBlock in a `type`-tagged union. / Always `web_fetch_tool_result`. Discriminator that marks this object as a WebFetchToolResultBlock in a `type`-tagged union. / Always `code_execution_tool_result`. Discriminator that marks this object as a CodeExecutionToolResultBlock in a `type`-tagged union. / Always `bash_code_execution_tool_result`. Discriminator that marks this object as a BashCodeExecutionToolResultBlock in a `type`-tagged union. / Always `text_editor_code_execution_tool_result`. Discriminator that marks this object as a TextEditorCodeExecutionToolResultBlock in a `type`-tagged union. / Always `tool_search_tool_result`. Discriminator that marks this object as a ToolSearchToolResultBlock in a `type`-tagged union. / Always `container_upload`. Discriminator that marks this object as a ContainerUploadBlock in a `type`-tagged union.
content_block.signaturestringA value used to verify that this thinking block was generated by Claude when it is passed back to the API. This is an opaque field and should not be interpreted or parsed. When passing thinking blocks back to the API (required when using tools with extended thinking), pass them back exactly as received, with this field intact. See extended thinking for details.
content_block.thinkingstringThe text of Claude's thinking process for this block.
content_block.datastringThe contents of this redacted thinking block, returned when portions of the model's thinking were safety-redacted. This field is opaque and encrypted, with no readable content. Pass `redacted_thinking` blocks back to the API unchanged when continuing a multi-turn conversation. See extended thinking for details.
content_block.idstringId of the tool call; send it back as tool_use_id in the tool_result block that answers it. / Id of the server tool call; the matching result block repeats it as tool_use_id.
content_block.callerobjectWhich party invoked the tool: the model directly or a code execution tool. / Which party invoked the server tool: the model directly or a code execution tool. / Which party invoked the search: the model directly or a code execution tool. / Which party invoked the fetch: the model directly or a code execution tool.
content_block.inputanyArguments the model chose, as a JSON object that follows the tool's input_schema. / Arguments the model passed to the server tool, as a JSON object.
content_block.namestringName of the tool the model wants to call. / Name of the server tool the model called, such as web_search, web_fetch or code_execution.
content_block.toolset_namenull | stringFor a toolset member tool_use, the toolset family.
content_block.contentobject | array<object> | object | object | object | object | objectSearch results (array of web_search_result blocks) or an error object. / The fetched document or an error object. / Result of the code execution: a result block, an encrypted result block, or an error object. / Result of the bash command: a result block or an error object. / Result of the text editor command: a view, create or str_replace result block, or an error object. / Result of the tool search: a search result block that lists tool references, or an error object.
content_block.tool_use_idstringId of the web_search server tool call this result belongs to. / Id of the web_fetch server tool call this result belongs to. / Id of the code_execution server tool call this result belongs to. / Id of the bash_code_execution server tool call this result belongs to. / Id of the text_editor_code_execution server tool call this result belongs to. / Id of the tool search server tool call this result belongs to.
content_block.file_idstringId of the file that was uploaded into the code execution container.

POST /anthropic/v1/messages/count_tokens◐ 部分支持

Anthropic 官方文档 ↗

请求体

  • modelstring必填

    Body param: The model that will complete your prompt. See [models](https://docs.anthropic.com/en/docs/models-overview) for additional details and options.

    必填并校验存在性,用于选择原生线路和本地分词器。

  • messagesarray必填◐ 部分支持

    Body param: Input messages. Our models are trained to operate on alternating `user` and `assistant` conversational turns. When creating a new `Message`, you specify the prior conversational turns with the `messages` parameter, and the model then generates the next `Message` in the conversation. Consecutive `user` or `assistant` turns in your request will be combined into a single turn. Each input message must be an object with a `role` and `content`. You can specify a single `user`-role message, or you can include multiple `user` and `assistant` messages. If the final message uses the `assistant` role, the response content will continue immediately from the content in that message. This can be used to constrain part of the model's response. Example with a single `user` message: ```json [{ "role": "user", "content": "Hello, Claude" }] ``` Example with multiple conversational turns: ```json [ { "role": "user", "content": "Hello there." }, { "role": "assistant", "content": "Hi, I'm Claude. How can I help you?" }, { "role": "user", "content": "Can you explain LLMs in plain English?" } ] ``` Example with a partially-filled response from Claude: ```json [ { "role": "user", "content": "What's the Greek name for Sun? (A) Sol (B) Helios (C) Sun" }, { "role": "assistant", "content": "The best answer is (" } ] ``` Each input message `content` may be either a single `string` or an array of content blocks, where each block has a specific `type`. Using a `string` for `content` is shorthand for an array of one content block of type `"text"`. The following input messages are equivalent: ```json { "role": "user", "content": "Hello, Claude" } ``` ```json { "role": "user", "content": [{ "type": "text", "text": "Hello, Claude" }] } ``` See [input examples](https://platform.claude.com/docs/en/build-with-claude/working-with-messages). Note that if you want to include a [system prompt](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role), you can use the top-level `system` parameter — there is no `"system"` role for input messages in the Messages API. There is a limit of 100,000 messages in a single request.

    原生路径保留消息;本地使用 o200k 或按模型族校准的估算,图片按已知模型规则估算,未知尺寸使用近似额度;不下载图片 URL。

    ▸ 展开子字段(2)
    • contentstring | array必填

      Message content: a plain string (shorthand for one text block) or an array of content blocks such as text, image, document, tool_use and tool_result.

    • rolestring必填

      Who produced the message. Use user for your turns and assistant to replay earlier model turns; system-role messages are accepted by the shape but system instructions normally go in the top-level system field.

  • systemstring | array可选◐ 部分支持

    Body param: System prompt. A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role. See our [guide to system prompts](https://platform.claude.com/docs/en/build-with-claude/prompt-engineering/claude-prompting-best-practices#give-claude-a-role).

    原生透传;本地计入估算。

  • toolsarray可选◐ 部分支持

    Body param: Definitions of tools that the model may use. If you include `tools` in your API request, the model may return `tool_use` content blocks that represent the model's use of those tools. You can then run those tools using the tool input generated by the model and then optionally return results back to the model using `tool_result` content blocks. There are two types of tools: **client tools** and **server tools**. The behavior described below applies to client tools. For [server tools](https://platform.claude.com/docs/en/agents-and-tools/tool-use/server-tools), see their individual documentation as each has its own behavior (e.g., the [web search tool](https://platform.claude.com/docs/en/agents-and-tools/tool-use/web-search-tool)). Each tool definition includes: - `name`: Name of the tool. - `description`: Optional, but strongly-recommended description of the tool. - `input_schema`: [JSON schema](https://json-schema.org/draft/2020-12) for the tool `input` shape that the model will produce in `tool_use` output content blocks. For example, if you defined `tools` as: ```json [ { "name": "get_stock_price", "description": "Get the current stock price for a given ticker symbol.", "input_schema": { "type": "object", "properties": { "ticker": { "type": "string", "description": "The stock ticker symbol, e.g. AAPL for Apple Inc." } }, "required": ["ticker"] } } ] ``` And then asked the model "What's the S&P 500 at today?", the model might produce `tool_use` content blocks in the response like this: ```json [ { "type": "tool_use", "id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", "name": "get_stock_price", "input": { "ticker": "^GSPC" } } ] ``` You might then run your `get_stock_price` tool with `{"ticker": "^GSPC"}` as an input, and return the following back to the model in a subsequent `user` message: ```json [ { "type": "tool_result", "tool_use_id": "toolu_01D7FLrfh4GYq7yT1ULFeyMV", "content": "259.75 USD" } ] ``` Tools can be used for workflows that include running client-side tools and functions, or more generally whenever you want the model to produce a particular JSON structure of output. See our [guide](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview) for more details.

    原生透传;本地计入定义与包装的估算。

  • tool_choiceobject可选◐ 部分支持

    Body param: How the model should use the provided tools. The model can use a specific tool, any available tool, decide by itself, or not use tools at all.

    原生透传;本地计入估算。

    ▸ 展开子字段(3)
    • typestring必填

      Disable tool calls for this request.

      取值 none
    • disable_parallel_tool_useboolean可选

      Whether to disable parallel tool use. Defaults to `false`. If set to `true`, the model will output exactly one tool use.

    • namestring必填

      The name of the tool to use.

  • cache_controlobject可选◐ 部分支持

    Body param: Top-level cache control automatically applies a cache_control marker to the last cacheable block in the request.

    原生路径保留消息内标记;计数不能预测缓存命中或计费。

    ▸ 展开子字段(2)
    • typestring必填

      Always `ephemeral`. Discriminator that marks this object as a CacheControlEphemeral in a `type`-tagged union.

      取值 ephemeral
    • ttlstring可选

      The time-to-live for the cache control breakpoint. This may be one the following values: - `5m`: 5 minutes - `1h`: 1 hour Defaults to `5m`. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching) for details.

  • output_configobject可选◐ 部分支持

    Body param: Configuration options for the model's output, such as the output format.

    原生路径透传;本地不承诺其附加模板的精确计数。

    ▸ 展开子字段(2)
    • effortstring可选

      All possible effort levels.

    • formatobject可选

      A schema to specify Claude's output format in responses. See [structured outputs](https://platform.claude.com/docs/en/build-with-claude/structured-outputs)

  • thinkingobject可选◐ 部分支持

    Body param: Configuration for enabling Claude's extended thinking. When enabled, responses include `thinking` content blocks showing Claude's thinking process before the final answer. Requires a minimum budget of 1,024 tokens and counts towards your `max_tokens` limit. See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.

    原生路径透传;本地不承诺思考模板精确计数。

    ▸ 展开子字段(3)
    • budget_tokensnumber必填

      Determines how many tokens Claude can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. Must be ≥1024 and less than `max_tokens`. See [extended thinking](https://platform.claude.com/docs/en/build-with-claude/extended-thinking) for details.

    • typestring必填

      Let the model choose its reasoning budget, subject to output_config.effort when supplied.

      取值 adaptive
    • displaystring可选

      Controls how thinking content appears in the response. When set to `summarized`, thinking is returned normally. When set to `omitted`, thinking content is redacted but a signature is returned for multi-turn continuity. Defaults to `summarized`.

返回

200

按模型族校准的估算值(包括中文和工具定义),响应头为 x-praxis-token-count: estimated;不能用作精确用量或计费依据。

错误按 Anthropic 格式返回,参见 错误码

响应

HTTP 200

Token count

application/json

名称类型说明
input_tokensnumberThe total number of tokens across the provided list of messages, system prompt, and tools.

列出模型

GET /anthropic/v1/models● 支持

Anthropic 官方文档 ↗

请求参数

  • limitnumber可选

    query: Number of items per page.

    已验证生效。

  • before_idstring可选

    query:

    已验证生效。

  • after_idstring可选

    query:

    已验证生效。

返回

200

始终返回 capabilities、max_input_tokens、max_tokens;目录无法确定的值为 null,不将总上下文窗口冒充独立输入上限。非空 anthropic-workspace-id 返回 400;尚不按 anthropic-beta 选择目录版本。

错误按 Anthropic 格式返回,参见 错误码

响应

HTTP 200

Models listed

application/json

名称类型说明
dataarray<object>
data[].idstringUnique model identifier.
data[].capabilitiesnull | objectModel capability information.
data[].created_atstringRFC 3339 datetime string representing the time at which the model was released. May be set to an epoch value if the release date is unknown.
data[].display_namestringA human-readable name for the model.
data[].max_input_tokensnull | numberMaximum input context window size in tokens for this model.
data[].max_tokensnull | numberMaximum value for the `max_tokens` parameter when using this model.
data[].typestringObject type. For Models, this is always `"model"`.
has_moreboolean
first_idnull | string
last_idnull | string

上传文件

POST /anthropic/v1/files● 支持

Anthropic 官方文档 ↗

请求体

  • filestring必填◐ 部分支持

    Body param: The file to upload. Only the final path component of the part's `filename` is kept; an absent or empty `filename` is replaced with `unnamed` plus the extension for the file's stored `mime_type`, when known.

    支持文本、PDF 和 PNG;按文件内容识别类型,不支持任意二进制。

  • expires_in_secondsnumber可选◐ 部分支持

    Body param: Seconds from upload until the file expires and its bytes become permanently unavailable. Must be between 3600 (one hour) and 7776000 (ninety days).

    表单字段支持 3600–7776000 秒;作为查询参数传入返回 400,提示改放表单。

返回

200

SDK 0.128.0 上传参数为表单 file 和可选的表单 expires_in_seconds(3600–7776000 秒)。其他表单字段(包括 purpose)返回 400 invalid_request_error,消息形如 "purpose: Extra inputs are not permitted";查询参数只接受 SDK 自带的 beta,其他查询参数返回 400,查询参数 expires_in_seconds 会提示改放表单。平台将上传文件记为 user_data;不支持 anthropic-workspace-id,请求携带该头时返回 400。

错误按 Anthropic 格式返回,参见 错误码

响应

HTTP 200

File uploaded

application/json

名称类型说明
idstringUnique object identifier. The format and length of IDs may change over time.
created_atstringRFC 3339 datetime string representing when the file was created.
filenamestringOriginal filename of the uploaded file.
mime_typestringMIME type of the file.
size_bytesnumberSize of the file in bytes.
typestringObject type. For files, this is always `"file"`.
downloadablebooleanWhether the file can be downloaded.
expires_atnull | stringRFC 3339 datetime string representing when the file will expire and become unavailable for download. Null if the file does not expire. For files uploaded with `expires_in_seconds`, this is the upload time plus that value.
scopenull | objectThe scope of this file, indicating the context in which it was created (e.g., a session).
scope.idstringThe ID of the scoping resource (e.g., the session ID).
scope.typestringThe type of scope (e.g., `"session"`).

列出文件

GET /anthropic/v1/files● 支持

Anthropic 官方文档 ↗

请求参数

  • idsarray可选

    query: Query param: Restrict the result set to Files whose `id` is in this list. At most 100 entries (after de-duplication). Mutually exclusive with `page` and `limit`. When supplied, the response is always a single page (`next_page` is null). IDs that do not resolve to a visible File — including deleted Files — are silently omitted.

    已验证生效。

  • scope_idstring可选◐ 部分支持

    query: Query param: Filter by scope ID. Only returns files associated with the specified scope (e.g., a session ID).

    需要 anthropic-beta: managed-agents-2026-04-01。非法 scope_id 返回 400,不存在的会话范围返回 404。

  • limitnumber可选

    query: Number of items per page.

    已验证生效。

  • pagestring可选

    query:

    已验证生效。

  • after_idstring可选

    query: Return the page of files immediately after this file id (older files).

    返回该文件之后(更早创建)的一页;不能与 before_id 或 page 同时使用。

  • before_idstring可选

    query: Return the page of files immediately before this file id (newer files).

    返回该文件之前(更新创建)的一页;不能与 after_id 或 page 同时使用。

返回

200

按创建时间从新到旧排列。用 after_id / before_id 与 limit 分页(两者同时给返回 400),也可以用 page 游标(next_page);三者只能选一个。响应包含 data、has_more、first_id、last_id 与 next_page。ids(最多 100 个去重 ID)与 page、after_id、before_id、limit 互斥。scope_id 需要 anthropic-beta: managed-agents-2026-04-01 请求头;缺少该头返回 400,不存在的会话范围返回 404。anthropic-workspace-id 返回 400。

错误按 Anthropic 格式返回,参见 错误码

响应

HTTP 200

Files listed

application/json

名称类型说明
dataarray<object>
data[].idstringUnique object identifier. The format and length of IDs may change over time.
data[].created_atstringRFC 3339 datetime string representing when the file was created.
data[].filenamestringOriginal filename of the uploaded file.
data[].mime_typestringMIME type of the file.
data[].size_bytesnumberSize of the file in bytes.
data[].typestringObject type. For files, this is always `"file"`.
data[].downloadablebooleanWhether the file can be downloaded.
data[].expires_atnull | stringRFC 3339 datetime string representing when the file will expire and become unavailable for download. Null if the file does not expire. For files uploaded with `expires_in_seconds`, this is the upload time plus that value.
data[].scopenull | objectThe scope of this file, indicating the context in which it was created (e.g., a session).
next_pagenull | string

读取文件信息

先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。

GET /anthropic/v1/files/{file_id}● 支持

Anthropic 官方文档 ↗

请求参数

  • file_idstring必填

    path:

返回

200

错误按 Anthropic 格式返回,参见 错误码

响应

HTTP 200

Metadata

application/json

名称类型说明
idstringUnique object identifier. The format and length of IDs may change over time.
created_atstringRFC 3339 datetime string representing when the file was created.
filenamestringOriginal filename of the uploaded file.
mime_typestringMIME type of the file.
size_bytesnumberSize of the file in bytes.
typestringObject type. For files, this is always `"file"`.
downloadablebooleanWhether the file can be downloaded.
expires_atnull | stringRFC 3339 datetime string representing when the file will expire and become unavailable for download. Null if the file does not expire. For files uploaded with `expires_in_seconds`, this is the upload time plus that value.
scopenull | objectThe scope of this file, indicating the context in which it was created (e.g., a session).
scope.idstringThe ID of the scoping resource (e.g., the session ID).
scope.typestringThe type of scope (e.g., `"session"`).

删除文件

先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。

DELETE /anthropic/v1/files/{file_id}● 支持

Anthropic 官方文档 ↗

请求参数

  • file_idstring必填

    path:

返回

200

错误按 Anthropic 格式返回,参见 错误码

响应

HTTP 200

Deleted

application/json

名称类型说明
idstringID of the deleted file.
typestringDeleted object type. For file deletion, this is always `"file_deleted"`.

下载文件内容

先调用「上传文件」,用返回的文件 ID 替换示例文件 ID。

GET /anthropic/v1/files/{file_id}/content● 支持

Anthropic 官方文档 ↗

请求参数

  • file_idstring必填

    path:

返回

400

只有代码执行工具生成的文件可以下载;你自己上传的文件(用途为 user_data)下载会返回 400 invalid_request_error,这与 Anthropic 官方的行为一致。

错误按 Anthropic 格式返回,参见 错误码

响应

HTTP 200

Binary content

未声明响应体。

Claude 托管智能体 API

基础地址

加载中…

接入

加载中…

运行一次会话

  1. 创建智能体,保存返回的 agent_… ID。
  2. 创建会话,将 agent 替换为该 ID,保存 sesn_… ID。
  3. 先订阅事件流,再发送消息。将两个请求的会话 ID 替换为同一个真实 ID。
  4. 收到 agent.message 后等待 session.status_idle;也可查询历史事件。

SDK 基础地址就是上面的基础地址。每个请求均需 API Key、anthropic-version: 2023-06-01 和 anthropic-beta: managed-agents-2026-04-01。在线试调会自动带上这些协议头,资源 ID 需自行替换。

官方 95 个操作已全部声明:其中 41 个已支持或部分支持(见端点清单徽标);其余 54 个平台尚未实现,调用如实返回 501(not_implemented_error,响应带 x-should-retry: false),不产生任何副作用、不计费。各项能力与凭据库的具体限制见端点说明。

端点

智能体(6 个端点,6 个可用)

方法路径说明支持
POST/v1/agents创建智能体◐ 部分支持
GET/v1/agents列出智能体● 支持
GET/v1/agents/{agent_id}读取智能体● 支持
POST/v1/agents/{agent_id}更新智能体◐ 部分支持
GET/v1/agents/{agent_id}/versions列出版本● 支持
POST/v1/agents/{agent_id}/archive归档智能体● 支持

会话与事件(9 个端点,8 个可用)

方法路径说明支持
POST/v1/sessions创建会话◐ 部分支持
GET/v1/sessions列出会话◐ 部分支持
GET/v1/sessions/{session_id}读取会话● 支持
POST/v1/sessions/{session_id}/events发送事件◐ 部分支持
GET/v1/sessions/{session_id}/events列出事件● 支持
GET/v1/sessions/{session_id}/events/stream订阅事件◐ 部分支持
POST/v1/sessions/{session_id}更新会话◐ 部分支持
DELETE/v1/sessions/{session_id}删除会话○ 未支持
POST/v1/sessions/{session_id}/archive归档会话● 支持

定时部署(10 个端点,0 个可用)

方法路径说明支持
GET/v1/deployment_runs列出部署运行○ 未支持
GET/v1/deployment_runs/{deployment_run_id}读取部署运行○ 未支持
GET/v1/deployments列出部署○ 未支持
POST/v1/deployments创建部署○ 未支持
GET/v1/deployments/{deployment_id}读取部署○ 未支持
POST/v1/deployments/{deployment_id}更新部署○ 未支持
POST/v1/deployments/{deployment_id}/archive归档部署○ 未支持
POST/v1/deployments/{deployment_id}/pause暂停部署○ 未支持
POST/v1/deployments/{deployment_id}/run运行部署○ 未支持
POST/v1/deployments/{deployment_id}/unpause恢复部署○ 未支持

环境(6 个端点,5 个可用)

方法路径说明支持
GET/v1/environments列出环境◐ 部分支持
POST/v1/environments创建环境◐ 部分支持
DELETE/v1/environments/{environment_id}删除环境○ 未支持
GET/v1/environments/{environment_id}读取环境◐ 部分支持
POST/v1/environments/{environment_id}更新环境◐ 部分支持
POST/v1/environments/{environment_id}/archive归档环境◐ 部分支持

环境任务(8 个端点,0 个可用)

方法路径说明支持
GET/v1/environments/{environment_id}/work列出工作项○ 未支持
GET/v1/environments/{environment_id}/work/{work_id}读取工作项○ 未支持
POST/v1/environments/{environment_id}/work/{work_id}更新工作项○ 未支持
POST/v1/environments/{environment_id}/work/{work_id}/ack确认工作项○ 未支持
POST/v1/environments/{environment_id}/work/{work_id}/heartbeat工作项心跳○ 未支持
POST/v1/environments/{environment_id}/work/{work_id}/stop停止工作项○ 未支持
GET/v1/environments/{environment_id}/work/poll轮询工作项○ 未支持
GET/v1/environments/{environment_id}/work/stats工作项统计○ 未支持

记忆库(14 个端点,0 个可用)

方法路径说明支持
GET/v1/memory_stores列出记忆库○ 未支持
POST/v1/memory_stores创建记忆库○ 未支持
DELETE/v1/memory_stores/{memory_store_id}删除记忆库○ 未支持
GET/v1/memory_stores/{memory_store_id}读取记忆库○ 未支持
POST/v1/memory_stores/{memory_store_id}更新记忆库○ 未支持
POST/v1/memory_stores/{memory_store_id}/archive归档记忆库○ 未支持
GET/v1/memory_stores/{memory_store_id}/memories列出记忆○ 未支持
POST/v1/memory_stores/{memory_store_id}/memories创建记忆○ 未支持
DELETE/v1/memory_stores/{memory_store_id}/memories/{memory_id}删除记忆○ 未支持
GET/v1/memory_stores/{memory_store_id}/memories/{memory_id}读取记忆○ 未支持
POST/v1/memory_stores/{memory_store_id}/memories/{memory_id}更新记忆○ 未支持
GET/v1/memory_stores/{memory_store_id}/memory_versions列出记忆版本○ 未支持
GET/v1/memory_stores/{memory_store_id}/memory_versions/{memory_version_id}读取记忆版本○ 未支持
POST/v1/memory_stores/{memory_store_id}/memory_versions/{memory_version_id}/redact抹除记忆版本○ 未支持

会话资源(5 个端点,4 个可用)

方法路径说明支持
GET/v1/sessions/{session_id}/resources列出会话资源◐ 部分支持
POST/v1/sessions/{session_id}/resources添加会话资源◐ 部分支持
DELETE/v1/sessions/{session_id}/resources/{resource_id}删除会话资源◐ 部分支持
GET/v1/sessions/{session_id}/resources/{resource_id}读取会话资源◐ 部分支持
POST/v1/sessions/{session_id}/resources/{resource_id}更新会话资源○ 未支持

会话线程(5 个端点,5 个可用)

方法路径说明支持
GET/v1/sessions/{session_id}/threads列出线程◐ 部分支持
GET/v1/sessions/{session_id}/threads/{thread_id}读取线程◐ 部分支持
POST/v1/sessions/{session_id}/threads/{thread_id}/archive归档线程◐ 部分支持
GET/v1/sessions/{session_id}/threads/{thread_id}/events列出线程事件◐ 部分支持
GET/v1/sessions/{session_id}/threads/{thread_id}/stream订阅线程事件◐ 部分支持

技能(9 个端点,0 个可用)

方法路径说明支持
GET/v1/skills列出技能○ 未支持
POST/v1/skills创建技能○ 未支持
DELETE/v1/skills/{skill_id}删除技能○ 未支持
GET/v1/skills/{skill_id}读取技能○ 未支持
GET/v1/skills/{skill_id}/versions列出技能版本○ 未支持
POST/v1/skills/{skill_id}/versions创建技能版本○ 未支持
DELETE/v1/skills/{skill_id}/versions/{version}删除技能版本○ 未支持
GET/v1/skills/{skill_id}/versions/{version}读取技能版本○ 未支持
GET/v1/skills/{skill_id}/versions/{version}/content下载技能版本内容○ 未支持

隧道(10 个端点,0 个可用)

方法路径说明支持
GET/v1/tunnels列出隧道○ 未支持
POST/v1/tunnels创建隧道○ 未支持
GET/v1/tunnels/{tunnel_id}读取隧道○ 未支持
POST/v1/tunnels/{tunnel_id}/archive归档隧道○ 未支持
GET/v1/tunnels/{tunnel_id}/certificates列出隧道证书○ 未支持
POST/v1/tunnels/{tunnel_id}/certificates创建隧道证书○ 未支持
GET/v1/tunnels/{tunnel_id}/certificates/{certificate_id}读取隧道证书○ 未支持
POST/v1/tunnels/{tunnel_id}/certificates/{certificate_id}/archive归档隧道证书○ 未支持
POST/v1/tunnels/{tunnel_id}/reveal_token显示隧道令牌○ 未支持
POST/v1/tunnels/{tunnel_id}/rotate_token轮换隧道令牌○ 未支持

凭据保险库(13 个端点,13 个可用)

方法路径说明支持
GET/v1/vaults列出凭据库● 支持
POST/v1/vaults创建凭据库● 支持
DELETE/v1/vaults/{vault_id}删除凭据库● 支持
GET/v1/vaults/{vault_id}读取凭据库● 支持
POST/v1/vaults/{vault_id}更新凭据库● 支持
POST/v1/vaults/{vault_id}/archive归档凭据库● 支持
GET/v1/vaults/{vault_id}/credentials列出凭据◐ 部分支持
POST/v1/vaults/{vault_id}/credentials创建凭据◐ 部分支持
DELETE/v1/vaults/{vault_id}/credentials/{credential_id}删除凭据◐ 部分支持
GET/v1/vaults/{vault_id}/credentials/{credential_id}读取凭据◐ 部分支持
POST/v1/vaults/{vault_id}/credentials/{credential_id}更新凭据◐ 部分支持
POST/v1/vaults/{vault_id}/credentials/{credential_id}/archive归档凭据◐ 部分支持
POST/v1/vaults/{vault_id}/credentials/{credential_id}/mcp_oauth_validate校验凭据 MCP OAuth◐ 部分支持

与官方的差异

  • 创建智能体:支持文本提示词、模型、元数据与内置工具。MCP、Skills 及额外模型控制尚不支持,传入会返回 400。 multiagent 接受 null 或 coordinator 名册,1–20 项:智能体 ID、{type:"agent",id,version?} 或最多一个 {type:"self"}。创建/更新时固定版本;成员去重且须存在、未归档、不能自身带 multiagent。兼容 API 只提供 bash、edit、glob、grep、read、write、web_search、web_fetch 这 8 个官方工具;configs 不接受其他工具名,经此入口创建的会话不提供后台任务、Monitor 或子智能体。完整原生工具请使用 /agent/v1。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。
  • 读取智能体:将示例中的资源 ID 替换成你创建的资源 ID。
  • 更新智能体:version 可用于乐观并发控制,版本冲突返回 409;无变化的更新不增加版本。MCP、Skills 尚不支持。 multiagent 接受 null 或 coordinator 名册,1–20 项:智能体 ID、{type:"agent",id,version?} 或最多一个 {type:"self"}。创建/更新时固定版本;成员去重且须存在、未归档、不能自身带 multiagent。兼容 API 只提供 bash、edit、glob、grep、read、write、web_search、web_fetch 这 8 个官方工具;configs 不接受其他工具名,经此入口创建的会话不提供后台任务、Monitor 或子智能体。完整原生工具请使用 /agent/v1。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。
  • 列出版本:将示例中的资源 ID 替换成你创建的资源 ID。
  • 归档智能体:归档后保留查询与历史版本,不能继续更新。请只归档自己的测试智能体。
  • 创建会话:先创建智能体,将示例 agent_123 换成返回的 id。Anthropic 兼容 API 的 environment_id 必填,可用 node22 或租户自建 cloud 环境;/agent/v1 可省略 environment_id 得到轻量机器。不支持内联智能体覆盖、预算与凭据库。 支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。
  • 列出会话:支持 limit、page 与 agent_id;agent_version、时间范围、deployment_id、memory_store_id、include_archived、order、statuses 尚不支持,传入返回 400。
  • 读取会话:将示例中的资源 ID 替换成你创建的资源 ID。
  • 发送事件:将 sesn_123 换成创建会话返回的 id。每条 user.message 只接受一个非空文本块。支持文本 user.message、user.interrupt 和工具确认;其它事件变体尚不支持。返回的是已接纳事件;模型回复从事件历史或订阅读取。会话等待工具授权时发送的 user.message 会排队:返回的事件 processed_at 为 null,授权处理完成后按发送顺序执行。
  • 列出事件:先发送消息再读取历史;处理完成前可能只看到已接纳的输入。支持分页、事件类型和时间过滤。会话等待工具授权时停在 session.status_idle,stop_reason 为 requires_action,event_ids 列出待确认的 agent.tool_use;运行失败时先出现 session.error,再出现 session.status_terminated。agent.thinking 与官方一致,是不带内容的进度信号。
  • 订阅事件:保持 SSE 连接以接收事件;请求不会像普通 JSON 接口一样立刻结束。先创建会话并替换 sesn_123,再从另一请求发送消息;停止按钮只断开订阅,不会停止智能体。SDK 0.124.0 会过滤 session.usage,完整用量请读历史。传 event_deltas[]=agent.message 可在最终事件到达前收到逐段文本预览;agent.thinking 与官方一致,只有 event_start。
  • 列出环境:支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。
  • 创建环境:支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。
  • 读取环境:支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。
  • 更新环境:支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。
  • 归档环境:支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。
  • 更新会话:支持 title 与 metadata(官方补丁语义:字符串值写入、null 删除该键、整包 null 清空,未提及的键保留)。官方的 agent 覆盖(tools/mcp_servers)、budget 与 vault_ids 不支持,传入返回 400 并点名字段。归档后的会话更新返回 409。
  • 归档会话:归档后的会话拒绝新消息(400 invalid_request_error,写明会话已归档),读取与事件历史仍可用;重复归档幂等,archived_at 保持首次归档时间。
  • 列出会话资源:支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。
  • 添加会话资源:支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。
  • 删除会话资源:支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。
  • 读取会话资源:支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。
  • 列出线程:按 created_at 升序返回主线程及全部子线程。线程 id 为 sthr_ 加所属会话 id 的后缀;子线程的 parent_thread_id 指向主线程,session_id 始终为父会话。agent 是实际运行的定义,内置类型的 name 为类型名,未注册的 id/version 为 null。归档子线程的 status 为 terminated,archived_at 为归档时间;stats/usage 无线程级追踪时如实为 null。
  • 读取线程:返回本会话的主线程或子线程,与列表项逐字段一致。其他会话的线程、未知线程或非 sthr_ id 一律返回 404,不泄露其存在性。
  • 归档线程:主线程沿用会话归档动作;子线程仅归档对应子会话,不归档父会话或其他子线程。子线程归档后 status 为 terminated,带 archived_at;历史事件仍可读。
  • 列出线程事件:读取所选线程自己的事件记录:主线程读主会话,子线程读对应子会话。沿用会话事件接口的查询参数、公开事件类型和 data + next_page 信封。使用网页工具时,两个接口均返回 search_result 块;回答 citations 为 /agent/v1 扩展,/anthropic 将引用显示为正文 [n]。
  • 订阅线程事件:订阅所选线程自己的实时事件流。复用会话 SSE 实现;/agent 接口支持同址只读 WebSocket。主会话流同时包含子线程创建、状态和消息事件,子线程审批带 session_thread_id 上浮;确认或中断携带该字段时路由到所属子线程。
  • 列出凭据库:支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。
  • 创建凭据库:支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。
  • 删除凭据库:支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。
  • 读取凭据库:支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。
  • 更新凭据库:支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。
  • 归档凭据库:支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。
  • 列出凭据:支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。
  • 创建凭据:支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。
  • 删除凭据:支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。
  • 读取凭据:支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。
  • 更新凭据:支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。
  • 归档凭据:支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。
  • 校验凭据 MCP OAuth:只适用于 OAuth 凭据,对其他类型返回 400。结果总是 HTTP 200,status 为 valid、invalid 或 unknown;mcp_probe 只在未通过时给出失败的一步,refresh 只在尝试了续期时给出。

参数与字段的权威定义以 Claude Managed Agents 官方文档为准。

错误按 Claude Managed Agents 格式返回,参见错误;额度与响应头参见限流。

POST /anthropic/v1/agents◐ 部分支持

Claude 官方文档 ↗

请求体

  • namestring必填

    智能体名称,1–255 个字符,工作区内可读。

  • modelstring | object必填

    智能体使用的模型:直接写模型名字符串(如 claude-opus-5),或传对象做附加配置(见子字段)。

    ▸ 展开子字段(4)
    • idstring必填

      模型名字符串,如 claude-opus-5。

    • effortstring | object可选

      每次推理的思考力度:可传级别字符串(如 high)或 {type: high} 对象。创建时省略取该模型的默认值;更新时省略保持不变。

    • inference_geostring可选

      模型推理的地理区域;不传沿用工作区默认。model 是整体替换字段,更新时省略子字段即清除该项。

    • speedstring可选

      推理速度模式:fast 出字显著更快但按溢价计费;并非所有模型都支持,不支持的组合在创建时被拒。

  • systemstring可选

    智能体的系统提示词。

  • descriptionstring可选

    智能体的用途说明。

  • mcp_serversarray可选○ 未支持

    智能体连接的 MCP 服务器列表,最多 20 个,名称必须唯一;每个服务器都要被 tools 里的 mcp_toolset 引用,否则整笔请求被拒。

    ▸ 展开子字段(3)
    • namestring必填

      MCP 服务器在本列表内的唯一名称,1–255 个字符,供 mcp_toolset 配置引用。

    • typestring必填

      服务器类型,目前只支持 url。

      取值 url
    • urlstring必填

      MCP 服务器的端点地址。

  • metadataobject可选

    自定义元数据键值对,最多 16 个键、每个值最长 512 字符。

  • multiagentobject可选

    多智能体协作拓扑:会话主线程作为协调者,从 agents 名单派生会话线程执行工作。

    ▸ 展开子字段(2)
    • agentsarray必填

      协调者可以派生为会话线程的智能体名单,1–20 项;支持 ID 字符串、{type: agent, id, version?} 和最多一个 {type: self}。创建/更新时固定版本。成员须唯一、存在且未归档,不能自身带 multiagent。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。

    • typestring必填

      拓扑类型,目前只有 coordinator。

      取值 coordinator
  • skillsarray可选○ 未支持

    智能体可用的 Skill 列表。

  • toolsarray可选

    智能体可用的工具配置,所有工具合计最多 128 个。

返回

200

支持文本提示词、模型、元数据与内置工具。MCP、Skills 及额外模型控制尚不支持,传入会返回 400。 multiagent 接受 null 或 coordinator 名册,1–20 项:智能体 ID、{type:"agent",id,version?} 或最多一个 {type:"self"}。创建/更新时固定版本;成员去重且须存在、未归档、不能自身带 multiagent。兼容 API 只提供 bash、edit、glob、grep、read、write、web_search、web_fetch 这 8 个官方工具;configs 不接受其他工具名,经此入口创建的会话不提供后台任务、Monitor 或子智能体。完整原生工具请使用 /agent/v1。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstring
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
descriptionnull | string
mcp_serversarray<object>
mcp_servers[].namestring
mcp_servers[].typestring
mcp_servers[].urlstring
metadataobject
modelobjectModel identifier and configuration.
model.idstringThe model that will power your agent. See models for additional details and options.
model.effortobjectHow hard Claude works on each turn. Sets `output_config.effort` on every Messages call the session makes.
model.inference_geostringGeographic region for model inference. When unset, requests fall through to the workspace's default_inference_geo.
model.speedstringInference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.
multiagentnull | objectResolved coordinator topology with a concrete agent roster.
multiagent.agentsarray<object>Agents the coordinator may spawn as session threads, each resolved to a specific version.
multiagent.typestring
namestring
skillsarray<object>
skills[].skill_idstring
skills[].typestring
skills[].versionstring
systemnull | string
toolsarray<object>
tools[].configsarray<object>
tools[].default_configobjectResolved default configuration for agent tools. / Resolved default configuration for all tools from an MCP server.
tools[].typestring
tools[].mcp_server_namestring
tools[].descriptionstring
tools[].input_schemaobjectJSON Schema for custom tool input parameters.
tools[].namestring
typestring
updated_atstringA timestamp in RFC 3339 format
versionnumberThe agent's current version. Starts at 1 and increments when the agent is modified.

列出智能体

GET /anthropic/v1/agents● 支持

Claude 官方文档 ↗

请求参数

  • created_at[gte]string可选

    query: 只返回不早于该时间创建的记录。

  • created_at[lte]string可选

    query: 只返回不晚于该时间创建的记录。

  • include_archivedboolean可选

    query: 是否包含已归档的记录。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

200

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstring
data[].archived_atnull | stringA timestamp in RFC 3339 format
data[].created_atstringA timestamp in RFC 3339 format
data[].descriptionnull | string
data[].mcp_serversarray<object>
data[].metadataobject
data[].modelobjectModel identifier and configuration.
data[].multiagentnull | objectResolved coordinator topology with a concrete agent roster.
data[].namestring
data[].skillsarray<object>
data[].systemnull | string
data[].toolsarray<object>
data[].typestring
data[].updated_atstringA timestamp in RFC 3339 format
data[].versionnumberThe agent's current version. Starts at 1 and increments when the agent is modified.
next_pagestring | null

读取智能体

先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。

GET /anthropic/v1/agents/{agent_id}● 支持

Claude 官方文档 ↗

请求参数

  • agent_idstring必填

    path: 按智能体 ID 过滤结果。

  • versionnumber可选

    query: 路径参数:版本号。

返回

200

将示例中的资源 ID 替换成你创建的资源 ID。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstring
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
descriptionnull | string
mcp_serversarray<object>
mcp_servers[].namestring
mcp_servers[].typestring
mcp_servers[].urlstring
metadataobject
modelobjectModel identifier and configuration.
model.idstringThe model that will power your agent. See models for additional details and options.
model.effortobjectHow hard Claude works on each turn. Sets `output_config.effort` on every Messages call the session makes.
model.inference_geostringGeographic region for model inference. When unset, requests fall through to the workspace's default_inference_geo.
model.speedstringInference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.
multiagentnull | objectResolved coordinator topology with a concrete agent roster.
multiagent.agentsarray<object>Agents the coordinator may spawn as session threads, each resolved to a specific version.
multiagent.typestring
namestring
skillsarray<object>
skills[].skill_idstring
skills[].typestring
skills[].versionstring
systemnull | string
toolsarray<object>
tools[].configsarray<object>
tools[].default_configobjectResolved default configuration for agent tools. / Resolved default configuration for all tools from an MCP server.
tools[].typestring
tools[].mcp_server_namestring
tools[].descriptionstring
tools[].input_schemaobjectJSON Schema for custom tool input parameters.
tools[].namestring
typestring
updated_atstringA timestamp in RFC 3339 format
versionnumberThe agent's current version. Starts at 1 and increments when the agent is modified.

先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。

POST /anthropic/v1/agents/{agent_id}◐ 部分支持

Claude 官方文档 ↗

请求参数

  • agent_idstring必填

    path: 按智能体 ID 过滤结果。

  • namestring可选

    智能体名称;省略保持不变,不能传空串清除。

  • modelstring | object可选

    智能体使用的模型:直接写模型名字符串(如 claude-opus-5),或传对象做附加配置(见子字段)。

    ▸ 展开子字段(4)
    • idstring必填

      模型名字符串,如 claude-opus-5。

    • effortstring | object可选

      每次推理的思考力度:可传级别字符串(如 high)或 {type: high} 对象。创建时省略取该模型的默认值;更新时省略保持不变。

    • inference_geostring可选

      模型推理的地理区域;不传沿用工作区默认。model 是整体替换字段,更新时省略子字段即清除该项。

    • speedstring可选

      推理速度模式:fast 出字显著更快但按溢价计费;并非所有模型都支持,不支持的组合在创建时被拒。

  • systemstring可选

    系统提示词;省略保持不变,传空串或 null 清除。

  • descriptionstring可选

    用途说明;省略保持不变,传空串或 null 清除。

  • mcp_serversarray可选○ 未支持

    整体替换的 MCP 服务器列表;省略保持不变,传空数组或 null 清除。

  • metadataobject可选

    元数据补丁:键设为字符串即写入,设为 null 即删除;省略该字段保持不变。存储上限 16 个键、每个值 512 字符。

  • multiagentobject可选

    多智能体协作拓扑:会话主线程作为协调者,从 agents 名单派生会话线程执行工作。

    ▸ 展开子字段(2)
    • agentsarray必填

      协调者可以派生为会话线程的智能体名单,1–20 项;支持 ID 字符串、{type: agent, id, version?} 和最多一个 {type: self}。创建/更新时固定版本。成员须唯一、存在且未归档,不能自身带 multiagent。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。

    • typestring必填

      拓扑类型,目前只有 coordinator。

      取值 coordinator
  • skillsarray可选○ 未支持

    整体替换的 Skill 列表;省略保持不变,传空数组或 null 清除。

  • toolsarray可选

    整体替换的工具配置;省略保持不变,传空数组或 null 清除。

  • ▸ 更多参数(1)
    • versionnumber可选

      智能体当前版本号,用于并发保护:必须与最近一次创建/读取返回的版本一致,否则返回冲突。

返回

200

version 可用于乐观并发控制,版本冲突返回 409;无变化的更新不增加版本。MCP、Skills 尚不支持。 multiagent 接受 null 或 coordinator 名册,1–20 项:智能体 ID、{type:"agent",id,version?} 或最多一个 {type:"self"}。创建/更新时固定版本;成员去重且须存在、未归档、不能自身带 multiagent。兼容 API 只提供 bash、edit、glob、grep、read、write、web_search、web_fetch 这 8 个官方工具;configs 不接受其他工具名,经此入口创建的会话不提供后台任务、Monitor 或子智能体。完整原生工具请使用 /agent/v1。每个 coordinator 最多一个 advisor,模型须可用且不同于智能体模型;仅主会话可咨询,每次咨询为独立 advisor 线程,建议以 agent.thread_message_received 返回。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstring
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
descriptionnull | string
mcp_serversarray<object>
mcp_servers[].namestring
mcp_servers[].typestring
mcp_servers[].urlstring
metadataobject
modelobjectModel identifier and configuration.
model.idstringThe model that will power your agent. See models for additional details and options.
model.effortobjectHow hard Claude works on each turn. Sets `output_config.effort` on every Messages call the session makes.
model.inference_geostringGeographic region for model inference. When unset, requests fall through to the workspace's default_inference_geo.
model.speedstringInference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.
multiagentnull | objectResolved coordinator topology with a concrete agent roster.
multiagent.agentsarray<object>Agents the coordinator may spawn as session threads, each resolved to a specific version.
multiagent.typestring
namestring
skillsarray<object>
skills[].skill_idstring
skills[].typestring
skills[].versionstring
systemnull | string
toolsarray<object>
tools[].configsarray<object>
tools[].default_configobjectResolved default configuration for agent tools. / Resolved default configuration for all tools from an MCP server.
tools[].typestring
tools[].mcp_server_namestring
tools[].descriptionstring
tools[].input_schemaobjectJSON Schema for custom tool input parameters.
tools[].namestring
typestring
updated_atstringA timestamp in RFC 3339 format
versionnumberThe agent's current version. Starts at 1 and increments when the agent is modified.

列出版本

先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。

GET /anthropic/v1/agents/{agent_id}/versions● 支持

Claude 官方文档 ↗

请求参数

  • agent_idstring必填

    path: 按智能体 ID 过滤结果。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

200

将示例中的资源 ID 替换成你创建的资源 ID。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstring
data[].archived_atnull | stringA timestamp in RFC 3339 format
data[].created_atstringA timestamp in RFC 3339 format
data[].descriptionnull | string
data[].mcp_serversarray<object>
data[].metadataobject
data[].modelobjectModel identifier and configuration.
data[].multiagentnull | objectResolved coordinator topology with a concrete agent roster.
data[].namestring
data[].skillsarray<object>
data[].systemnull | string
data[].toolsarray<object>
data[].typestring
data[].updated_atstringA timestamp in RFC 3339 format
data[].versionnumberThe agent's current version. Starts at 1 and increments when the agent is modified.
next_pagestring | null

归档智能体

先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。

POST /anthropic/v1/agents/{agent_id}/archive● 支持

Claude 官方文档 ↗

请求参数

  • agent_idstring必填

    path: 按智能体 ID 过滤结果。

返回

200

归档后保留查询与历史版本,不能继续更新。请只归档自己的测试智能体。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstring
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
descriptionnull | string
mcp_serversarray<object>
mcp_servers[].namestring
mcp_servers[].typestring
mcp_servers[].urlstring
metadataobject
modelobjectModel identifier and configuration.
model.idstringThe model that will power your agent. See models for additional details and options.
model.effortobjectHow hard Claude works on each turn. Sets `output_config.effort` on every Messages call the session makes.
model.inference_geostringGeographic region for model inference. When unset, requests fall through to the workspace's default_inference_geo.
model.speedstringInference speed mode. `fast` provides significantly faster output token generation at premium pricing. Not all models support `fast`; invalid combinations are rejected at create time.
multiagentnull | objectResolved coordinator topology with a concrete agent roster.
multiagent.agentsarray<object>Agents the coordinator may spawn as session threads, each resolved to a specific version.
multiagent.typestring
namestring
skillsarray<object>
skills[].skill_idstring
skills[].typestring
skills[].versionstring
systemnull | string
toolsarray<object>
tools[].configsarray<object>
tools[].default_configobjectResolved default configuration for agent tools. / Resolved default configuration for all tools from an MCP server.
tools[].typestring
tools[].mcp_server_namestring
tools[].descriptionstring
tools[].input_schemaobjectJSON Schema for custom tool input parameters.
tools[].namestring
typestring
updated_atstringA timestamp in RFC 3339 format
versionnumberThe agent's current version. Starts at 1 and increments when the agent is modified.

先调用「创建智能体」,用返回的智能体 ID 替换示例 ID。

POST /anthropic/v1/sessions◐ 部分支持

Claude 官方文档 ↗

请求体

  • agentstring | object必填

    会话要运行的智能体:直接写智能体 ID 字符串(固定用最新版本),或传对象指定 id 与 version(见子字段)。

    ▸ 展开子字段(8)
    • idstring必填

      会话要运行的智能体 ID。

    • typestring必填

      引用类型,目前只有 agent。

      取值 agent_with_overrides
    • versionnumber可选

      固定使用的智能体版本;省略用最新版本。

    • mcp_serversarray可选

      替换本会话的 MCP 服务器列表:传入的数组整体生效;传空数组清除,省略沿用智能体的配置。

    • modelstring | object可选

      替换本会话的模型:模型名字符串(如 claude-opus-5)或配置对象;省略沿用智能体自身的模型。

    • skillsarray可选

      替换本会话的 Skill 列表;传空数组清除,省略沿用智能体的配置。

    • systemstring可选

      替换本会话的系统提示词,最长 100,000 字符;传 null 清除,省略沿用智能体的。

    • toolsarray可选

      替换本会话的工具配置;传空数组清除,省略沿用智能体的配置。

  • environment_idstring必填

    会话运行所在的环境 ID,决定容器的基础环境。

  • budgetobject可选○ 未支持

    会话的预算上限设置。

    ▸ 展开子字段(2)
    • max_list_costobject必填

      预算内列表类调用的花费上限。

    • typestring必填

      预算类型,目前只有 max_list_cost。

      取值 limit
  • initial_eventsarray可选

    创建时按顺序发给会话的初始事件,支持 user.message 与 user.define_outcome,一次最多 50 条。

  • metadataobject可选

    会话的自定义元数据键值对。

  • resourcesarray可选◐ 部分支持

    要挂载进会话容器的资源(如代码仓库、文件)。

  • titlestring可选

    会话标题,便于在控制台辨认。

  • vault_idsarray可选○ 未支持

    保险库 ID 列表:会话里智能体可以使用这些已存凭据。

返回

200

先创建智能体,将示例 agent_123 换成返回的 id。Anthropic 兼容 API 的 environment_id 必填,可用 node22 或租户自建 cloud 环境;/agent/v1 可省略 environment_id 得到轻量机器。不支持内联智能体覆盖、预算与凭据库。 支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstring
agentobjectResolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.
agent.idstring
agent.descriptionnull | string
agent.mcp_serversarray<object>
agent.modelobjectModel identifier and configuration.
agent.multiagentnull | objectResolved coordinator topology with full agent definitions for each roster member.
agent.namestring
agent.skillsarray<object>
agent.systemnull | string
agent.toolsarray<object>
agent.typestring
agent.versionnumber
archived_atnull | stringA timestamp in RFC 3339 format
budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
budget.max_list_costobjectA monetary amount in a specific currency.
budget.typestring
created_atstringA timestamp in RFC 3339 format
environment_idstring
metadataobject
outcome_evaluationsarray<object>Per-outcome evaluation state. One entry per `define_outcome` event sent to the session.
outcome_evaluations[].completed_atnull | stringA timestamp in RFC 3339 format
outcome_evaluations[].descriptionstringWhat the agent should produce.
outcome_evaluations[].explanationnull | stringGrader's verdict text from the most recent evaluation. For `satisfied`, explains why criteria are met; for `needs_revision` (intermediate), what's missing; for `failed`, why unrecoverable.
outcome_evaluations[].iterationnumber0-indexed revision cycle the outcome is currently on.
outcome_evaluations[].outcome_idstringServer-generated outc_ ID for this outcome.
outcome_evaluations[].resultstringCurrent evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal.
outcome_evaluations[].typestring
resourcesarray<object>
resources[].idstring
resources[].created_atstringA timestamp in RFC 3339 format
resources[].mount_pathstring | null | stringFilesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.
resources[].typestring
resources[].updated_atstringA timestamp in RFC 3339 format
resources[].urlstring
resources[].checkoutnull | object
resources[].file_idstring
resources[].memory_store_idstringThe memory store ID (memstore_...). Must belong to the caller's organization and workspace.
resources[].accessnull | stringAccess mode for an attached memory store.
resources[].descriptionstringDescription of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.
resources[].instructionsnull | stringPer-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
resources[].namenull | stringDisplay name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.
statsobjectTiming statistics for a session.
stats.active_secondsnumberCumulative time in seconds the session spent in `running` status. Excludes idle time.
stats.duration_secondsnumberElapsed time since session creation in seconds. For terminated sessions, frozen at the final update.
statusstringSessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion.
titlenull | string
typestring
updated_atstringA timestamp in RFC 3339 format
usageobjectCumulative token usage for a session across all turns.
usage.active_secondsnumberCumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once, unlike `stats.active_seconds`, which sums each thread's own active time. This is the duration the session's runtime cost is priced on.
usage.cache_creationobjectPrompt-cache creation token usage broken down by cache lifetime.
usage.cache_read_input_tokensnumberTotal tokens read from prompt cache.
usage.input_tokensnumberTotal input tokens consumed across all turns.
usage.list_costnull | objectA monetary amount in a specific currency.
usage.output_tokensnumberTotal output tokens generated across all turns.
usage.server_tool_usenull | objectCumulative count of server-executed tool invocations, broken down by tool.
vault_idsarray<string>Vault IDs attached to the session at creation. Empty when no vaults were supplied.
deployment_idnull | stringDeployment ID when the session was created from a deployment reference. Null otherwise.

GET /anthropic/v1/sessions◐ 部分支持

Claude 官方文档 ↗

请求参数

  • agent_idstring可选

    query: 按智能体 ID 过滤结果。

  • agent_versionnumber可选

    query: 按智能体版本过滤;仅在同时设置 agent_id 时生效。

  • created_at[gt]string可选

    query: 只返回严格晚于该时间创建的记录。

  • created_at[gte]string可选

    query: 只返回不早于该时间创建的记录。

  • created_at[lt]string可选

    query: 只返回严格早于该时间创建的记录。

  • created_at[lte]string可选

    query: 只返回不晚于该时间创建的记录。

  • deployment_idstring可选

    query: 部署 ID(路径或查询参数)。

  • include_archivedboolean可选

    query: 是否包含已归档的记录。

  • memory_store_idstring可选

    query: 记忆库 ID(路径或查询参数)。

  • orderstring可选

    query: 按创建时间排序:asc 从旧到新,desc 从新到旧(默认)。

  • ▸ 更多参数(3)
    • statusesarray可选

      query: 按会话状态过滤,可重复该参数匹配多种状态。

    • limitnumber可选

      query: 每页返回的条数上限。

    • pagestring可选

      query: 分页游标,取自上一页响应的 next_page。

返回

200

支持 limit、page 与 agent_id;agent_version、时间范围、deployment_id、memory_store_id、include_archived、order、statuses 尚不支持,传入返回 400。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstring
data[].agentobjectResolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.
data[].archived_atnull | stringA timestamp in RFC 3339 format
data[].budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
data[].created_atstringA timestamp in RFC 3339 format
data[].environment_idstring
data[].metadataobject
data[].outcome_evaluationsarray<object>Per-outcome evaluation state. One entry per `define_outcome` event sent to the session.
data[].resourcesarray<object>
data[].statsobjectTiming statistics for a session.
data[].statusstringSessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion.
data[].titlenull | string
data[].typestring
data[].updated_atstringA timestamp in RFC 3339 format
data[].usageobjectCumulative token usage for a session across all turns.
data[].vault_idsarray<string>Vault IDs attached to the session at creation. Empty when no vaults were supplied.
data[].deployment_idnull | stringDeployment ID when the session was created from a deployment reference. Null otherwise.
next_pagestring | null

读取会话

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

GET /anthropic/v1/sessions/{session_id}● 支持

Claude 官方文档 ↗

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

返回

200

将示例中的资源 ID 替换成你创建的资源 ID。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstring
agentobjectResolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.
agent.idstring
agent.descriptionnull | string
agent.mcp_serversarray<object>
agent.modelobjectModel identifier and configuration.
agent.multiagentnull | objectResolved coordinator topology with full agent definitions for each roster member.
agent.namestring
agent.skillsarray<object>
agent.systemnull | string
agent.toolsarray<object>
agent.typestring
agent.versionnumber
archived_atnull | stringA timestamp in RFC 3339 format
budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
budget.max_list_costobjectA monetary amount in a specific currency.
budget.typestring
created_atstringA timestamp in RFC 3339 format
environment_idstring
metadataobject
outcome_evaluationsarray<object>Per-outcome evaluation state. One entry per `define_outcome` event sent to the session.
outcome_evaluations[].completed_atnull | stringA timestamp in RFC 3339 format
outcome_evaluations[].descriptionstringWhat the agent should produce.
outcome_evaluations[].explanationnull | stringGrader's verdict text from the most recent evaluation. For `satisfied`, explains why criteria are met; for `needs_revision` (intermediate), what's missing; for `failed`, why unrecoverable.
outcome_evaluations[].iterationnumber0-indexed revision cycle the outcome is currently on.
outcome_evaluations[].outcome_idstringServer-generated outc_ ID for this outcome.
outcome_evaluations[].resultstringCurrent evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal.
outcome_evaluations[].typestring
resourcesarray<object>
resources[].idstring
resources[].created_atstringA timestamp in RFC 3339 format
resources[].mount_pathstring | null | stringFilesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.
resources[].typestring
resources[].updated_atstringA timestamp in RFC 3339 format
resources[].urlstring
resources[].checkoutnull | object
resources[].file_idstring
resources[].memory_store_idstringThe memory store ID (memstore_...). Must belong to the caller's organization and workspace.
resources[].accessnull | stringAccess mode for an attached memory store.
resources[].descriptionstringDescription of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.
resources[].instructionsnull | stringPer-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
resources[].namenull | stringDisplay name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.
statsobjectTiming statistics for a session.
stats.active_secondsnumberCumulative time in seconds the session spent in `running` status. Excludes idle time.
stats.duration_secondsnumberElapsed time since session creation in seconds. For terminated sessions, frozen at the final update.
statusstringSessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion.
titlenull | string
typestring
updated_atstringA timestamp in RFC 3339 format
usageobjectCumulative token usage for a session across all turns.
usage.active_secondsnumberCumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once, unlike `stats.active_seconds`, which sums each thread's own active time. This is the duration the session's runtime cost is priced on.
usage.cache_creationobjectPrompt-cache creation token usage broken down by cache lifetime.
usage.cache_read_input_tokensnumberTotal tokens read from prompt cache.
usage.input_tokensnumberTotal input tokens consumed across all turns.
usage.list_costnull | objectA monetary amount in a specific currency.
usage.output_tokensnumberTotal output tokens generated across all turns.
usage.server_tool_usenull | objectCumulative count of server-executed tool invocations, broken down by tool.
vault_idsarray<string>Vault IDs attached to the session at creation. Empty when no vaults were supplied.
deployment_idnull | stringDeployment ID when the session was created from a deployment reference. Null otherwise.

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

POST /anthropic/v1/sessions/{session_id}/events◐ 部分支持

Claude 官方文档 ↗

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

  • eventsarray必填

    要发送给会话的事件列表。

返回

200

将 sesn_123 换成创建会话返回的 id。每条 user.message 只接受一个非空文本块。支持文本 user.message、user.interrupt 和工具确认;其它事件变体尚不支持。返回的是已接纳事件;模型回复从事件历史或订阅读取。会话等待工具授权时发送的 user.message 会排队:返回的事件 processed_at 为 null,授权处理完成后按发送顺序执行。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>Sent events
data[].idstringUnique identifier for this event.
data[].contentarray<object>Array of content blocks comprising the user message. / The result content returned by the tool. / The result content returned by the tool. / System content blocks. Text-only.
data[].typestring
data[].processed_atnull | string | string | null | string | null | stringA timestamp in RFC 3339 format
data[].session_thread_idnull | stringIf absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread. / Set by the server to the subagent thread this confirmation was routed to. Omitted when it was routed to the primary thread. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread.
data[].resultstringUserToolConfirmationResult enum
data[].tool_use_idstringThe id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. / The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field.
data[].deny_messagenull | stringOptional message providing context for a 'deny' decision. Only allowed when result is 'deny'.
data[].custom_tool_use_idstringThe id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field.
data[].is_errornull | booleanWhether the tool execution resulted in an error.
data[].descriptionstringWhat the agent should produce. Copied from the input event.
data[].max_iterationsnull | numberEvaluate-then-revise cycles before giving up. Default 3, max 20.
data[].outcome_idstringServer-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.
data[].rubricobjectRubric for grading the quality of an outcome.

列出事件

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

GET /anthropic/v1/sessions/{session_id}/events● 支持

Claude 官方文档 ↗

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

  • created_at[gt]string可选

    query: 只返回严格晚于该时间创建的记录。

  • created_at[gte]string可选

    query: 只返回不早于该时间创建的记录。

  • created_at[lt]string可选

    query: 只返回严格早于该时间创建的记录。

  • created_at[lte]string可选

    query: 只返回不晚于该时间创建的记录。

  • orderstring可选

    query: 按事件处理时间排序:asc 从早到晚(默认),desc 相反。

  • typesarray可选

    query: 按事件类型过滤,取值与返回事件的 type 字段一致(如 user.message、agent.tool_use);不传返回全部类型。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

200

先发送消息再读取历史;处理完成前可能只看到已接纳的输入。支持分页、事件类型和时间过滤。会话等待工具授权时停在 session.status_idle,stop_reason 为 requires_action,event_ids 列出待确认的 agent.tool_use;运行失败时先出现 session.error,再出现 session.status_terminated。agent.thinking 与官方一致,是不带内容的进度信号。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringUnique identifier for this event.
data[].contentarray<object>Array of content blocks comprising the user message. / The result content returned by the tool. / Array of text blocks comprising the agent response. / The result content returned by the tool. / The result content returned by the tool. / Message content blocks. / Message content blocks. / The result content returned by the tool. / System content blocks. Text-only.
data[].typestring
data[].processed_atnull | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | null | string | string | string | null | string | stringA timestamp in RFC 3339 format
data[].session_thread_idnull | string | string | string | string | string | null | string | stringIf absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread. / Set by the server to the subagent thread this confirmation was routed to. Omitted when it was routed to the primary thread. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.custom_tool_result` by `custom_tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` by `tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` or `user.tool_result` by `tool_use_id`, so clients do not send it back. / Public `sthr_` ID of the newly created thread. / Public sthr_ ID of the thread that started running. / Public sthr_ ID of the thread that went idle. / Public sthr_ ID of the thread that terminated. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / Public sthr_ ID of the thread that is retrying.
data[].resultstringUserToolConfirmationResult enum / Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress.
data[].tool_use_idstringThe id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. / The id of the `agent.tool_use` event this result corresponds to. / The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field.
data[].deny_messagenull | stringOptional message providing context for a 'deny' decision. Only allowed when result is 'deny'.
data[].custom_tool_use_idstringThe id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field.
data[].is_errornull | booleanWhether the tool execution resulted in an error. / Whether the model request resulted in an error. / Whether the tool execution resulted in an error.
data[].inputobjectInput parameters for the tool call.
data[].namestringName of the custom tool being called. / Name of the MCP tool being used. / Name of the agent tool being used.
data[].mcp_server_namestringName of the MCP server providing the tool.
data[].evaluated_permissionstringAgentEvaluatedPermission enum
data[].evaluationobjectNames the resolved permission_policy that produced evaluated_permission, and under auto carries the judgement. Open union: clients must tolerate unknown variants.
data[].mcp_tool_use_idstringThe id of the `agent.mcp_tool_use` event this result corresponds to.
data[].from_session_thread_idstringPublic `sthr_` ID of the thread that sent the message.
data[].from_agent_namenull | stringName of the callable agent this message came from. Absent when received from the primary agent.
data[].to_session_thread_idstringPublic `sthr_` ID of the thread the message was sent to.
data[].to_agent_namenull | stringName of the callable agent this message was sent to. Absent when sent to the primary agent.
data[].errorobject
data[].stop_reasonobject
data[].agent_namestringName of the callable agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs.
data[].iterationnumber0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc. / 0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`. / 0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.
data[].outcome_idstringThe `outc_` ID of the outcome being evaluated. / Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.
data[].explanationstringHuman-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why.
data[].outcome_evaluation_start_idstringThe id of the corresponding `span.outcome_evaluation_start` event.
data[].usageobjectToken usage for a single model request. / Point-in-time snapshot of a session's cumulative usage.
data[].model_request_start_idstringThe id of the corresponding `span.model_request_start` event.
data[].model_usageobjectToken usage for a single model request.
data[].descriptionstringWhat the agent should produce. Copied from the input event.
data[].max_iterationsnull | numberEvaluate-then-revise cycles before giving up. Default 3, max 20.
data[].rubricobjectRubric for grading the quality of an outcome.
data[].agentnull | objectResolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.
data[].budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
data[].metadataobjectThe session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty.
data[].titlenull | stringThe session's new title. Present only when the update changed it.
next_pagestring | null

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

GET /anthropic/v1/sessions/{session_id}/events/stream◐ 部分支持

Claude 官方文档 ↗

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

  • event_deltasarray可选

    query: 设置后连接同时接收流式增量事件。

返回

200

保持 SSE 连接以接收事件;请求不会像普通 JSON 接口一样立刻结束。先创建会话并替换 sesn_123,再从另一请求发送消息;停止按钮只断开订阅,不会停止智能体。SDK 0.124.0 会过滤 session.usage,完整用量请读历史。传 event_deltas[]=agent.message 可在最终事件到达前收到逐段文本预览;agent.thinking 与官方一致,只有 event_start。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Server-sent events

text/event-stream — chunk / 事件对象

未声明字段结构。

GET /anthropic/v1/deployment_runs○ 未支持

请求参数

  • created_at[gt]string可选

    query: 只返回严格晚于该时间创建的记录。

  • created_at[gte]string可选

    query: 只返回不早于该时间创建的记录。

  • created_at[lt]string可选

    query: 只返回严格早于该时间创建的记录。

  • created_at[lte]string可选

    query: 只返回不晚于该时间创建的记录。

  • deployment_idstring可选

    query: 部署 ID(路径或查询参数)。

  • has_errorboolean可选

    query: 按是否出错过滤部署运行。

  • trigger_typestring可选

    query: 按触发类型过滤部署运行。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringUnique identifier for this run (`drun_...`).
data[].agentobjectA resolved agent reference with a concrete version.
data[].created_atstringA timestamp in RFC 3339 format
data[].deployment_idstringID of the deployment that produced this run.
data[].errornull | objectWhy the run failed to create a session. The type identifies the failure; message is human-readable detail.
data[].session_idnull | stringPopulated on success. Null on creation failure. Exactly one of `session_id` or `error` is non-null.
data[].trigger_contextobjectDescribes what triggered a deployment run, with trigger-specific metadata.
data[].typestring
next_pagestring | null

GET /anthropic/v1/deployment_runs/{deployment_run_id}○ 未支持

请求参数

  • deployment_run_idstring必填

    path: 路径参数:部署运行 ID。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this run (`drun_...`).
agentobjectA resolved agent reference with a concrete version.
agent.idstring
agent.typestring
agent.versionnumber
created_atstringA timestamp in RFC 3339 format
deployment_idstringID of the deployment that produced this run.
errornull | objectWhy the run failed to create a session. The type identifies the failure; message is human-readable detail.
error.messagestringHuman-readable error description.
error.typestring
session_idnull | stringPopulated on success. Null on creation failure. Exactly one of `session_id` or `error` is non-null.
trigger_contextobjectDescribes what triggered a deployment run, with trigger-specific metadata.
trigger_context.scheduled_atstringA timestamp in RFC 3339 format
trigger_context.typestring
typestring

GET /anthropic/v1/deployments○ 未支持

请求参数

  • agent_idstring可选

    query: 按智能体 ID 过滤结果。

  • created_at[gte]string可选

    query: 只返回不早于该时间创建的记录。

  • created_at[lte]string可选

    query: 只返回不晚于该时间创建的记录。

  • include_archivedboolean可选

    query: 是否包含已归档的记录。

  • statusstring可选

    query: 按状态过滤:active 或 paused。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringUnique identifier for this deployment.
data[].agentobjectA resolved agent reference with a concrete version.
data[].archived_atnull | stringA timestamp in RFC 3339 format
data[].created_atstringA timestamp in RFC 3339 format
data[].descriptionnull | stringDescription of what the deployment does.
data[].environment_idstringID of the `environment` where sessions run.
data[].initial_eventsarray<object>Events sent to each session immediately after creation.
data[].metadataobjectArbitrary key-value metadata. Maximum 16 pairs.
data[].namestringHuman-readable name.
data[].paused_reasonnull | objectWhy a deployment is paused. Non-null exactly when `status` is `paused`.
data[].resourcesarray<object>Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials.
data[].schedulenull | object5-field POSIX cron schedule with computed runtime timestamps.
data[].statusstringLifecycle status of a deployment.
data[].typestring
data[].updated_atstringA timestamp in RFC 3339 format
data[].vault_idsarray<string>Vault IDs supplying stored credentials for sessions created from this deployment.
data[].budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
next_pagestring | null

POST /anthropic/v1/deployments○ 未支持

请求体

  • namestring必填

    Human-readable name for the deployment.

  • agentstring | object必填

    Agent to deploy. Accepts the `agent` ID string, which pins the latest version, or an `agent` object with both id and version specified. The agent must exist and not be archived.

    ▸ 展开子字段(3)
    • idstring必填

      The `agent` ID.

    • typestring必填
      取值 agent
    • versionnumber可选

      The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified.

  • environment_idstring必填

    ID of the `environment` defining the container configuration for sessions created from this deployment.

  • initial_eventsarray必填

    Events to send to each session immediately after creation. At least 1, maximum 50.

  • budgetobject可选

    A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.

    ▸ 展开子字段(2)
    • max_list_costobject必填

      A monetary amount in a specific currency.

    • typestring必填
      取值 limit
  • descriptionstring可选

    Description of what the deployment does.

  • metadataobject可选

    Arbitrary key-value metadata. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.

  • resourcesarray可选

    Resources (e.g. repositories, files) to mount into each session's container. Maximum 500.

  • scheduleobject可选

    5-field POSIX cron schedule. Literal wall-clock matching in the configured timezone.

    ▸ 展开子字段(3)
    • expressionstring必填

      5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 \* \* 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily).

    • timezonestring必填

      Required. IANA timezone identifier (e.g., "America/Los_Angeles", "UTC"). Validated against the IANA timezone database.

    • typestring必填
      取值 cron
  • vault_idsarray可选

    Vault IDs for stored credentials the agent can use during sessions created from this deployment. Maximum 50.

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this deployment.
agentobjectA resolved agent reference with a concrete version.
agent.idstring
agent.typestring
agent.versionnumber
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
descriptionnull | stringDescription of what the deployment does.
environment_idstringID of the `environment` where sessions run.
initial_eventsarray<object>Events sent to each session immediately after creation.
initial_events[].contentarray<object>Array of content blocks for the user message. / System content blocks to append. Text-only.
initial_events[].typestring
initial_events[].descriptionstringWhat the agent should produce. This is the task specification.
initial_events[].rubricobjectRubric for grading the quality of an outcome.
initial_events[].max_iterationsnull | numberEval→revision cycles before giving up. Default 3, max 20.
metadataobjectArbitrary key-value metadata. Maximum 16 pairs.
namestringHuman-readable name.
paused_reasonnull | objectWhy a deployment is paused. Non-null exactly when `status` is `paused`.
paused_reason.typestring
paused_reason.errorobjectThe error that triggered an auto-pause. Matches the failed run's `error.type`.
resourcesarray<object>Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials.
resources[].typestring
resources[].urlstringGithub URL of the repository
resources[].checkoutnull | objectBranch or commit to check out. Defaults to the repository's default branch.
resources[].mount_pathnull | stringMount path in the container. Defaults to `/workspace/<repo-name>`. / Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.
resources[].file_idstringID of a previously uploaded file.
resources[].memory_store_idstringThe memory store ID (memstore_...). Must belong to the caller's organization and workspace.
resources[].accessnull | stringAccess mode for an attached memory store.
resources[].instructionsnull | stringPer-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
schedulenull | object5-field POSIX cron schedule with computed runtime timestamps.
schedule.expressionstring5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 * * 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily).
schedule.timezonestringIANA timezone identifier (e.g., "America/Los_Angeles", "UTC").
schedule.typestring
schedule.last_run_atnull | stringA timestamp in RFC 3339 format
schedule.upcoming_runs_atarray<string>Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused deployments (reflects what the schedule would do if unpaused); empty once the deployment is archived (`archived_at` set). Each fire is offset by a small per-schedule jitter, so a run will actually start at or shortly after its listed time.
statusstringLifecycle status of a deployment.
typestring
updated_atstringA timestamp in RFC 3339 format
vault_idsarray<string>Vault IDs supplying stored credentials for sessions created from this deployment.
budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
budget.max_list_costobjectA monetary amount in a specific currency.
budget.typestring

GET /anthropic/v1/deployments/{deployment_id}○ 未支持

请求参数

  • deployment_idstring必填

    path: 部署 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this deployment.
agentobjectA resolved agent reference with a concrete version.
agent.idstring
agent.typestring
agent.versionnumber
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
descriptionnull | stringDescription of what the deployment does.
environment_idstringID of the `environment` where sessions run.
initial_eventsarray<object>Events sent to each session immediately after creation.
initial_events[].contentarray<object>Array of content blocks for the user message. / System content blocks to append. Text-only.
initial_events[].typestring
initial_events[].descriptionstringWhat the agent should produce. This is the task specification.
initial_events[].rubricobjectRubric for grading the quality of an outcome.
initial_events[].max_iterationsnull | numberEval→revision cycles before giving up. Default 3, max 20.
metadataobjectArbitrary key-value metadata. Maximum 16 pairs.
namestringHuman-readable name.
paused_reasonnull | objectWhy a deployment is paused. Non-null exactly when `status` is `paused`.
paused_reason.typestring
paused_reason.errorobjectThe error that triggered an auto-pause. Matches the failed run's `error.type`.
resourcesarray<object>Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials.
resources[].typestring
resources[].urlstringGithub URL of the repository
resources[].checkoutnull | objectBranch or commit to check out. Defaults to the repository's default branch.
resources[].mount_pathnull | stringMount path in the container. Defaults to `/workspace/<repo-name>`. / Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.
resources[].file_idstringID of a previously uploaded file.
resources[].memory_store_idstringThe memory store ID (memstore_...). Must belong to the caller's organization and workspace.
resources[].accessnull | stringAccess mode for an attached memory store.
resources[].instructionsnull | stringPer-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
schedulenull | object5-field POSIX cron schedule with computed runtime timestamps.
schedule.expressionstring5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 * * 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily).
schedule.timezonestringIANA timezone identifier (e.g., "America/Los_Angeles", "UTC").
schedule.typestring
schedule.last_run_atnull | stringA timestamp in RFC 3339 format
schedule.upcoming_runs_atarray<string>Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused deployments (reflects what the schedule would do if unpaused); empty once the deployment is archived (`archived_at` set). Each fire is offset by a small per-schedule jitter, so a run will actually start at or shortly after its listed time.
statusstringLifecycle status of a deployment.
typestring
updated_atstringA timestamp in RFC 3339 format
vault_idsarray<string>Vault IDs supplying stored credentials for sessions created from this deployment.
budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
budget.max_list_costobjectA monetary amount in a specific currency.
budget.typestring

POST /anthropic/v1/deployments/{deployment_id}○ 未支持

请求参数

  • deployment_idstring必填

    path: 部署 ID(路径或查询参数)。

  • namestring可选

    Human-readable name. Must be non-empty. Omit to preserve. Cannot be cleared.

  • agentstring | object可选

    Agent to deploy. Accepts the `agent` ID string, which re-pins to the latest version, or an `agent` object with both id and version specified. Omit to preserve. Cannot be cleared.

    ▸ 展开子字段(3)
    • idstring必填

      The `agent` ID.

    • typestring必填
      取值 agent
    • versionnumber可选

      The specific `agent` version to use. Omit to use the latest version. Must be at least 1 if specified.

  • environment_idstring可选

    ID of the `environment` where sessions run. Omit to preserve. Cannot be cleared.

  • budgetobject可选

    A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.

    ▸ 展开子字段(2)
    • max_list_costobject必填

      A monetary amount in a specific currency.

    • typestring必填
      取值 limit
  • descriptionstring可选

    Description. Omit to preserve; send empty string or null to clear.

  • initial_eventsarray可选

    Initial events. Full replacement. Omit to preserve. Cannot be cleared. At least 1, maximum 50.

  • metadataobject可选

    Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars.

  • resourcesarray可选

    Session resources. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 500.

  • scheduleobject可选

    5-field POSIX cron schedule. Literal wall-clock matching in the configured timezone.

    ▸ 展开子字段(3)
    • expressionstring必填

      5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 \* \* 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily).

    • timezonestring必填

      Required. IANA timezone identifier (e.g., "America/Los_Angeles", "UTC"). Validated against the IANA timezone database.

    • typestring必填
      取值 cron
  • ▸ 更多参数(1)
    • vault_idsarray可选

      Vault IDs. Full replacement. Omit to preserve; send empty array or null to clear. Maximum 50.

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this deployment.
agentobjectA resolved agent reference with a concrete version.
agent.idstring
agent.typestring
agent.versionnumber
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
descriptionnull | stringDescription of what the deployment does.
environment_idstringID of the `environment` where sessions run.
initial_eventsarray<object>Events sent to each session immediately after creation.
initial_events[].contentarray<object>Array of content blocks for the user message. / System content blocks to append. Text-only.
initial_events[].typestring
initial_events[].descriptionstringWhat the agent should produce. This is the task specification.
initial_events[].rubricobjectRubric for grading the quality of an outcome.
initial_events[].max_iterationsnull | numberEval→revision cycles before giving up. Default 3, max 20.
metadataobjectArbitrary key-value metadata. Maximum 16 pairs.
namestringHuman-readable name.
paused_reasonnull | objectWhy a deployment is paused. Non-null exactly when `status` is `paused`.
paused_reason.typestring
paused_reason.errorobjectThe error that triggered an auto-pause. Matches the failed run's `error.type`.
resourcesarray<object>Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials.
resources[].typestring
resources[].urlstringGithub URL of the repository
resources[].checkoutnull | objectBranch or commit to check out. Defaults to the repository's default branch.
resources[].mount_pathnull | stringMount path in the container. Defaults to `/workspace/<repo-name>`. / Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.
resources[].file_idstringID of a previously uploaded file.
resources[].memory_store_idstringThe memory store ID (memstore_...). Must belong to the caller's organization and workspace.
resources[].accessnull | stringAccess mode for an attached memory store.
resources[].instructionsnull | stringPer-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
schedulenull | object5-field POSIX cron schedule with computed runtime timestamps.
schedule.expressionstring5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 * * 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily).
schedule.timezonestringIANA timezone identifier (e.g., "America/Los_Angeles", "UTC").
schedule.typestring
schedule.last_run_atnull | stringA timestamp in RFC 3339 format
schedule.upcoming_runs_atarray<string>Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused deployments (reflects what the schedule would do if unpaused); empty once the deployment is archived (`archived_at` set). Each fire is offset by a small per-schedule jitter, so a run will actually start at or shortly after its listed time.
statusstringLifecycle status of a deployment.
typestring
updated_atstringA timestamp in RFC 3339 format
vault_idsarray<string>Vault IDs supplying stored credentials for sessions created from this deployment.
budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
budget.max_list_costobjectA monetary amount in a specific currency.
budget.typestring

POST /anthropic/v1/deployments/{deployment_id}/archive○ 未支持

请求参数

  • deployment_idstring必填

    path: 部署 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this deployment.
agentobjectA resolved agent reference with a concrete version.
agent.idstring
agent.typestring
agent.versionnumber
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
descriptionnull | stringDescription of what the deployment does.
environment_idstringID of the `environment` where sessions run.
initial_eventsarray<object>Events sent to each session immediately after creation.
initial_events[].contentarray<object>Array of content blocks for the user message. / System content blocks to append. Text-only.
initial_events[].typestring
initial_events[].descriptionstringWhat the agent should produce. This is the task specification.
initial_events[].rubricobjectRubric for grading the quality of an outcome.
initial_events[].max_iterationsnull | numberEval→revision cycles before giving up. Default 3, max 20.
metadataobjectArbitrary key-value metadata. Maximum 16 pairs.
namestringHuman-readable name.
paused_reasonnull | objectWhy a deployment is paused. Non-null exactly when `status` is `paused`.
paused_reason.typestring
paused_reason.errorobjectThe error that triggered an auto-pause. Matches the failed run's `error.type`.
resourcesarray<object>Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials.
resources[].typestring
resources[].urlstringGithub URL of the repository
resources[].checkoutnull | objectBranch or commit to check out. Defaults to the repository's default branch.
resources[].mount_pathnull | stringMount path in the container. Defaults to `/workspace/<repo-name>`. / Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.
resources[].file_idstringID of a previously uploaded file.
resources[].memory_store_idstringThe memory store ID (memstore_...). Must belong to the caller's organization and workspace.
resources[].accessnull | stringAccess mode for an attached memory store.
resources[].instructionsnull | stringPer-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
schedulenull | object5-field POSIX cron schedule with computed runtime timestamps.
schedule.expressionstring5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 * * 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily).
schedule.timezonestringIANA timezone identifier (e.g., "America/Los_Angeles", "UTC").
schedule.typestring
schedule.last_run_atnull | stringA timestamp in RFC 3339 format
schedule.upcoming_runs_atarray<string>Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused deployments (reflects what the schedule would do if unpaused); empty once the deployment is archived (`archived_at` set). Each fire is offset by a small per-schedule jitter, so a run will actually start at or shortly after its listed time.
statusstringLifecycle status of a deployment.
typestring
updated_atstringA timestamp in RFC 3339 format
vault_idsarray<string>Vault IDs supplying stored credentials for sessions created from this deployment.
budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
budget.max_list_costobjectA monetary amount in a specific currency.
budget.typestring

POST /anthropic/v1/deployments/{deployment_id}/pause○ 未支持

请求参数

  • deployment_idstring必填

    path: 部署 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this deployment.
agentobjectA resolved agent reference with a concrete version.
agent.idstring
agent.typestring
agent.versionnumber
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
descriptionnull | stringDescription of what the deployment does.
environment_idstringID of the `environment` where sessions run.
initial_eventsarray<object>Events sent to each session immediately after creation.
initial_events[].contentarray<object>Array of content blocks for the user message. / System content blocks to append. Text-only.
initial_events[].typestring
initial_events[].descriptionstringWhat the agent should produce. This is the task specification.
initial_events[].rubricobjectRubric for grading the quality of an outcome.
initial_events[].max_iterationsnull | numberEval→revision cycles before giving up. Default 3, max 20.
metadataobjectArbitrary key-value metadata. Maximum 16 pairs.
namestringHuman-readable name.
paused_reasonnull | objectWhy a deployment is paused. Non-null exactly when `status` is `paused`.
paused_reason.typestring
paused_reason.errorobjectThe error that triggered an auto-pause. Matches the failed run's `error.type`.
resourcesarray<object>Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials.
resources[].typestring
resources[].urlstringGithub URL of the repository
resources[].checkoutnull | objectBranch or commit to check out. Defaults to the repository's default branch.
resources[].mount_pathnull | stringMount path in the container. Defaults to `/workspace/<repo-name>`. / Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.
resources[].file_idstringID of a previously uploaded file.
resources[].memory_store_idstringThe memory store ID (memstore_...). Must belong to the caller's organization and workspace.
resources[].accessnull | stringAccess mode for an attached memory store.
resources[].instructionsnull | stringPer-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
schedulenull | object5-field POSIX cron schedule with computed runtime timestamps.
schedule.expressionstring5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 * * 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily).
schedule.timezonestringIANA timezone identifier (e.g., "America/Los_Angeles", "UTC").
schedule.typestring
schedule.last_run_atnull | stringA timestamp in RFC 3339 format
schedule.upcoming_runs_atarray<string>Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused deployments (reflects what the schedule would do if unpaused); empty once the deployment is archived (`archived_at` set). Each fire is offset by a small per-schedule jitter, so a run will actually start at or shortly after its listed time.
statusstringLifecycle status of a deployment.
typestring
updated_atstringA timestamp in RFC 3339 format
vault_idsarray<string>Vault IDs supplying stored credentials for sessions created from this deployment.
budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
budget.max_list_costobjectA monetary amount in a specific currency.
budget.typestring

POST /anthropic/v1/deployments/{deployment_id}/run○ 未支持

请求参数

  • deployment_idstring必填

    path: 部署 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this run (`drun_...`).
agentobjectA resolved agent reference with a concrete version.
agent.idstring
agent.typestring
agent.versionnumber
created_atstringA timestamp in RFC 3339 format
deployment_idstringID of the deployment that produced this run.
errornull | objectWhy the run failed to create a session. The type identifies the failure; message is human-readable detail.
error.messagestringHuman-readable error description.
error.typestring
session_idnull | stringPopulated on success. Null on creation failure. Exactly one of `session_id` or `error` is non-null.
trigger_contextobjectDescribes what triggered a deployment run, with trigger-specific metadata.
trigger_context.scheduled_atstringA timestamp in RFC 3339 format
trigger_context.typestring
typestring

POST /anthropic/v1/deployments/{deployment_id}/unpause○ 未支持

请求参数

  • deployment_idstring必填

    path: 部署 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不能按计划或触发条件自动运行智能体。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this deployment.
agentobjectA resolved agent reference with a concrete version.
agent.idstring
agent.typestring
agent.versionnumber
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
descriptionnull | stringDescription of what the deployment does.
environment_idstringID of the `environment` where sessions run.
initial_eventsarray<object>Events sent to each session immediately after creation.
initial_events[].contentarray<object>Array of content blocks for the user message. / System content blocks to append. Text-only.
initial_events[].typestring
initial_events[].descriptionstringWhat the agent should produce. This is the task specification.
initial_events[].rubricobjectRubric for grading the quality of an outcome.
initial_events[].max_iterationsnull | numberEval→revision cycles before giving up. Default 3, max 20.
metadataobjectArbitrary key-value metadata. Maximum 16 pairs.
namestringHuman-readable name.
paused_reasonnull | objectWhy a deployment is paused. Non-null exactly when `status` is `paused`.
paused_reason.typestring
paused_reason.errorobjectThe error that triggered an auto-pause. Matches the failed run's `error.type`.
resourcesarray<object>Resources attached to sessions created from this deployment. Echoes the input minus write-only credentials.
resources[].typestring
resources[].urlstringGithub URL of the repository
resources[].checkoutnull | objectBranch or commit to check out. Defaults to the repository's default branch.
resources[].mount_pathnull | stringMount path in the container. Defaults to `/workspace/<repo-name>`. / Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.
resources[].file_idstringID of a previously uploaded file.
resources[].memory_store_idstringThe memory store ID (memstore_...). Must belong to the caller's organization and workspace.
resources[].accessnull | stringAccess mode for an attached memory store.
resources[].instructionsnull | stringPer-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
schedulenull | object5-field POSIX cron schedule with computed runtime timestamps.
schedule.expressionstring5-field POSIX cron expression: minute hour day-of-month month day-of-week (e.g., "0 9 * * 1-5" for weekdays at 9am). Day-of-week is 0-7 where 0 and 7 both mean Sunday. Extended cron syntax - seconds or year fields, and the special characters L, W, #, and ? - is not supported, nor are predefined shortcuts (@daily).
schedule.timezonestringIANA timezone identifier (e.g., "America/Los_Angeles", "UTC").
schedule.typestring
schedule.last_run_atnull | stringA timestamp in RFC 3339 format
schedule.upcoming_runs_atarray<string>Up to 5 timestamps of upcoming cron occurrences. Non-empty for active and paused deployments (reflects what the schedule would do if unpaused); empty once the deployment is archived (`archived_at` set). Each fire is offset by a small per-schedule jitter, so a run will actually start at or shortly after its listed time.
statusstringLifecycle status of a deployment.
typestring
updated_atstringA timestamp in RFC 3339 format
vault_idsarray<string>Vault IDs supplying stored credentials for sessions created from this deployment.
budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
budget.max_list_costobjectA monetary amount in a specific currency.
budget.typestring

GET /anthropic/v1/environments◐ 部分支持

Claude 官方文档 ↗

请求参数

  • include_archivedboolean可选

    query: 是否包含已归档的记录。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

200

支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringEnvironment identifier (e.g., 'env_...')
data[].archived_atnull | stringRFC 3339 timestamp when environment was archived, or null if not archived
data[].configobjectEnvironment configuration (either Anthropic Cloud or self-hosted)
data[].created_atstringRFC 3339 timestamp when environment was created
data[].descriptionnull | stringUser-provided description for the environment; null when unset
data[].metadataobjectUser-provided metadata key-value pairs
data[].namestringHuman-readable name for the environment
data[].typestringThe type of object (always 'environment')
data[].updated_atstringRFC 3339 timestamp when environment was last updated
data[].scopestringThe visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.
next_pagestring | null

POST /anthropic/v1/environments◐ 部分支持

请求体

  • namestring必填

    Human-readable name for the environment

  • configobject可选

    Environment configuration

    ▸ 展开子字段(3)
    • typestring必填

      Environment type

      取值 self_hosted
    • networkingobject可选

      Network configuration policy. Omit on update to preserve the existing value.

    • packagesobject可选

      Specify packages (and optionally their versions) available in this environment. When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. Under `limited` networking, requires `networking.allow_package_managers` to be `true`.

  • descriptionstring可选

    Optional description of the environment

  • metadataobject可选

    User-provided metadata key-value pairs

  • scopestring可选

    The visibility scope for this environment. 'organization' makes the environment visible to all accounts. 'account' restricts visibility to the owning account only. API organizations support only 'organization'; 'account' is rejected. If not specified, defaults based on organization type.

返回

501

支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringEnvironment identifier (e.g., 'env_...')
archived_atnull | stringRFC 3339 timestamp when environment was archived, or null if not archived
configobjectEnvironment configuration (either Anthropic Cloud or self-hosted)
config.networkingobjectNetwork configuration policy.
config.packagesobjectPackage manager configuration.
config.typestringEnvironment type
created_atstringRFC 3339 timestamp when environment was created
descriptionnull | stringUser-provided description for the environment; null when unset
metadataobjectUser-provided metadata key-value pairs
namestringHuman-readable name for the environment
typestringThe type of object (always 'environment')
updated_atstringRFC 3339 timestamp when environment was last updated
scopestringThe visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.

DELETE /anthropic/v1/environments/{environment_id}○ 未支持

请求参数

  • environment_idstring必填

    path: 环境 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

会话目前统一使用平台内置环境,还不能自定义创建或管理环境。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringEnvironment identifier
typestringThe type of response

GET /anthropic/v1/environments/{environment_id}◐ 部分支持

Claude 官方文档 ↗

请求参数

  • environment_idstring必填

    path: 环境 ID(路径或查询参数)。

返回

200

支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringEnvironment identifier (e.g., 'env_...')
archived_atnull | stringRFC 3339 timestamp when environment was archived, or null if not archived
configobjectEnvironment configuration (either Anthropic Cloud or self-hosted)
config.networkingobjectNetwork configuration policy.
config.packagesobjectPackage manager configuration.
config.typestringEnvironment type
created_atstringRFC 3339 timestamp when environment was created
descriptionnull | stringUser-provided description for the environment; null when unset
metadataobjectUser-provided metadata key-value pairs
namestringHuman-readable name for the environment
typestringThe type of object (always 'environment')
updated_atstringRFC 3339 timestamp when environment was last updated
scopestringThe visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.

POST /anthropic/v1/environments/{environment_id}◐ 部分支持

请求参数

  • environment_idstring必填

    path: 环境 ID(路径或查询参数)。

  • namestring可选

    Updated name for the environment

  • configobject可选

    Updated environment configuration

    ▸ 展开子字段(3)
    • typestring必填

      Environment type

      取值 self_hosted
    • networkingobject可选

      Network configuration policy. Omit on update to preserve the existing value.

    • packagesobject可选

      Specify packages (and optionally their versions) available in this environment. When versioning, use the version semantics relevant for the package manager, e.g. for `pip` use `package==1.0.0`. You are responsible for validating the package and version exist. Unversioned installs the latest. Under `limited` networking, requires `networking.allow_package_managers` to be `true`.

  • descriptionstring可选

    Updated description of the environment. Omit to preserve; null clears to null; an empty string is stored as an empty string.

  • metadataobject可选

    User-provided metadata key-value pairs. Set a value to null or empty string to delete the key.

  • scopestring可选

    The visibility scope for this environment. 'organization' makes the environment visible to all accounts. 'account' restricts visibility to the owning account only.

返回

501

支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringEnvironment identifier (e.g., 'env_...')
archived_atnull | stringRFC 3339 timestamp when environment was archived, or null if not archived
configobjectEnvironment configuration (either Anthropic Cloud or self-hosted)
config.networkingobjectNetwork configuration policy.
config.packagesobjectPackage manager configuration.
config.typestringEnvironment type
created_atstringRFC 3339 timestamp when environment was created
descriptionnull | stringUser-provided description for the environment; null when unset
metadataobjectUser-provided metadata key-value pairs
namestringHuman-readable name for the environment
typestringThe type of object (always 'environment')
updated_atstringRFC 3339 timestamp when environment was last updated
scopestringThe visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.

POST /anthropic/v1/environments/{environment_id}/archive◐ 部分支持

请求参数

  • environment_idstring必填

    path: 环境 ID(路径或查询参数)。

返回

501

支持租户自建 cloud 环境、配置更新与软归档;内置环境只读。列表支持 limit、page 和 include_archived。limited 网络在沙箱创建时生效;安装失败会终止会话,错误码为 ENVIRONMENT_PACKAGE_INSTALL_FAILED。self_hosted、scope 和跨会话包缓存尚不支持。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringEnvironment identifier (e.g., 'env_...')
archived_atnull | stringRFC 3339 timestamp when environment was archived, or null if not archived
configobjectEnvironment configuration (either Anthropic Cloud or self-hosted)
config.networkingobjectNetwork configuration policy.
config.packagesobjectPackage manager configuration.
config.typestringEnvironment type
created_atstringRFC 3339 timestamp when environment was created
descriptionnull | stringUser-provided description for the environment; null when unset
metadataobjectUser-provided metadata key-value pairs
namestringHuman-readable name for the environment
typestringThe type of object (always 'environment')
updated_atstringRFC 3339 timestamp when environment was last updated
scopestringThe visibility scope for this environment. 'organization' means visible to all accounts. 'account' means visible only to the owning account.

GET /anthropic/v1/environments/{environment_id}/work○ 未支持

请求参数

  • environment_idstring必填

    path: 环境 ID(路径或查询参数)。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringWork identifier (e.g., 'work_...')
data[].acknowledged_atnull | stringRFC 3339 timestamp when work was acknowledged by Environment Manager
data[].created_atstringRFC 3339 timestamp when work was created
data[].dataobjectThe actual work to be performed (session or health check)
data[].environment_idstringEnvironment identifier this work belongs to (e.g., `env_...`)
data[].latest_heartbeat_atnull | stringRFC 3339 timestamp of the most recent heartbeat
data[].metadataobjectUser-provided metadata key-value pairs associated with this work item
data[].secretnull | stringCredential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths.
data[].started_atnull | stringRFC 3339 timestamp when work execution started
data[].statestringCurrent state of the work item
data[].stop_requested_atnull | stringRFC 3339 timestamp when stop was requested
data[].stopped_atnull | stringRFC 3339 timestamp when work execution stopped
data[].typestringThe type of object (always 'work')
next_pagestring | null

GET /anthropic/v1/environments/{environment_id}/work/{work_id}○ 未支持

请求参数

  • environment_idstring必填

    path: 环境 ID(路径或查询参数)。

  • work_idstring必填

    path: 路径参数:任务 ID。

  • environment_idstring必填

    query: 环境 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringWork identifier (e.g., 'work_...')
acknowledged_atnull | stringRFC 3339 timestamp when work was acknowledged by Environment Manager
created_atstringRFC 3339 timestamp when work was created
dataobjectThe actual work to be performed (session or health check)
data.idstringSession identifier (e.g., 'session_...') / Health check identifier
data.typestringType of work data
environment_idstringEnvironment identifier this work belongs to (e.g., `env_...`)
latest_heartbeat_atnull | stringRFC 3339 timestamp of the most recent heartbeat
metadataobjectUser-provided metadata key-value pairs associated with this work item
secretnull | stringCredential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths.
started_atnull | stringRFC 3339 timestamp when work execution started
statestringCurrent state of the work item
stop_requested_atnull | stringRFC 3339 timestamp when stop was requested
stopped_atnull | stringRFC 3339 timestamp when work execution stopped
typestringThe type of object (always 'work')

POST /anthropic/v1/environments/{environment_id}/work/{work_id}○ 未支持

请求参数

  • environment_idstring必填

    path: 环境 ID(路径或查询参数)。

  • work_idstring必填

    path: 路径参数:任务 ID。

  • environment_idstring必填

    query: 环境 ID(路径或查询参数)。

  • metadataobject必填

    Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve existing metadata.

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringWork identifier (e.g., 'work_...')
acknowledged_atnull | stringRFC 3339 timestamp when work was acknowledged by Environment Manager
created_atstringRFC 3339 timestamp when work was created
dataobjectThe actual work to be performed (session or health check)
data.idstringSession identifier (e.g., 'session_...') / Health check identifier
data.typestringType of work data
environment_idstringEnvironment identifier this work belongs to (e.g., `env_...`)
latest_heartbeat_atnull | stringRFC 3339 timestamp of the most recent heartbeat
metadataobjectUser-provided metadata key-value pairs associated with this work item
secretnull | stringCredential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths.
started_atnull | stringRFC 3339 timestamp when work execution started
statestringCurrent state of the work item
stop_requested_atnull | stringRFC 3339 timestamp when stop was requested
stopped_atnull | stringRFC 3339 timestamp when work execution stopped
typestringThe type of object (always 'work')

POST /anthropic/v1/environments/{environment_id}/work/{work_id}/ack○ 未支持

请求参数

  • environment_idstring必填

    path: 环境 ID(路径或查询参数)。

  • work_idstring必填

    path: 路径参数:任务 ID。

  • environment_idstring必填

    query: 环境 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringWork identifier (e.g., 'work_...')
acknowledged_atnull | stringRFC 3339 timestamp when work was acknowledged by Environment Manager
created_atstringRFC 3339 timestamp when work was created
dataobjectThe actual work to be performed (session or health check)
data.idstringSession identifier (e.g., 'session_...') / Health check identifier
data.typestringType of work data
environment_idstringEnvironment identifier this work belongs to (e.g., `env_...`)
latest_heartbeat_atnull | stringRFC 3339 timestamp of the most recent heartbeat
metadataobjectUser-provided metadata key-value pairs associated with this work item
secretnull | stringCredential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths.
started_atnull | stringRFC 3339 timestamp when work execution started
statestringCurrent state of the work item
stop_requested_atnull | stringRFC 3339 timestamp when stop was requested
stopped_atnull | stringRFC 3339 timestamp when work execution stopped
typestringThe type of object (always 'work')

POST /anthropic/v1/environments/{environment_id}/work/{work_id}/heartbeat○ 未支持

请求参数

  • environment_idstring必填

    path: 环境 ID(路径或查询参数)。

  • work_idstring必填

    path: 路径参数:任务 ID。

  • environment_idstring必填

    query: 环境 ID(路径或查询参数)。

  • desired_ttl_secondsnumber可选

    query: 期望的任务租约有效期(秒)。

  • expected_last_heartbeatstring可选

    query: 期望的最后心跳时间,用于并发保护。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
last_heartbeatstringRFC 3339 timestamp of the actual heartbeat from DB
lease_extendedbooleanWhether the heartbeat succeeded in extending the lease
statestringCurrent state of the work item (active/stopping/stopped)
ttl_secondsnumberEffective TTL applied to the lease
typestringThe type of response

POST /anthropic/v1/environments/{environment_id}/work/{work_id}/stop○ 未支持

请求参数

  • environment_idstring必填

    path: 环境 ID(路径或查询参数)。

  • work_idstring必填

    path: 路径参数:任务 ID。

  • environment_idstring必填

    query: 环境 ID(路径或查询参数)。

  • forceboolean可选

    If true, immediately stop work without graceful shutdown

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringWork identifier (e.g., 'work_...')
acknowledged_atnull | stringRFC 3339 timestamp when work was acknowledged by Environment Manager
created_atstringRFC 3339 timestamp when work was created
dataobjectThe actual work to be performed (session or health check)
data.idstringSession identifier (e.g., 'session_...') / Health check identifier
data.typestringType of work data
environment_idstringEnvironment identifier this work belongs to (e.g., `env_...`)
latest_heartbeat_atnull | stringRFC 3339 timestamp of the most recent heartbeat
metadataobjectUser-provided metadata key-value pairs associated with this work item
secretnull | stringCredential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths.
started_atnull | stringRFC 3339 timestamp when work execution started
statestringCurrent state of the work item
stop_requested_atnull | stringRFC 3339 timestamp when stop was requested
stopped_atnull | stringRFC 3339 timestamp when work execution stopped
typestringThe type of object (always 'work')

GET /anthropic/v1/environments/{environment_id}/work/poll○ 未支持

请求参数

  • environment_idstring必填

    path: 环境 ID(路径或查询参数)。

  • block_msnumber可选

    query: 没有可领任务时最多等待的毫秒数(1–999)。

  • reclaim_older_than_msnumber可选

    query: 回收租约早于该毫秒数的任务。

  • Anthropic-Worker-IDstring可选

    query: 发起轮询的自托管执行器实例 ID,用于在控制台聚合环境级任务指标。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringWork identifier (e.g., 'work_...')
acknowledged_atnull | stringRFC 3339 timestamp when work was acknowledged by Environment Manager
created_atstringRFC 3339 timestamp when work was created
dataobjectThe actual work to be performed (session or health check)
data.idstringSession identifier (e.g., 'session_...') / Health check identifier
data.typestringType of work data
environment_idstringEnvironment identifier this work belongs to (e.g., `env_...`)
latest_heartbeat_atnull | stringRFC 3339 timestamp of the most recent heartbeat
metadataobjectUser-provided metadata key-value pairs associated with this work item
secretnull | stringCredential payload used by the environment worker to execute this work item. May be populated when polling for work; null on all other retrieval paths.
started_atnull | stringRFC 3339 timestamp when work execution started
statestringCurrent state of the work item
stop_requested_atnull | stringRFC 3339 timestamp when stop was requested
stopped_atnull | stringRFC 3339 timestamp when work execution stopped
typestringThe type of object (always 'work')

GET /anthropic/v1/environments/{environment_id}/work/stats○ 未支持

请求参数

  • environment_idstring必填

    path: 环境 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

这是自托管执行器领取任务的协议;平台的智能体都在平台上执行,不支持自托管执行器。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
depthnumberNumber of work items waiting to be picked up (lag from consumer group)
oldest_queued_atnull | stringRFC 3339 timestamp of oldest item in the work stream (includes both queued and pending items), null if stream empty
pendingnumberNumber of work items being processed (polled but not acknowledged)
typestringThe type of object
workers_pollingnull | numberNumber of workers that have polled for work in the last 30 seconds. Requires worker_id to be sent with poll requests.

GET /anthropic/v1/memory_stores○ 未支持

请求参数

  • created_at[gte]string可选

    query: 只返回不早于该时间创建的记录。

  • created_at[lte]string可选

    query: 只返回不晚于该时间创建的记录。

  • include_archivedboolean可选

    query: 是否包含已归档的记录。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringUnique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls.
data[].created_atstringA timestamp in RFC 3339 format
data[].namestringHuman-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name.
data[].typestring
data[].updated_atstringA timestamp in RFC 3339 format
data[].archived_atnull | stringA timestamp in RFC 3339 format
data[].descriptionstringFree-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset.
data[].metadataobjectArbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable.
next_pagestring | null

POST /anthropic/v1/memory_stores○ 未支持

请求体

  • namestring必填

    Human-readable name for the store. Required; 1–255 characters; no control characters. The mount-path slug under `/mnt/memory/` is derived from this name (lowercased, non-alphanumeric runs collapsed to a hyphen). Names need not be unique within a workspace.

  • descriptionstring可选

    Free-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent.

  • metadataobject可选

    Arbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Not visible to the agent.

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls.
created_atstringA timestamp in RFC 3339 format
namestringHuman-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name.
typestring
updated_atstringA timestamp in RFC 3339 format
archived_atnull | stringA timestamp in RFC 3339 format
descriptionstringFree-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset.
metadataobjectArbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable.

DELETE /anthropic/v1/memory_stores/{memory_store_id}○ 未支持

请求参数

  • memory_store_idstring必填

    path: 记忆库 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringID of the deleted memory store (a `memstore_...` identifier). The store and all its memories and versions are no longer retrievable.
typestring

GET /anthropic/v1/memory_stores/{memory_store_id}○ 未支持

请求参数

  • memory_store_idstring必填

    path: 记忆库 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls.
created_atstringA timestamp in RFC 3339 format
namestringHuman-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name.
typestring
updated_atstringA timestamp in RFC 3339 format
archived_atnull | stringA timestamp in RFC 3339 format
descriptionstringFree-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset.
metadataobjectArbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable.

POST /anthropic/v1/memory_stores/{memory_store_id}○ 未支持

请求参数

  • memory_store_idstring必填

    path: 记忆库 ID(路径或查询参数)。

  • namestring可选

    New human-readable name for the store. 1–255 characters; no control characters. Renaming changes the slug used for the store's `mount_path` in sessions created after the update.

  • descriptionstring可选

    New description for the store, up to 1024 characters. Pass an empty string to clear it.

  • metadataobject可选

    Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve. The stored bag is limited to 16 keys (up to 64 chars each) with values up to 512 chars.

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls.
created_atstringA timestamp in RFC 3339 format
namestringHuman-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name.
typestring
updated_atstringA timestamp in RFC 3339 format
archived_atnull | stringA timestamp in RFC 3339 format
descriptionstringFree-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset.
metadataobjectArbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable.

POST /anthropic/v1/memory_stores/{memory_store_id}/archive○ 未支持

请求参数

  • memory_store_idstring必填

    path: 记忆库 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the memory store (a `memstore_...` tagged ID). Use this when attaching the store to a session, or in the `{memory_store_id}` path parameter of subsequent calls.
created_atstringA timestamp in RFC 3339 format
namestringHuman-readable name for the store. 1–255 characters. The store's mount-path slug under `/mnt/memory/` is derived from this name.
typestring
updated_atstringA timestamp in RFC 3339 format
archived_atnull | stringA timestamp in RFC 3339 format
descriptionstringFree-text description of what the store contains, up to 1024 characters. Included in the agent's system prompt when the store is attached, so word it to be useful to the agent. Empty string when unset.
metadataobjectArbitrary key-value tags for your own bookkeeping (such as the end user a store belongs to). Up to 16 pairs; keys 1–64 characters; values up to 512 characters. Returned on retrieve/list but not filterable.

GET /anthropic/v1/memory_stores/{memory_store_id}/memories○ 未支持

请求参数

  • memory_store_idstring必填

    path: 记忆库 ID(路径或查询参数)。

  • depthnumber可选

    query: 子节点回溯深度:0(默认)递归返回全部后代,1 只返回直接子节点。

  • path_prefixstring可选

    query: 按路径前缀过滤(需以 / 结尾并对齐分段)。

  • viewstring可选

    query: 返回投影:basic 省略内容,full 附带完整内容。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringUnique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory.
data[].content_sha256stringLowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`.
data[].content_size_bytesnumberSize of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`.
data[].created_atstringA timestamp in RFC 3339 format
data[].memory_store_idstringID of the memory store this memory belongs to (a `memstore_...` value).
data[].memory_version_idstringID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the history via List memory versions.
data[].pathstringHierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes. / The rolled-up path prefix, including a trailing `/` (e.g. `/projects/foo/`). Pass this value as `path_prefix` on a subsequent list call to drill into the directory.
data[].typestring
data[].updated_atstringA timestamp in RFC 3339 format
data[].contentnull | stringThe memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes).
next_pagestring | null

POST /anthropic/v1/memory_stores/{memory_store_id}/memories○ 未支持

请求参数

  • memory_store_idstring必填

    path: 记忆库 ID(路径或查询参数)。

  • viewstring可选

    query: 返回投影:basic 省略内容,full 附带完整内容。

  • contentstring必填

    UTF-8 text content for the new memory. Maximum 100 kB (102,400 bytes). Required; pass `""` explicitly to create an empty memory.

  • pathstring必填

    Hierarchical path for the new memory, e.g. `/projects/foo/notes.md`. Must start with `/`, contain at least one non-empty segment, and be at most 1,024 bytes. Must not contain empty segments, `.` or `..` segments, control or format characters, or the Unicode line and paragraph separators (U+2028, U+2029), and must be NFC-normalized. Paths are case-sensitive.

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory.
content_sha256stringLowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`.
content_size_bytesnumberSize of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`.
created_atstringA timestamp in RFC 3339 format
memory_store_idstringID of the memory store this memory belongs to (a `memstore_...` value).
memory_version_idstringID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the history via List memory versions.
pathstringHierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes.
typestring
updated_atstringA timestamp in RFC 3339 format
contentnull | stringThe memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes).

DELETE /anthropic/v1/memory_stores/{memory_store_id}/memories/{memory_id}○ 未支持

请求参数

  • memory_store_idstring必填

    path: 记忆库 ID(路径或查询参数)。

  • memory_idstring必填

    path: 记忆 ID(路径或查询参数)。

  • memory_store_idstring必填

    query: 记忆库 ID(路径或查询参数)。

  • expected_content_sha256string可选

    query: 期望的内容 SHA-256,用于并发修改保护。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringID of the deleted memory (a `mem_...` value).
typestring

GET /anthropic/v1/memory_stores/{memory_store_id}/memories/{memory_id}○ 未支持

请求参数

  • memory_store_idstring必填

    path: 记忆库 ID(路径或查询参数)。

  • memory_idstring必填

    path: 记忆 ID(路径或查询参数)。

  • memory_store_idstring必填

    query: 记忆库 ID(路径或查询参数)。

  • viewstring可选

    query: 返回投影:basic 省略内容,full 附带完整内容。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory.
content_sha256stringLowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`.
content_size_bytesnumberSize of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`.
created_atstringA timestamp in RFC 3339 format
memory_store_idstringID of the memory store this memory belongs to (a `memstore_...` value).
memory_version_idstringID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the history via List memory versions.
pathstringHierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes.
typestring
updated_atstringA timestamp in RFC 3339 format
contentnull | stringThe memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes).

POST /anthropic/v1/memory_stores/{memory_store_id}/memories/{memory_id}○ 未支持

请求参数

  • memory_store_idstring必填

    path: 记忆库 ID(路径或查询参数)。

  • memory_idstring必填

    path: 记忆 ID(路径或查询参数)。

  • memory_store_idstring必填

    query: 记忆库 ID(路径或查询参数)。

  • viewstring可选

    query: 返回投影:basic 省略内容,full 附带完整内容。

  • contentstring可选

    New UTF-8 text content for the memory. Maximum 100 kB (102,400 bytes). Omit to leave the content unchanged (e.g., for a rename-only update).

  • pathstring可选

    New path for the memory (a rename). Must start with `/`, contain at least one non-empty segment, and be at most 1,024 bytes. Must not contain empty segments, `.` or `..` segments, control or format characters, or the Unicode line and paragraph separators (U+2028, U+2029), and must be NFC-normalized. Paths are case-sensitive. The memory's `id` is preserved across renames. Omit to leave the path unchanged.

  • preconditionobject可选

    Optimistic-concurrency precondition: the update applies only if the memory's stored `content_sha256` equals the supplied value. On mismatch, the request returns `memory_precondition_failed_error` (HTTP 409); re-read the memory and retry against the fresh state. If the precondition fails but the stored state already exactly matches the requested `content` and `path`, the server returns 200 instead of 409.

    ▸ 展开子字段(2)
    • typestring必填
      取值 content_sha256
    • content_sha256string可选

      Expected `content_sha256` of the stored memory (64 lowercase hexadecimal characters). Typically the `content_sha256` returned by a prior read or list call. Because the server applies no content normalization, clients can also compute this locally as the SHA-256 of the UTF-8 content bytes.

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory.
content_sha256stringLowercase hex SHA-256 digest of the UTF-8 `content` bytes (64 characters). The server applies no normalization, so clients can compute the same hash locally for staleness checks and as the value for a `content_sha256` precondition on update. Always populated, regardless of `view`.
content_size_bytesnumberSize of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`.
created_atstringA timestamp in RFC 3339 format
memory_store_idstringID of the memory store this memory belongs to (a `memstore_...` value).
memory_version_idstringID of the `memory_version` representing this memory's current content (a `memver_...` value). This is the authoritative head pointer; `memory_version` objects do not carry an `is_latest` flag, so compare against this field instead. Enumerate the history via List memory versions.
pathstringHierarchical path of the memory within the store, e.g. `/projects/foo/notes.md`. Always starts with `/`. Paths are case-sensitive and unique within a store. Maximum 1,024 bytes.
typestring
updated_atstringA timestamp in RFC 3339 format
contentnull | stringThe memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes).

GET /anthropic/v1/memory_stores/{memory_store_id}/memory_versions○ 未支持

请求参数

  • memory_store_idstring必填

    path: 记忆库 ID(路径或查询参数)。

  • api_key_idstring可选

    query: 只返回用该 API Key 写入的版本。

  • created_at[gte]string可选

    query: 只返回不早于该时间创建的记录。

  • created_at[lte]string可选

    query: 只返回不晚于该时间创建的记录。

  • memory_idstring可选

    query: 记忆 ID(路径或查询参数)。

  • operationstring可选

    query: 只返回记录该类变更的版本。

  • service_account_idstring可选

    query: 只返回该服务账号写入的版本。

  • session_idstring可选

    query: 会话 ID(路径或查询参数)。

  • viewstring可选

    query: 返回投影:basic 省略内容,full 附带完整内容。

  • limitnumber可选

    query: 每页返回的条数上限。

  • ▸ 更多参数(1)
    • pagestring可选

      query: 分页游标,取自上一页响应的 next_page。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringUnique identifier for this version (a `memver_...` value).
data[].created_atstringA timestamp in RFC 3339 format
data[].memory_idstringID of the memory this version snapshots (a `mem_...` value). Remains valid after the memory is deleted; pass it as `memory_id` to List memory versions to retrieve the memory's retained versions, including the `deleted` row while the lineage is retained.
data[].memory_store_idstringID of the memory store this version belongs to (a `memstore_...` value).
data[].operationstringThe kind of mutation a `memory_version` records. Every non-no-op mutation to a memory appends exactly one version row with one of these values.
data[].typestring
data[].contentnull | stringThe memory's UTF-8 text content as of this version. `null` when `view=basic`, when `operation` is `deleted`, or when `redacted_at` is set.
data[].content_sha256null | stringLowercase hex SHA-256 digest of `content` as of this version (64 characters). `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.
data[].content_size_bytesnull | numberSize of `content` in bytes as of this version. `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.
data[].created_byobjectIdentifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the Sessions API.
data[].pathnull | stringThe memory's path at the time of this write. `null` if and only if `redacted_at` is set.
data[].redacted_atnull | stringA timestamp in RFC 3339 format
data[].redacted_byobjectIdentifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the Sessions API.
next_pagestring | null

GET /anthropic/v1/memory_stores/{memory_store_id}/memory_versions/{memory_version_id}○ 未支持

请求参数

  • memory_store_idstring必填

    path: 记忆库 ID(路径或查询参数)。

  • memory_version_idstring必填

    path: 路径参数:记忆版本 ID。

  • memory_store_idstring必填

    query: 记忆库 ID(路径或查询参数)。

  • viewstring可选

    query: 返回投影:basic 省略内容,full 附带完整内容。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this version (a `memver_...` value).
created_atstringA timestamp in RFC 3339 format
memory_idstringID of the memory this version snapshots (a `mem_...` value). Remains valid after the memory is deleted; pass it as `memory_id` to List memory versions to retrieve the memory's retained versions, including the `deleted` row while the lineage is retained.
memory_store_idstringID of the memory store this version belongs to (a `memstore_...` value).
operationstringThe kind of mutation a `memory_version` records. Every non-no-op mutation to a memory appends exactly one version row with one of these values.
typestring
contentnull | stringThe memory's UTF-8 text content as of this version. `null` when `view=basic`, when `operation` is `deleted`, or when `redacted_at` is set.
content_sha256null | stringLowercase hex SHA-256 digest of `content` as of this version (64 characters). `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.
content_size_bytesnull | numberSize of `content` in bytes as of this version. `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.
created_byobjectIdentifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the Sessions API.
created_by.session_idstringID of the session that performed the write (a `sesn_...` value). Look up the session via Retrieve a session for further provenance.
created_by.typestring
created_by.api_key_idstringID of the API key that performed the write. This identifies the key, not the secret.
created_by.user_idstringID of the user who performed the write (a `user_...` value).
created_by.service_account_idstringID of the service account that performed the write (a `svac_...` value).
pathnull | stringThe memory's path at the time of this write. `null` if and only if `redacted_at` is set.
redacted_atnull | stringA timestamp in RFC 3339 format
redacted_byobjectIdentifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the Sessions API.
redacted_by.session_idstringID of the session that performed the write (a `sesn_...` value). Look up the session via Retrieve a session for further provenance.
redacted_by.typestring
redacted_by.api_key_idstringID of the API key that performed the write. This identifies the key, not the secret.
redacted_by.user_idstringID of the user who performed the write (a `user_...` value).
redacted_by.service_account_idstringID of the service account that performed the write (a `svac_...` value).

POST /anthropic/v1/memory_stores/{memory_store_id}/memory_versions/{memory_version_id}/redact○ 未支持

请求参数

  • memory_store_idstring必填

    path: 记忆库 ID(路径或查询参数)。

  • memory_version_idstring必填

    path: 路径参数:记忆版本 ID。

  • memory_store_idstring必填

    query: 记忆库 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供智能体可读写的持久记忆库。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this version (a `memver_...` value).
created_atstringA timestamp in RFC 3339 format
memory_idstringID of the memory this version snapshots (a `mem_...` value). Remains valid after the memory is deleted; pass it as `memory_id` to List memory versions to retrieve the memory's retained versions, including the `deleted` row while the lineage is retained.
memory_store_idstringID of the memory store this version belongs to (a `memstore_...` value).
operationstringThe kind of mutation a `memory_version` records. Every non-no-op mutation to a memory appends exactly one version row with one of these values.
typestring
contentnull | stringThe memory's UTF-8 text content as of this version. `null` when `view=basic`, when `operation` is `deleted`, or when `redacted_at` is set.
content_sha256null | stringLowercase hex SHA-256 digest of `content` as of this version (64 characters). `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.
content_size_bytesnull | numberSize of `content` in bytes as of this version. `null` when `redacted_at` is set or `operation` is `deleted`. Populated regardless of `view` otherwise.
created_byobjectIdentifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the Sessions API.
created_by.session_idstringID of the session that performed the write (a `sesn_...` value). Look up the session via Retrieve a session for further provenance.
created_by.typestring
created_by.api_key_idstringID of the API key that performed the write. This identifies the key, not the secret.
created_by.user_idstringID of the user who performed the write (a `user_...` value).
created_by.service_account_idstringID of the service account that performed the write (a `svac_...` value).
pathnull | stringThe memory's path at the time of this write. `null` if and only if `redacted_at` is set.
redacted_atnull | stringA timestamp in RFC 3339 format
redacted_byobjectIdentifies who performed a write or redact operation. Captured at write time on the `memory_version` row. The API key that created a session is not recorded on agent writes; attribution answers who made the write, not who is ultimately responsible. Look up session provenance separately via the Sessions API.
redacted_by.session_idstringID of the session that performed the write (a `sesn_...` value). Look up the session via Retrieve a session for further provenance.
redacted_by.typestring
redacted_by.api_key_idstringID of the API key that performed the write. This identifies the key, not the secret.
redacted_by.user_idstringID of the user who performed the write (a `user_...` value).
redacted_by.service_account_idstringID of the service account that performed the write (a `svac_...` value).

DELETE /anthropic/v1/sessions/{session_id}○ 未支持

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

会话目前支持创建、读取、列出、更新与归档;删除还没有实现。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstring
typestring

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

POST /anthropic/v1/sessions/{session_id}◐ 部分支持

Claude 官方文档 ↗

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

  • agentobject可选

    会话要运行的智能体:直接写智能体 ID 字符串(固定用最新版本),或传对象指定 id 与 version(见子字段)。

    ▸ 展开子字段(2)
    • mcp_serversarray可选

      替换本会话的 MCP 服务器列表:传入的数组整体生效;传空数组清除,省略沿用智能体的配置。

    • toolsarray可选

      替换本会话的工具配置;传空数组清除,省略沿用智能体的配置。

  • budgetobject可选

    A hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.

    ▸ 展开子字段(2)
    • max_list_costobject必填

      预算内列表类调用的花费上限。

    • typestring必填

      预算类型,目前只有 max_list_cost。

      取值 limit
  • metadataobject可选

    Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omit the field to preserve.

  • titlestring可选

    Human-readable session title.

  • vault_idsarray可选

    Vault IDs (`vlt_*`) to attach to the session. Not yet supported; requests setting this field are rejected. Reserved for future use.

返回

200

支持 title 与 metadata(官方补丁语义:字符串值写入、null 删除该键、整包 null 清空,未提及的键保留)。官方的 agent 覆盖(tools/mcp_servers)、budget 与 vault_ids 不支持,传入返回 400 并点名字段。归档后的会话更新返回 409。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstring
agentobjectResolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.
agent.idstring
agent.descriptionnull | string
agent.mcp_serversarray<object>
agent.modelobjectModel identifier and configuration.
agent.multiagentnull | objectResolved coordinator topology with full agent definitions for each roster member.
agent.namestring
agent.skillsarray<object>
agent.systemnull | string
agent.toolsarray<object>
agent.typestring
agent.versionnumber
archived_atnull | stringA timestamp in RFC 3339 format
budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
budget.max_list_costobjectA monetary amount in a specific currency.
budget.typestring
created_atstringA timestamp in RFC 3339 format
environment_idstring
metadataobject
outcome_evaluationsarray<object>Per-outcome evaluation state. One entry per `define_outcome` event sent to the session.
outcome_evaluations[].completed_atnull | stringA timestamp in RFC 3339 format
outcome_evaluations[].descriptionstringWhat the agent should produce.
outcome_evaluations[].explanationnull | stringGrader's verdict text from the most recent evaluation. For `satisfied`, explains why criteria are met; for `needs_revision` (intermediate), what's missing; for `failed`, why unrecoverable.
outcome_evaluations[].iterationnumber0-indexed revision cycle the outcome is currently on.
outcome_evaluations[].outcome_idstringServer-generated outc_ ID for this outcome.
outcome_evaluations[].resultstringCurrent evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal.
outcome_evaluations[].typestring
resourcesarray<object>
resources[].idstring
resources[].created_atstringA timestamp in RFC 3339 format
resources[].mount_pathstring | null | stringFilesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.
resources[].typestring
resources[].updated_atstringA timestamp in RFC 3339 format
resources[].urlstring
resources[].checkoutnull | object
resources[].file_idstring
resources[].memory_store_idstringThe memory store ID (memstore_...). Must belong to the caller's organization and workspace.
resources[].accessnull | stringAccess mode for an attached memory store.
resources[].descriptionstringDescription of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.
resources[].instructionsnull | stringPer-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
resources[].namenull | stringDisplay name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.
statsobjectTiming statistics for a session.
stats.active_secondsnumberCumulative time in seconds the session spent in `running` status. Excludes idle time.
stats.duration_secondsnumberElapsed time since session creation in seconds. For terminated sessions, frozen at the final update.
statusstringSessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion.
titlenull | string
typestring
updated_atstringA timestamp in RFC 3339 format
usageobjectCumulative token usage for a session across all turns.
usage.active_secondsnumberCumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once, unlike `stats.active_seconds`, which sums each thread's own active time. This is the duration the session's runtime cost is priced on.
usage.cache_creationobjectPrompt-cache creation token usage broken down by cache lifetime.
usage.cache_read_input_tokensnumberTotal tokens read from prompt cache.
usage.input_tokensnumberTotal input tokens consumed across all turns.
usage.list_costnull | objectA monetary amount in a specific currency.
usage.output_tokensnumberTotal output tokens generated across all turns.
usage.server_tool_usenull | objectCumulative count of server-executed tool invocations, broken down by tool.
vault_idsarray<string>Vault IDs attached to the session at creation. Empty when no vaults were supplied.
deployment_idnull | stringDeployment ID when the session was created from a deployment reference. Null otherwise.

归档会话

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

POST /anthropic/v1/sessions/{session_id}/archive● 支持

Claude 官方文档 ↗

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

返回

200

归档后的会话拒绝新消息(400 invalid_request_error,写明会话已归档),读取与事件历史仍可用;重复归档幂等,archived_at 保持首次归档时间。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstring
agentobjectResolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.
agent.idstring
agent.descriptionnull | string
agent.mcp_serversarray<object>
agent.modelobjectModel identifier and configuration.
agent.multiagentnull | objectResolved coordinator topology with full agent definitions for each roster member.
agent.namestring
agent.skillsarray<object>
agent.systemnull | string
agent.toolsarray<object>
agent.typestring
agent.versionnumber
archived_atnull | stringA timestamp in RFC 3339 format
budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
budget.max_list_costobjectA monetary amount in a specific currency.
budget.typestring
created_atstringA timestamp in RFC 3339 format
environment_idstring
metadataobject
outcome_evaluationsarray<object>Per-outcome evaluation state. One entry per `define_outcome` event sent to the session.
outcome_evaluations[].completed_atnull | stringA timestamp in RFC 3339 format
outcome_evaluations[].descriptionstringWhat the agent should produce.
outcome_evaluations[].explanationnull | stringGrader's verdict text from the most recent evaluation. For `satisfied`, explains why criteria are met; for `needs_revision` (intermediate), what's missing; for `failed`, why unrecoverable.
outcome_evaluations[].iterationnumber0-indexed revision cycle the outcome is currently on.
outcome_evaluations[].outcome_idstringServer-generated outc_ ID for this outcome.
outcome_evaluations[].resultstringCurrent evaluation state. `pending` before the agent begins work; `running` while producing or revising; `evaluating` while the grader scores; `satisfied`/`max_iterations_reached`/`failed`/`interrupted` are terminal.
outcome_evaluations[].typestring
resourcesarray<object>
resources[].idstring
resources[].created_atstringA timestamp in RFC 3339 format
resources[].mount_pathstring | null | stringFilesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.
resources[].typestring
resources[].updated_atstringA timestamp in RFC 3339 format
resources[].urlstring
resources[].checkoutnull | object
resources[].file_idstring
resources[].memory_store_idstringThe memory store ID (memstore_...). Must belong to the caller's organization and workspace.
resources[].accessnull | stringAccess mode for an attached memory store.
resources[].descriptionstringDescription of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.
resources[].instructionsnull | stringPer-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
resources[].namenull | stringDisplay name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.
statsobjectTiming statistics for a session.
stats.active_secondsnumberCumulative time in seconds the session spent in `running` status. Excludes idle time.
stats.duration_secondsnumberElapsed time since session creation in seconds. For terminated sessions, frozen at the final update.
statusstringSessionStatus enum - `rescheduling` - Transient error occurred, retrying automatically. - `running` - Agent is actively executing. - `idle` - Agent is waiting for input, including user messages or tool confirmations. Sessions start in idle. - `terminated` - Session has ended, either due to an error or completion.
titlenull | string
typestring
updated_atstringA timestamp in RFC 3339 format
usageobjectCumulative token usage for a session across all turns.
usage.active_secondsnumberCumulative time in seconds during which the session had at least one thread in running status. Overlapping activity from concurrent threads is counted once, unlike `stats.active_seconds`, which sums each thread's own active time. This is the duration the session's runtime cost is priced on.
usage.cache_creationobjectPrompt-cache creation token usage broken down by cache lifetime.
usage.cache_read_input_tokensnumberTotal tokens read from prompt cache.
usage.input_tokensnumberTotal input tokens consumed across all turns.
usage.list_costnull | objectA monetary amount in a specific currency.
usage.output_tokensnumberTotal output tokens generated across all turns.
usage.server_tool_usenull | objectCumulative count of server-executed tool invocations, broken down by tool.
vault_idsarray<string>Vault IDs attached to the session at creation. Empty when no vaults were supplied.
deployment_idnull | stringDeployment ID when the session was created from a deployment reference. Null otherwise.

GET /anthropic/v1/sessions/{session_id}/resources◐ 部分支持

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

501

支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstring
data[].created_atstringA timestamp in RFC 3339 format
data[].mount_pathstring | null | stringFilesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.
data[].typestring
data[].updated_atstringA timestamp in RFC 3339 format
data[].urlstring
data[].checkoutnull | object
data[].file_idstring
data[].memory_store_idstringThe memory store ID (memstore_...). Must belong to the caller's organization and workspace.
data[].accessnull | stringAccess mode for an attached memory store.
data[].descriptionstringDescription of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.
data[].instructionsnull | stringPer-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
data[].namenull | stringDisplay name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.
next_pagestring | null

POST /anthropic/v1/sessions/{session_id}/resources◐ 部分支持

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

  • typestring必填

    query: 要新增的资源在请求体里对应的字段名。

    取值 file
  • file_idstring必填

    ID of a previously uploaded file.

  • mount_pathstring可选

    Mount path in the container. Defaults to `/mnt/session/uploads/<file_id>`.

返回

501

支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstring
created_atstringA timestamp in RFC 3339 format
file_idstring
mount_pathstring
typestring
updated_atstringA timestamp in RFC 3339 format

DELETE /anthropic/v1/sessions/{session_id}/resources/{resource_id}◐ 部分支持

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

  • resource_idstring必填

    path: 路径参数:会话资源 ID。

  • session_idstring必填

    query: 会话 ID(路径或查询参数)。

返回

501

支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstring
typestring

GET /anthropic/v1/sessions/{session_id}/resources/{resource_id}◐ 部分支持

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

  • resource_idstring必填

    path: 路径参数:会话资源 ID。

  • session_idstring必填

    query: 会话 ID(路径或查询参数)。

返回

501

支持 file 类型资源的持久化、查询和解除关联,单会话最多 500 条。文件须属于当前租户且有效。默认路径为 /mnt/session/uploads/<file_id>,自定义路径归一到该目录,拒绝父目录遍历。不修改文件内容;本批尚不将资源同步到沙箱。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstring
created_atstringA timestamp in RFC 3339 format
mount_pathstring | null | stringFilesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.
typestring
updated_atstringA timestamp in RFC 3339 format
urlstring
checkoutnull | object
checkout.namestringBranch name to check out.
checkout.typestring
checkout.shastringFull commit SHA to check out.
file_idstring
memory_store_idstringThe memory store ID (memstore_...). Must belong to the caller's organization and workspace.
accessnull | stringAccess mode for an attached memory store.
descriptionstringDescription of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.
instructionsnull | stringPer-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
namenull | stringDisplay name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.

POST /anthropic/v1/sessions/{session_id}/resources/{resource_id}○ 未支持

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

  • resource_idstring必填

    path: 路径参数:会话资源 ID。

  • session_idstring必填

    query: 会话 ID(路径或查询参数)。

  • authorization_tokenstring必填

    New authorization token for the resource. Currently only `github_repository` resources support token rotation.

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不能给会话挂载额外资源(文件、代码仓库等)。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstring
created_atstringA timestamp in RFC 3339 format
mount_pathstring | null | stringFilesystem path where the store is mounted in the session container, e.g. /mnt/memory/user-preferences. Derived from the store's name. Output-only.
typestring
updated_atstringA timestamp in RFC 3339 format
urlstring
checkoutnull | object
checkout.namestringBranch name to check out.
checkout.typestring
checkout.shastringFull commit SHA to check out.
file_idstring
memory_store_idstringThe memory store ID (memstore_...). Must belong to the caller's organization and workspace.
accessnull | stringAccess mode for an attached memory store.
descriptionstringDescription of the memory store, snapshotted at attach time. Rendered into the agent's system prompt. Empty string when the store has no description.
instructionsnull | stringPer-attachment guidance for the agent on how to use this store. Rendered into the memory section of the system prompt. Max 4096 chars.
namenull | stringDisplay name of the memory store, snapshotted at attach time. Later edits to the store's name do not propagate to this resource.

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

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

Claude 官方文档 ↗

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

200

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

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringUnique identifier for this thread.
data[].agentobjectThe resolved agent a `session_thread` runs.
data[].archived_atnull | stringA timestamp in RFC 3339 format
data[].created_atstringA timestamp in RFC 3339 format
data[].parent_thread_idnull | stringParent thread that spawned this thread. Null for the primary thread.
data[].session_idstringThe session this thread belongs to.
data[].statsnull | objectTiming statistics for a session thread.
data[].statusstringSessionThreadStatus enum
data[].typestring
data[].updated_atstringA timestamp in RFC 3339 format
data[].usagenull | objectCumulative token usage for a session thread across all turns.
next_pagestring | null

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

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

Claude 官方文档 ↗

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

  • thread_idstring必填

    path: 路径参数:线程 ID。

  • session_idstring必填

    query: 会话 ID(路径或查询参数)。

返回

200

返回本会话的主线程或子线程,与列表项逐字段一致。其他会话的线程、未知线程或非 sthr_ id 一律返回 404,不泄露其存在性。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this thread.
agentobjectThe resolved agent a `session_thread` runs.
agent.modelstring | objectThe advisor model id. / Model identifier and configuration.
agent.typestring
agent.idstring
agent.descriptionnull | string
agent.mcp_serversarray<object>
agent.namestring
agent.skillsarray<object>
agent.systemnull | string
agent.toolsarray<object>
agent.versionnumber
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
parent_thread_idnull | stringParent thread that spawned this thread. Null for the primary thread.
session_idstringThe session this thread belongs to.
statsnull | objectTiming statistics for a session thread.
stats.active_secondsnumberCumulative time in seconds the thread spent actively running. Excludes idle time.
stats.duration_secondsnumberElapsed time since thread creation in seconds. For archived threads, frozen at the final update.
stats.startup_secondsnumberTime in seconds for the thread to begin running. Zero for child threads, which start immediately.
statusstringSessionThreadStatus enum
typestring
updated_atstringA timestamp in RFC 3339 format
usagenull | objectCumulative token usage for a session thread across all turns.
usage.active_secondsnumberCumulative 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_creationobjectPrompt-cache creation token usage broken down by cache lifetime.
usage.cache_read_input_tokensnumberTotal tokens read from prompt cache.
usage.input_tokensnumberTotal input tokens consumed across all turns.
usage.list_costnull | objectA monetary amount in a specific currency.
usage.output_tokensnumberTotal output tokens generated across all turns.
usage.server_tool_usenull | objectCumulative count of server-executed tool invocations, broken down by tool.

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

POST /anthropic/v1/sessions/{session_id}/threads/{thread_id}/archive◐ 部分支持

Claude 官方文档 ↗

请求参数

  • 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

名称类型说明
idstringUnique identifier for this thread.
agentobjectThe resolved agent a `session_thread` runs.
agent.modelstring | objectThe advisor model id. / Model identifier and configuration.
agent.typestring
agent.idstring
agent.descriptionnull | string
agent.mcp_serversarray<object>
agent.namestring
agent.skillsarray<object>
agent.systemnull | string
agent.toolsarray<object>
agent.versionnumber
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
parent_thread_idnull | stringParent thread that spawned this thread. Null for the primary thread.
session_idstringThe session this thread belongs to.
statsnull | objectTiming statistics for a session thread.
stats.active_secondsnumberCumulative time in seconds the thread spent actively running. Excludes idle time.
stats.duration_secondsnumberElapsed time since thread creation in seconds. For archived threads, frozen at the final update.
stats.startup_secondsnumberTime in seconds for the thread to begin running. Zero for child threads, which start immediately.
statusstringSessionThreadStatus enum
typestring
updated_atstringA timestamp in RFC 3339 format
usagenull | objectCumulative token usage for a session thread across all turns.
usage.active_secondsnumberCumulative 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_creationobjectPrompt-cache creation token usage broken down by cache lifetime.
usage.cache_read_input_tokensnumberTotal tokens read from prompt cache.
usage.input_tokensnumberTotal input tokens consumed across all turns.
usage.list_costnull | objectA monetary amount in a specific currency.
usage.output_tokensnumberTotal output tokens generated across all turns.
usage.server_tool_usenull | objectCumulative count of server-executed tool invocations, broken down by tool.

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

GET /anthropic/v1/sessions/{session_id}/threads/{thread_id}/events◐ 部分支持

Claude 官方文档 ↗

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

  • thread_idstring必填

    path: 路径参数:线程 ID。

  • session_idstring必填

    query: 会话 ID(路径或查询参数)。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

200

读取所选线程自己的事件记录:主线程读主会话,子线程读对应子会话。沿用会话事件接口的查询参数、公开事件类型和 data + next_page 信封。使用网页工具时,两个接口均返回 search_result 块;回答 citations 为 /agent/v1 扩展,/anthropic 将引用显示为正文 [n]。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringUnique identifier for this event.
data[].contentarray<object>Array of content blocks comprising the user message. / The result content returned by the tool. / Array of text blocks comprising the agent response. / The result content returned by the tool. / The result content returned by the tool. / Message content blocks. / Message content blocks. / The result content returned by the tool. / System content blocks. Text-only.
data[].typestring
data[].processed_atnull | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | string | null | string | string | string | null | string | stringA timestamp in RFC 3339 format
data[].session_thread_idnull | string | string | string | string | string | null | string | stringIf absent, interrupts every non-archived thread in a multiagent session (or the primary alone in a single-agent session). If present, interrupts only the named thread. / Set by the server to the subagent thread this confirmation was routed to. Omitted when it was routed to the primary thread. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / When set, this event was cross-posted from a subagent's thread to surface its custom tool use on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.custom_tool_result` by `custom_tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` by `tool_use_id`, so clients do not send it back. / When set, this event was cross-posted from a subagent's thread to surface its permission request on the primary thread's stream. Empty on the thread's own events. Informational only: the server routes the matching `user.tool_confirmation` or `user.tool_result` by `tool_use_id`, so clients do not send it back. / Public `sthr_` ID of the newly created thread. / Public sthr_ ID of the thread that started running. / Public sthr_ ID of the thread that went idle. / Public sthr_ ID of the thread that terminated. / Set by the server to the subagent thread this result was routed to. Omitted when it was routed to the primary thread. / Public sthr_ ID of the thread that is retrying.
data[].resultstringUserToolConfirmationResult enum / Evaluation verdict. 'satisfied': criteria met, session goes idle. 'needs_revision': criteria not met, another revision cycle follows. 'max_iterations_reached': evaluation budget exhausted with criteria still unmet — one final acknowledgment turn follows before the session goes idle, but no further evaluation runs. 'failed': grader determined the rubric does not apply to the deliverables. 'interrupted': user sent an interrupt while evaluation was in progress.
data[].tool_use_idstringThe id of the `agent.tool_use` or `agent.mcp_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field. / The id of the `agent.tool_use` event this result corresponds to. / The id of the `agent.tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field.
data[].deny_messagenull | stringOptional message providing context for a 'deny' decision. Only allowed when result is 'deny'.
data[].custom_tool_use_idstringThe id of the `agent.custom_tool_use` event this result corresponds to, which can be found in the last `session.status_idle` event's `stop_reason.event_ids` field.
data[].is_errornull | booleanWhether the tool execution resulted in an error. / Whether the model request resulted in an error. / Whether the tool execution resulted in an error.
data[].inputobjectInput parameters for the tool call.
data[].namestringName of the custom tool being called. / Name of the MCP tool being used. / Name of the agent tool being used.
data[].mcp_server_namestringName of the MCP server providing the tool.
data[].evaluated_permissionstringAgentEvaluatedPermission enum
data[].evaluationobjectNames the resolved permission_policy that produced evaluated_permission, and under auto carries the judgement. Open union: clients must tolerate unknown variants.
data[].mcp_tool_use_idstringThe id of the `agent.mcp_tool_use` event this result corresponds to.
data[].from_session_thread_idstringPublic `sthr_` ID of the thread that sent the message.
data[].from_agent_namenull | stringName of the callable agent this message came from. Absent when received from the primary agent.
data[].to_session_thread_idstringPublic `sthr_` ID of the thread the message was sent to.
data[].to_agent_namenull | stringName of the callable agent this message was sent to. Absent when sent to the primary agent.
data[].errorobject
data[].stop_reasonobject
data[].agent_namestringName of the callable agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs. / Name of the agent the thread runs.
data[].iterationnumber0-indexed revision cycle. 0 is the first evaluation; 1 is the re-evaluation after the first revision; etc. / 0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`. / 0-indexed revision cycle, matching the corresponding `span.outcome_evaluation_start`.
data[].outcome_idstringThe `outc_` ID of the outcome being evaluated. / Server-generated `outc_` ID for this outcome. Referenced by `span.outcome_evaluation_*` events and the session's `outcome_evaluations` list.
data[].explanationstringHuman-readable explanation of the verdict. For `needs_revision`, describes which criteria failed and why.
data[].outcome_evaluation_start_idstringThe id of the corresponding `span.outcome_evaluation_start` event.
data[].usageobjectToken usage for a single model request. / Point-in-time snapshot of a session's cumulative usage.
data[].model_request_start_idstringThe id of the corresponding `span.model_request_start` event.
data[].model_usageobjectToken usage for a single model request.
data[].descriptionstringWhat the agent should produce. Copied from the input event.
data[].max_iterationsnull | numberEvaluate-then-revise cycles before giving up. Default 3, max 20.
data[].rubricobjectRubric for grading the quality of an outcome.
data[].agentnull | objectResolved `agent` definition for a `session`. Snapshot of the `agent` at `session` creation time.
data[].budgetnull | objectA hard spend ceiling. The session stops issuing new model requests once the tracked list cost reaches `max_list_cost`.
data[].metadataobjectThe session's full metadata bag after the update. Present when the update set non-empty metadata; absent when metadata was unchanged or cleared to empty.
data[].titlenull | stringThe session's new title. Present only when the update changed it.
next_pagestring | null

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

GET /anthropic/v1/sessions/{session_id}/threads/{thread_id}/stream◐ 部分支持

Claude 官方文档 ↗

请求参数

  • session_idstring必填

    path: 会话 ID(路径或查询参数)。

  • thread_idstring必填

    path: 路径参数:线程 ID。

  • session_idstring必填

    query: 会话 ID(路径或查询参数)。

  • event_deltasarray可选

    query: 设置后连接同时接收流式增量事件。

返回

200

订阅所选线程自己的实时事件流。复用会话 SSE 实现;/agent 接口支持同址只读 WebSocket。主会话流同时包含子线程创建、状态和消息事件,子线程审批带 session_thread_id 上浮;确认或中断携带该字段时路由到所属子线程。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Server-sent events

text/event-stream — chunk / 事件对象

未声明字段结构。

GET /anthropic/v1/skills○ 未支持

请求参数

  • sourcestring可选

    query: 按来源过滤 Skill:custom 或官方来源。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringUnique identifier for the skill. The format and length of IDs may change over time.
data[].created_atstringISO 8601 timestamp of when the skill was created.
data[].display_namestringHuman-readable, single-line label for the Skill. Maximum 255 characters. Always set: derived from the SKILL.md frontmatter `name` when omitted at creation. Not unique.
data[].latest_version_idstringID of the newest Skill Version — what `latest` references resolve to. Always set: a Skill holds at least one version.
data[].sourceobjectWhere the Skill comes from. Possible values: - `"custom"`: authored by the platform user; private to their workspace - `"anthropic"`: published by Anthropic; shared and read-only - `"anthropic_example"`: Anthropic-published sample Skill - `"plugin"`: resolved from an installed plugin
data[].typestringObject type. For Skills, this is always `"skill"`.
data[].updated_atstringISO 8601 timestamp of when the skill was last updated.
next_pagestring | null

POST /anthropic/v1/skills○ 未支持

请求体

  • filesarray必填

    Files to upload for the skill. All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory.

  • display_namestring可选

    Human-readable, single-line label for the Skill. Maximum 255 characters. Always set: derived from the SKILL.md frontmatter `name` when omitted at creation. Not unique.

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

multipart/form-data

名称类型说明
idstringUnique identifier for the skill. The format and length of IDs may change over time.
created_atstringISO 8601 timestamp of when the skill was created.
display_namestringHuman-readable, single-line label for the Skill. Maximum 255 characters. Always set: derived from the SKILL.md frontmatter `name` when omitted at creation. Not unique.
latest_version_idstringID of the newest Skill Version — what `latest` references resolve to. Always set: a Skill holds at least one version.
sourceobjectWhere the Skill comes from. Possible values: - `"custom"`: authored by the platform user; private to their workspace - `"anthropic"`: published by Anthropic; shared and read-only - `"anthropic_example"`: Anthropic-published sample Skill - `"plugin"`: resolved from an installed plugin
source.typestringWhere the Skill comes from. Possible values: - `"custom"`: authored by the platform user; private to their workspace - `"anthropic"`: published by Anthropic; shared and read-only - `"anthropic_example"`: Anthropic-published sample Skill - `"plugin"`: resolved from an installed plugin
typestringObject type. For Skills, this is always `"skill"`.
updated_atstringISO 8601 timestamp of when the skill was last updated.

DELETE /anthropic/v1/skills/{skill_id}○ 未支持

请求参数

  • skill_idstring必填

    path: Skill ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the skill. The format and length of IDs may change over time.
typestringDeleted object type. For Skills, this is always `"skill_deleted"`.

GET /anthropic/v1/skills/{skill_id}○ 未支持

请求参数

  • skill_idstring必填

    path: Skill ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the skill. The format and length of IDs may change over time.
created_atstringISO 8601 timestamp of when the skill was created.
display_namestringHuman-readable, single-line label for the Skill. Maximum 255 characters. Always set: derived from the SKILL.md frontmatter `name` when omitted at creation. Not unique.
latest_version_idstringID of the newest Skill Version — what `latest` references resolve to. Always set: a Skill holds at least one version.
sourceobjectWhere the Skill comes from. Possible values: - `"custom"`: authored by the platform user; private to their workspace - `"anthropic"`: published by Anthropic; shared and read-only - `"anthropic_example"`: Anthropic-published sample Skill - `"plugin"`: resolved from an installed plugin
source.typestringWhere the Skill comes from. Possible values: - `"custom"`: authored by the platform user; private to their workspace - `"anthropic"`: published by Anthropic; shared and read-only - `"anthropic_example"`: Anthropic-published sample Skill - `"plugin"`: resolved from an installed plugin
typestringObject type. For Skills, this is always `"skill"`.
updated_atstringISO 8601 timestamp of when the skill was last updated.

GET /anthropic/v1/skills/{skill_id}/versions○ 未支持

请求参数

  • skill_idstring必填

    path: Skill ID(路径或查询参数)。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringUnique identifier for this Skill Version. The id addresses the version in paths and pins it in references.
data[].created_atstringISO 8601 timestamp of when the skill was created.
data[].descriptionstringDescription of the skill version. This is extracted from the SKILL.md file in the skill upload.
data[].namestringThe Skill's immutable kebab-case slug, set at creation from the first upload's SKILL.md frontmatter `name` (or its enclosing directory). Every later upload must resolve to the same value. Also the top-level directory of the Skill's mounted files and the base name of a downloaded archive.
data[].skill_idstringUnique identifier for the skill. The format and length of IDs may change over time.
data[].typestringObject type. For Skill Versions, this is always `"skill_version"`.
next_pagestring | null

POST /anthropic/v1/skills/{skill_id}/versions○ 未支持

请求参数

  • skill_idstring必填

    path: Skill ID(路径或查询参数)。

  • filesarray必填

    Files to upload for the skill. All files must be in the same top-level directory and must include a SKILL.md file at the root of that directory.

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

multipart/form-data

名称类型说明
idstringUnique identifier for this Skill Version. The id addresses the version in paths and pins it in references.
created_atstringISO 8601 timestamp of when the skill was created.
descriptionstringDescription of the skill version. This is extracted from the SKILL.md file in the skill upload.
namestringThe Skill's immutable kebab-case slug, set at creation from the first upload's SKILL.md frontmatter `name` (or its enclosing directory). Every later upload must resolve to the same value. Also the top-level directory of the Skill's mounted files and the base name of a downloaded archive.
skill_idstringUnique identifier for the skill. The format and length of IDs may change over time.
typestringObject type. For Skill Versions, this is always `"skill_version"`.

DELETE /anthropic/v1/skills/{skill_id}/versions/{version}○ 未支持

请求参数

  • skill_idstring必填

    path: Skill ID(路径或查询参数)。

  • versionstring必填

    path: 路径参数:版本号。

  • skill_idstring必填

    query: Skill ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this Skill Version. The id addresses the version in paths and pins it in references.
typestringDeleted object type. For Skill Versions, this is always `"skill_version_deleted"`.

GET /anthropic/v1/skills/{skill_id}/versions/{version}○ 未支持

请求参数

  • skill_idstring必填

    path: Skill ID(路径或查询参数)。

  • versionstring必填

    path: 路径参数:版本号。

  • skill_idstring必填

    query: Skill ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for this Skill Version. The id addresses the version in paths and pins it in references.
created_atstringISO 8601 timestamp of when the skill was created.
descriptionstringDescription of the skill version. This is extracted from the SKILL.md file in the skill upload.
namestringThe Skill's immutable kebab-case slug, set at creation from the first upload's SKILL.md frontmatter `name` (or its enclosing directory). Every later upload must resolve to the same value. Also the top-level directory of the Skill's mounted files and the base name of a downloaded archive.
skill_idstringUnique identifier for the skill. The format and length of IDs may change over time.
typestringObject type. For Skill Versions, this is always `"skill_version"`.

GET /anthropic/v1/skills/{skill_id}/versions/{version}/content○ 未支持

请求参数

  • skill_idstring必填

    path: Skill ID(路径或查询参数)。

  • versionstring必填

    path: 路径参数:版本号。

  • skill_idstring必填

    query: Skill ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还不支持上传和管理 Skills;创建智能体时传入 skills 会返回 400。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Binary response body

application/octet-stream

名称类型说明
$string (binary)

GET /anthropic/v1/tunnels○ 未支持

请求参数

  • include_archivedboolean可选

    query: 是否包含已归档的记录。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringUnique identifier for the tunnel, prefixed with `tnl_`.
data[].archived_atnull | stringA timestamp in RFC 3339 format
data[].created_atstringA timestamp in RFC 3339 format
data[].display_namenull | stringHuman-readable name for the tunnel (1-255 characters). Null if unset.
data[].domainstringAnthropic-assigned hostname for the tunnel. MCP server URLs whose host is a subdomain of this value are routed through the tunnel. Globally unique and never reused, even after the tunnel is archived.
data[].typestring
next_pagestring | null

POST /anthropic/v1/tunnels○ 未支持

请求体

  • display_namestring可选

    Optional human-readable name for the tunnel (1-255 characters).

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the tunnel, prefixed with `tnl_`.
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
display_namenull | stringHuman-readable name for the tunnel (1-255 characters). Null if unset.
domainstringAnthropic-assigned hostname for the tunnel. MCP server URLs whose host is a subdomain of this value are routed through the tunnel. Globally unique and never reused, even after the tunnel is archived.
typestring

GET /anthropic/v1/tunnels/{tunnel_id}○ 未支持

请求参数

  • tunnel_idstring必填

    path: 隧道 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the tunnel, prefixed with `tnl_`.
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
display_namenull | stringHuman-readable name for the tunnel (1-255 characters). Null if unset.
domainstringAnthropic-assigned hostname for the tunnel. MCP server URLs whose host is a subdomain of this value are routed through the tunnel. Globally unique and never reused, even after the tunnel is archived.
typestring

POST /anthropic/v1/tunnels/{tunnel_id}/archive○ 未支持

请求参数

  • tunnel_idstring必填

    path: 隧道 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the tunnel, prefixed with `tnl_`.
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
display_namenull | stringHuman-readable name for the tunnel (1-255 characters). Null if unset.
domainstringAnthropic-assigned hostname for the tunnel. MCP server URLs whose host is a subdomain of this value are routed through the tunnel. Globally unique and never reused, even after the tunnel is archived.
typestring

GET /anthropic/v1/tunnels/{tunnel_id}/certificates○ 未支持

请求参数

  • tunnel_idstring必填

    path: 隧道 ID(路径或查询参数)。

  • include_archivedboolean可选

    query: 是否包含已归档的记录。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringUnique identifier for the certificate, prefixed with `tcrt_`.
data[].archived_atnull | stringA timestamp in RFC 3339 format
data[].created_atstringA timestamp in RFC 3339 format
data[].expires_atnull | stringA timestamp in RFC 3339 format
data[].fingerprintstringLowercase hex SHA-256 fingerprint of the certificate's DER encoding.
data[].tunnel_idstringID of the tunnel the certificate is registered against.
data[].typestring
next_pagestring | null

POST /anthropic/v1/tunnels/{tunnel_id}/certificates○ 未支持

请求参数

  • tunnel_idstring必填

    path: 隧道 ID(路径或查询参数)。

  • ca_certificate_pemstring必填

    PEM-encoded X.509 CA certificate. Must contain exactly one certificate and no private-key material. Maximum 8KB.

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the certificate, prefixed with `tcrt_`.
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
expires_atnull | stringA timestamp in RFC 3339 format
fingerprintstringLowercase hex SHA-256 fingerprint of the certificate's DER encoding.
tunnel_idstringID of the tunnel the certificate is registered against.
typestring

GET /anthropic/v1/tunnels/{tunnel_id}/certificates/{certificate_id}○ 未支持

请求参数

  • tunnel_idstring必填

    path: 隧道 ID(路径或查询参数)。

  • certificate_idstring必填

    path: 路径参数:客户端证书 ID。

  • tunnel_idstring必填

    query: 隧道 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the certificate, prefixed with `tcrt_`.
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
expires_atnull | stringA timestamp in RFC 3339 format
fingerprintstringLowercase hex SHA-256 fingerprint of the certificate's DER encoding.
tunnel_idstringID of the tunnel the certificate is registered against.
typestring

POST /anthropic/v1/tunnels/{tunnel_id}/certificates/{certificate_id}/archive○ 未支持

请求参数

  • tunnel_idstring必填

    path: 隧道 ID(路径或查询参数)。

  • certificate_idstring必填

    path: 路径参数:客户端证书 ID。

  • tunnel_idstring必填

    query: 隧道 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the certificate, prefixed with `tcrt_`.
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
expires_atnull | stringA timestamp in RFC 3339 format
fingerprintstringLowercase hex SHA-256 fingerprint of the certificate's DER encoding.
tunnel_idstringID of the tunnel the certificate is registered against.
typestring

POST /anthropic/v1/tunnels/{tunnel_id}/reveal_token○ 未支持

请求参数

  • tunnel_idstring必填

    path: 隧道 ID(路径或查询参数)。

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringStable identifier for the current token value. Changes when the token is rotated.
tunnel_tokenstringThe connector token used to run the tunnel. Treat as a credential.
typestring

POST /anthropic/v1/tunnels/{tunnel_id}/rotate_token○ 未支持

请求参数

  • tunnel_idstring必填

    path: 隧道 ID(路径或查询参数)。

  • reasonstring可选

    Optional free-text reason for the rotation, recorded for audit.

返回

501 平台还没有实现这个端点;调用会得到下面这个响应:

平台还没有提供把智能体接入你自有网络的隧道。调用会返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringStable identifier for the current token value. Changes when the token is rotated.
tunnel_tokenstringThe connector token used to run the tunnel. Treat as a credential.
typestring

列出凭据库

GET /anthropic/v1/vaults● 支持

请求参数

  • include_archivedboolean可选

    query: 是否包含已归档的记录。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

200

支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringUnique identifier for the vault.
data[].archived_atnull | stringA timestamp in RFC 3339 format
data[].created_atstringA timestamp in RFC 3339 format
data[].display_namestringHuman-readable name for the vault.
data[].metadataobjectArbitrary key-value metadata attached to the vault.
data[].typestring
data[].updated_atstringA timestamp in RFC 3339 format
next_pagestring | null

创建凭据库

POST /anthropic/v1/vaults● 支持

请求体

  • display_namestring必填

    Human-readable name for the vault. 1-255 characters.

  • metadataobject可选

    Arbitrary key-value metadata to attach to the vault. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.

返回

200

支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the vault.
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
display_namestringHuman-readable name for the vault.
metadataobjectArbitrary key-value metadata attached to the vault.
typestring
updated_atstringA timestamp in RFC 3339 format

删除凭据库

DELETE /anthropic/v1/vaults/{vault_id}● 支持

请求参数

  • vault_idstring必填

    path: 保险库 ID(路径或查询参数)。

返回

200

支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier of the deleted vault.
typestring

读取凭据库

GET /anthropic/v1/vaults/{vault_id}● 支持

请求参数

  • vault_idstring必填

    path: 保险库 ID(路径或查询参数)。

返回

200

支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the vault.
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
display_namestringHuman-readable name for the vault.
metadataobjectArbitrary key-value metadata attached to the vault.
typestring
updated_atstringA timestamp in RFC 3339 format

更新凭据库

POST /anthropic/v1/vaults/{vault_id}● 支持

请求参数

  • vault_idstring必填

    path: 保险库 ID(路径或查询参数)。

  • display_namestring可选

    Updated human-readable name for the vault. 1-255 characters.

  • metadataobject可选

    Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved.

返回

200

支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the vault.
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
display_namestringHuman-readable name for the vault.
metadataobjectArbitrary key-value metadata attached to the vault.
typestring
updated_atstringA timestamp in RFC 3339 format

归档凭据库

POST /anthropic/v1/vaults/{vault_id}/archive● 支持

请求参数

  • vault_idstring必填

    path: 保险库 ID(路径或查询参数)。

返回

200

支持创建、列出、读取、更新、归档与删除。列表支持 limit、page 和 include_archived。归档会同时归档库内全部凭据并清除凭据的值;删除会一并删除全部凭据,不可恢复。以 anthropic. 开头的 metadata 键由平台保留,不能写入。同一个库也可以通过原生接口 /vault/v1 管理。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the vault.
archived_atnull | stringA timestamp in RFC 3339 format
created_atstringA timestamp in RFC 3339 format
display_namestringHuman-readable name for the vault.
metadataobjectArbitrary key-value metadata attached to the vault.
typestring
updated_atstringA timestamp in RFC 3339 format

GET /anthropic/v1/vaults/{vault_id}/credentials◐ 部分支持

请求参数

  • vault_idstring必填

    path: 保险库 ID(路径或查询参数)。

  • include_archivedboolean可选

    query: 是否包含已归档的记录。

  • limitnumber可选

    query: 每页返回的条数上限。

  • pagestring可选

    query: 分页游标,取自上一页响应的 next_page。

返回

200

支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
dataarray<object>
data[].idstringUnique identifier for the credential.
data[].archived_atnull | stringA timestamp in RFC 3339 format
data[].authobjectAuthentication details for a credential.
data[].created_atstringA timestamp in RFC 3339 format
data[].metadataobjectArbitrary key-value metadata attached to the credential.
data[].typestring
data[].updated_atstringA timestamp in RFC 3339 format
data[].vault_idstringIdentifier of the vault this credential belongs to.
data[].display_namenull | stringHuman-readable name for the credential.
next_pagestring | null

POST /anthropic/v1/vaults/{vault_id}/credentials◐ 部分支持

请求参数

  • vault_idstring必填

    path: 保险库 ID(路径或查询参数)。

  • authobject必填

    Authentication details for creating a credential.

    ▸ 展开子字段(10)
    • access_tokenstring必填

      OAuth access token.

    • mcp_server_urlstring必填

      URL of the MCP server this credential authenticates against.

    • typestring必填
      取值 environment_variable
    • expires_atstring可选

      A timestamp in RFC 3339 format

    • refreshobject可选

      OAuth refresh token parameters for creating a credential with refresh support.

    • tokenstring必填

      Static bearer token value.

    • networkingobject必填

      Outbound hosts the secret value is substituted on.

    • secret_namestring必填

      Name of the environment variable. Immutable after create.

    • secret_valuestring必填

      Secret value. Write-only; never returned in responses.

    • injection_locationobject可选

      Where in the outbound request the secret value may be substituted.

  • display_namestring可选

    Human-readable name for the credential. Up to 255 characters.

  • metadataobject可选

    Arbitrary key-value metadata to attach to the credential. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.

返回

200

支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the credential.
archived_atnull | stringA timestamp in RFC 3339 format
authobjectAuthentication details for a credential.
auth.mcp_server_urlstringURL of the MCP server this credential authenticates against.
auth.typestring
auth.expires_atnull | stringA timestamp in RFC 3339 format
auth.refreshnull | objectOAuth refresh token configuration returned in credential responses.
auth.injection_locationobjectWhere in the outbound request the secret value is substituted.
auth.networkingobjectOutbound hosts the secret value is substituted on.
auth.secret_namestringName of the environment variable.
created_atstringA timestamp in RFC 3339 format
metadataobjectArbitrary key-value metadata attached to the credential.
typestring
updated_atstringA timestamp in RFC 3339 format
vault_idstringIdentifier of the vault this credential belongs to.
display_namenull | stringHuman-readable name for the credential.

MCP OAuth 创建限制

上面的示例创建 environment_variable 凭据。创建 mcp_oauth 仍返回 501,不会创建凭据;更新已有 mcp_oauth 凭据也不支持。以下为创建请求的实测错误响应。

{
  "type": "error",
  "error": {
    "type": "not_implemented_error",
    "message": "Not implemented: creating mcp_oauth credentials is not available on this platform yet; use static_bearer or environment_variable."
  },
  "request_id": "4c1dcdba-97bb-46ce-aad0-0a7d8753357c"
}

DELETE /anthropic/v1/vaults/{vault_id}/credentials/{credential_id}◐ 部分支持

请求参数

  • vault_idstring必填

    path: 保险库 ID(路径或查询参数)。

  • credential_idstring必填

    path: 路径参数:凭据 ID。

  • vault_idstring必填

    query: 保险库 ID(路径或查询参数)。

返回

200

支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier of the deleted credential.
typestring

GET /anthropic/v1/vaults/{vault_id}/credentials/{credential_id}◐ 部分支持

请求参数

  • vault_idstring必填

    path: 保险库 ID(路径或查询参数)。

  • credential_idstring必填

    path: 路径参数:凭据 ID。

  • vault_idstring必填

    query: 保险库 ID(路径或查询参数)。

返回

200

支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the credential.
archived_atnull | stringA timestamp in RFC 3339 format
authobjectAuthentication details for a credential.
auth.mcp_server_urlstringURL of the MCP server this credential authenticates against.
auth.typestring
auth.expires_atnull | stringA timestamp in RFC 3339 format
auth.refreshnull | objectOAuth refresh token configuration returned in credential responses.
auth.injection_locationobjectWhere in the outbound request the secret value is substituted.
auth.networkingobjectOutbound hosts the secret value is substituted on.
auth.secret_namestringName of the environment variable.
created_atstringA timestamp in RFC 3339 format
metadataobjectArbitrary key-value metadata attached to the credential.
typestring
updated_atstringA timestamp in RFC 3339 format
vault_idstringIdentifier of the vault this credential belongs to.
display_namenull | stringHuman-readable name for the credential.

POST /anthropic/v1/vaults/{vault_id}/credentials/{credential_id}◐ 部分支持

请求参数

  • vault_idstring必填

    path: 保险库 ID(路径或查询参数)。

  • credential_idstring必填

    path: 路径参数:凭据 ID。

  • vault_idstring必填

    query: 保险库 ID(路径或查询参数)。

  • authobject可选

    Updated authentication details for a credential.

    ▸ 展开子字段(8)
    • typestring必填
      取值 environment_variable
    • access_tokenstring可选

      Updated OAuth access token.

    • expires_atstring可选

      A timestamp in RFC 3339 format

    • refreshobject可选

      Parameters for updating OAuth refresh token configuration.

    • tokenstring可选

      Updated static bearer token value.

    • injection_locationobject可选

      Updated injection location.

    • networkingobject可选

      Updated networking scope. Full replacement.

    • secret_valuestring可选

      Updated secret value.

  • display_namestring可选

    Updated human-readable name for the credential. 1-255 characters.

  • metadataobject可选

    Metadata patch. Set a key to a string to upsert it, or to null to delete it. Omitted keys are preserved.

返回

200

支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the credential.
archived_atnull | stringA timestamp in RFC 3339 format
authobjectAuthentication details for a credential.
auth.mcp_server_urlstringURL of the MCP server this credential authenticates against.
auth.typestring
auth.expires_atnull | stringA timestamp in RFC 3339 format
auth.refreshnull | objectOAuth refresh token configuration returned in credential responses.
auth.injection_locationobjectWhere in the outbound request the secret value is substituted.
auth.networkingobjectOutbound hosts the secret value is substituted on.
auth.secret_namestringName of the environment variable.
created_atstringA timestamp in RFC 3339 format
metadataobjectArbitrary key-value metadata attached to the credential.
typestring
updated_atstringA timestamp in RFC 3339 format
vault_idstringIdentifier of the vault this credential belongs to.
display_namenull | stringHuman-readable name for the credential.

POST /anthropic/v1/vaults/{vault_id}/credentials/{credential_id}/archive◐ 部分支持

请求参数

  • vault_idstring必填

    path: 保险库 ID(路径或查询参数)。

  • credential_idstring必填

    path: 路径参数:凭据 ID。

  • vault_idstring必填

    query: 保险库 ID(路径或查询参数)。

返回

200

支持 environment_variable 与 static_bearer。environment_variable 的 networking 只支持 limited,传 unrestricted 返回 400;secret_name 只能使用大写字母、数字和下划线,且不能以数字开头;injection_location 的默认值与官方一致。static_bearer 的令牌只在 mcp_server_url 所在主机上可用。创建或更新 mcp_oauth 返回 501(not_implemented_error),不产生副作用,官方 SDK 不会重试;需要 OAuth 令牌时请使用 /vault/v1/authorizations 一键授权。每个库最多 20 个有效凭据。以 anthropic. 开头的 metadata 键由平台保留,不能写入。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
idstringUnique identifier for the credential.
archived_atnull | stringA timestamp in RFC 3339 format
authobjectAuthentication details for a credential.
auth.mcp_server_urlstringURL of the MCP server this credential authenticates against.
auth.typestring
auth.expires_atnull | stringA timestamp in RFC 3339 format
auth.refreshnull | objectOAuth refresh token configuration returned in credential responses.
auth.injection_locationobjectWhere in the outbound request the secret value is substituted.
auth.networkingobjectOutbound hosts the secret value is substituted on.
auth.secret_namestringName of the environment variable.
created_atstringA timestamp in RFC 3339 format
metadataobjectArbitrary key-value metadata attached to the credential.
typestring
updated_atstringA timestamp in RFC 3339 format
vault_idstringIdentifier of the vault this credential belongs to.
display_namenull | stringHuman-readable name for the credential.

POST /anthropic/v1/vaults/{vault_id}/credentials/{credential_id}/mcp_oauth_validate◐ 部分支持

请求参数

  • vault_idstring必填

    path: 保险库 ID(路径或查询参数)。

  • credential_idstring必填

    path: 路径参数:凭据 ID。

  • vault_idstring必填

    query: 保险库 ID(路径或查询参数)。

返回

400

只适用于 OAuth 凭据,对其他类型返回 400。结果总是 HTTP 200,status 为 valid、invalid 或 unknown;mcp_probe 只在未通过时给出失败的一步,refresh 只在尝试了续期时给出。

错误按 Claude Managed Agents 格式返回,参见 错误码

响应

HTTP 200

Successful response

application/json

名称类型说明
credential_idstringUnique identifier of the credential that was validated.
has_refresh_tokenbooleanWhether the credential has a refresh token configured.
mcp_probenull | objectThe failing step of an MCP validation probe.
mcp_probe.http_responsenull | objectAn HTTP response captured during a credential validation probe.
mcp_probe.methodstringThe MCP method that failed (for example `initialize` or `tools/list`).
refreshnull | objectOutcome of a refresh-token exchange attempted during credential validation.
refresh.http_responsenull | objectAn HTTP response captured during a credential validation probe.
refresh.statusstringOutcome of a refresh-token exchange attempted during credential validation. - `succeeded` - The token endpoint returned a new access token. - `failed` - The token endpoint returned an error response. See `http_response` for detail. - `connect_error` - The token endpoint could not be reached (DNS, TLS, or connection error). - `no_refresh_token` - No refresh token is stored for the credential, so no exchange was attempted.
statusstringOverall verdict of a credential validation probe.
typestring
validated_atstringA timestamp in RFC 3339 format
vault_idstringIdentifier of the vault containing the credential.

示例前提

此示例针对前面创建的 static 凭据,因此实测返回 400 invalid_request_error。要获得校验结果,请先通过一键授权完成用户授权,再将 credential_id 换成产生的 OAuth Secret ID。校验 OAuth 凭据返回 HTTP 200,状态为 valid、invalid 或 unknown。