Claude Platform Docs

メモリ

メモリを作成
client.Beta.MemoryStores.Memories.New(ctx, memoryStoreID, params) (*BetaManagedAgentsMemory, error)
POST/v1/memory_stores/{memory_store_id}/memories
Requires anthropic-beta: agent-memory-2026-07-22 or anthropic-beta: managed-agents-2026-04-01. Learn how to send beta headers.
メモリの一覧を取得
client.Beta.MemoryStores.Memories.List(ctx, memoryStoreID, params) (*PageCursor[BetaManagedAgentsMemoryListItemUnion], error)
GET/v1/memory_stores/{memory_store_id}/memories
Requires anthropic-beta: agent-memory-2026-07-22 or anthropic-beta: managed-agents-2026-04-01. Learn how to send beta headers.
メモリを取得
client.Beta.MemoryStores.Memories.Get(ctx, memoryID, params) (*BetaManagedAgentsMemory, error)
GET/v1/memory_stores/{memory_store_id}/memories/{memory_id}
Requires anthropic-beta: agent-memory-2026-07-22 or anthropic-beta: managed-agents-2026-04-01. Learn how to send beta headers.
メモリを更新
client.Beta.MemoryStores.Memories.Update(ctx, memoryID, params) (*BetaManagedAgentsMemory, error)
POST/v1/memory_stores/{memory_store_id}/memories/{memory_id}
Requires anthropic-beta: agent-memory-2026-07-22 or anthropic-beta: managed-agents-2026-04-01. Learn how to send beta headers.
メモリを削除
client.Beta.MemoryStores.Memories.Delete(ctx, memoryID, params) (*BetaManagedAgentsDeletedMemory, error)
DELETE/v1/memory_stores/{memory_store_id}/memories/{memory_id}
Requires anthropic-beta: agent-memory-2026-07-22 or anthropic-beta: managed-agents-2026-04-01. Learn how to send beta headers.
Models
type BetaManagedAgentsConflictErrorObject struct { Type: "conflict_error"; Message }
Type ConflictError
Message string Optional
type BetaManagedAgentsContentSha256Precondition struct { Type: "content_sha256"; ContentSha256 }

A precondition that applies an update only if the memory's current content has the hash in content_sha256.

If the hashes differ, the request fails with HTTP status 409. Retrieve the memory and retry. If the memory already has exactly the requested content and path, the request succeeds even though the hashes differ.

Type ContentSha256
ContentSha256 string Optional

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.

pattern^[a-f0-9]{64}$
type BetaManagedAgentsDeletedMemory struct { Type: "memory_deleted"; ID }

The confirmation that Delete a Memory returns.

Deleting a memory doesn't delete its versions. List Memory Versions returns them while they are retained: each version is kept for at least the version retention period after it was written, unless the store itself is deleted.

See the memory guide to learn more about how long versions are kept.

Type MemoryDeleted
ID string

ID of the deleted memory (a mem_... value).

type BetaManagedAgentsErrorObjectUnion interface{…}
One of the following:
type BetaManagedAgentsMemory struct { Type: "memory"; ID; ContentSha256; /* 7 more */ }

A text document at a path inside a memory store.

content is null when the response uses view=basic. content_size_bytes and content_sha256 are always set, so you can detect changes without fetching the content. To retrieve, update, or delete a memory, pass its ID, which stays the same when its path changes.

See the memory guide to learn more about working with memories.

Type Memory
ID string

The unique ID of the memory (mem_...). It stays the same when the memory's path changes.

To retrieve, update, or delete the memory, pass this ID.

ContentSha256 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.

ContentSizeBytes int64

The size of the memory's content in UTF-8 bytes. It is set regardless of view.

formatint32
CreatedAt Time

When this memory was created, in RFC 3339 format.

formatdate-time
MemoryStoreID string

ID of the memory store this memory belongs to (a memstore_... value).

MemoryVersionID string

The ID of the memory version that holds the memory's current content (memver_...).

Memory versions don't have a flag that marks the latest one. Compare their IDs with this field instead.

See the memory guide to learn more about 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.

UpdatedAt Time

When the memory was last changed, in RFC 3339.

To find out who made the change, look at created_by on the memory version that memory_version_id references.

formatdate-time
Content string Optional

The memory's UTF-8 text content, or null when the response uses view=basic.

The maximum size is 100 kB (102,400 bytes).

type BetaManagedAgentsMemoryListItemUnion interface{…}

One item in a List Memories response: a memory, or a memory_prefix marker when depth is 1.

One of the following:
type BetaManagedAgentsMemoryPathConflictErrorObject struct { Type: "memory_path_conflict_error"; ConflictingMemoryID; ConflictingPath; Message }

The error returned with HTTP status 409 when you create or rename a memory and the path you give is already used by another memory or overlaps another memory's path.

Two paths overlap when one is an ancestor of the other, such as /notes and /notes/todo.md. To free the path, rename or delete the memory that conflicting_memory_id references, then retry. To change that memory instead of creating a new one, update it.

To handle the error in code, use conflicting_path and conflicting_memory_id instead of message.

Type MemoryPathConflictError
ConflictingMemoryID string Optional

The ID of the memory that blocked the write (mem_...), or an empty string if that memory can't be identified.

Retry the request when it is empty.

ConflictingPath string Optional

The path that blocked the write: the requested path, or the path of a memory that is an ancestor or descendant of it.

Message string Optional
type BetaManagedAgentsMemoryPreconditionFailedErrorObject struct { Type: "memory_precondition_failed_error"; Message }

The error returned with HTTP status 409 when a request's precondition doesn't hold for the memory's current state, such as precondition on an update or expected_content_sha256 on a delete.

The error doesn't include the memory's current state. Retrieve the memory to see its current content and content_sha256 before you retry.

See the memory guide to learn more about safe content edits with content hash preconditions.

Type MemoryPreconditionFailedError
Message string Optional
type BetaManagedAgentsMemoryPrefix struct { Type: "memory_prefix"; Path }

A directory marker that List Memories returns instead of the memories below the requested depth.

It stands for one or more memories whose paths start with path. It isn't a stored object and doesn't have an ID. Each marker counts toward the page limit.

Type MemoryPrefix
Path string

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.

type BetaManagedAgentsMemoryView string

Whether a memory or memory_version in the response includes its content. Defaults to full on retrieve operations and to basic on list, create, and update operations.

With full, list operations return at most 20 items per page.

One of the following:
const BetaManagedAgentsMemoryViewBasic BetaManagedAgentsMemoryView = "basic"

Return the object with content set to null. The content_size_bytes and content_sha256 fields remain populated, so sync clients can diff without fetching content.

const BetaManagedAgentsMemoryViewFull BetaManagedAgentsMemoryView = "full"

Return the object with content populated. On list endpoints, view=full caps limit at 20.

type BetaManagedAgentsPreconditionParam struct { Type: "content_sha256"; ContentSha256 }

Optional condition that must hold for an update to apply. When omitted, the update is unconditional. Asserts the current state of the memory being updated. When an update changes path, the precondition still refers to the memory's current content, not the destination path. Currently the only supported variant is content_sha256.

Type ContentSha256
ContentSha256 string Optional

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.

pattern^[a-f0-9]{64}$