English ← MyDocs

创建 memory store

post /v1/memory_stores

创建 memory store

Header Parameters

  • "anthropic-beta": optional array of AnthropicBeta

    可选的头部参数,用于指定您想使用的 beta 版本。

    • string

    • "message-batches-2024-09-24" or "prompt-caching-2024-07-31" or "computer-use-2024-10-22" or 22 more

      • "message-batches-2024-09-24"

      • "prompt-caching-2024-07-31"

      • "computer-use-2024-10-22"

      • "computer-use-2025-01-24"

      • "pdfs-2024-09-25"

      • "token-counting-2024-11-01"

      • "token-efficient-tools-2025-02-19"

      • "output-128k-2025-02-19"

      • "files-api-2025-04-14"

      • "mcp-client-2025-04-04"

      • "mcp-client-2025-11-20"

      • "dev-full-thinking-2025-05-14"

      • "interleaved-thinking-2025-05-14"

      • "code-execution-2025-05-22"

      • "extended-cache-ttl-2025-04-11"

      • "context-1m-2025-08-07"

      • "context-management-2025-06-27"

      • "model-context-window-exceeded-2025-08-26"

      • "skills-2025-10-02"

      • "fast-mode-2026-02-01"

      • "output-300k-2026-03-24"

      • "user-profiles-2026-03-24"

      • "advisor-tool-2026-03-01"

      • "managed-agents-2026-04-01"

      • "cache-diagnosis-2026-04-07"

Body Parameters

  • name: string

    store 的人类可读名称。必填;1-255 个字符;不允许控制字符。挂载路径 /mnt/memory/ 下的 slug 派生自此名称(转为小写,非字母数字的连续字符替换为连字符)。名称在工作区内无需唯一。

  • description: optional string

    store 内容的自由文本描述,最多 1024 个字符。当 store 被挂载时会包含在代理的系统提示词中,因此请确保描述对代理有用。

  • metadata: optional map[string]

    用于您自身记账的任意键值标签(例如 store 所属的终端用户)。最多 16 对;键名 1-64 个字符;值最多 512 个字符。对代理不可见。

Returns

  • BetaManagedAgentsMemoryStore object { id, created_at, name, 5 more }

    一个 memory_store:代理记忆的命名容器,作用域为工作区。通过 resources[] 将 store 挂载到会话,即可将其作为代理可读写的目录。

    • id: string

      memory store 的唯一标识符(memstore_... 标签 ID)。在将 store 挂载到会话或在后续调用的 {memory_store_id} 路径参数中使用此 ID。

    • created_at: string

      RFC 3339 格式的时间戳

    • name: string

      store 的人类可读名称。1-255 个字符。store 在 /mnt/memory/ 下的挂载路径 slug 派生自此名称。

    • type: "memory_store"

      • "memory_store"
    • updated_at: string

      RFC 3339 格式的时间戳

    • archived_at: optional string

      RFC 3339 格式的时间戳

    • description: optional string

      store 内容的自由文本描述,最多 1024 个字符。当 store 被挂载时会包含在代理的系统提示词中,因此请确保描述对代理有用。未设置时为空字符串。

    • metadata: optional map[string]

      用于您自身记账的任意键值标签(例如 store 所属的终端用户)。最多 16 对;键名 1-64 个字符;值最多 512 个字符。在 retrieve/list 时返回但不可过滤。

Example

curl https://api.anthropic.com/v1/memory_stores \
    -H 'Content-Type: application/json' \
    -H 'anthropic-version: 2023-06-01' \
    -H 'anthropic-beta: managed-agents-2026-04-01' \
    -H "X-Api-Key: $ANTHROPIC_API_KEY" \
    -d '{
          "name": "x"
        }'

Response

{
  "id": "id",
  "created_at": "2019-12-27T18:11:19.117Z",
  "name": "name",
  "type": "memory_store",
  "updated_at": "2019-12-27T18:11:19.117Z",
  "archived_at": "2019-12-27T18:11:19.117Z",
  "description": "description",
  "metadata": {
    "foo": "string"
  }
}