AnthropicClaude 托管智能体
创建记忆
向记忆库写入一条记忆,供智能体后续会话读取。
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
| 名称 | 类型 | 说明 |
|---|---|---|
| id | string | Unique identifier for this memory (a `mem_...` value). Stable across renames; use this ID, not the path, to read, update, or delete the memory. |
| content_sha256 | string | Lowercase 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_bytes | number | Size of `content` in bytes (the UTF-8 plaintext length). Always populated, regardless of `view`. |
| created_at | string | A timestamp in RFC 3339 format |
| memory_store_id | string | ID of the memory store this memory belongs to (a `memstore_...` value). |
| memory_version_id | string | ID 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. |
| path | string | Hierarchical 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. |
| type | string | |
| updated_at | string | A timestamp in RFC 3339 format |
| content | null | string | The memory's UTF-8 text content. Populated when `view=full`; `null` when `view=basic`. Maximum 100 kB (102,400 bytes). |