Class: Anthropic::Resources::Beta::MemoryStores

Inherits:
Object
  • Object
show all
Defined in:
lib/anthropic/resources/beta/memory_stores.rb,
lib/anthropic/resources/beta/memory_stores/memories.rb,
lib/anthropic/resources/beta/memory_stores/memory_versions.rb,
sig/anthropic/resources/beta/memory_stores.rbs,
sig/anthropic/resources/beta/memory_stores/memories.rbs,
sig/anthropic/resources/beta/memory_stores/memory_versions.rbs

Defined Under Namespace

Classes: Memories, MemoryVersions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ MemoryStores

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of MemoryStores.

Parameters:



219
220
221
222
223
# File 'lib/anthropic/resources/beta/memory_stores.rb', line 219

def initialize(client:)
  @client = client
  @memories = Anthropic::Resources::Beta::MemoryStores::Memories.new(client: client)
  @memory_versions = Anthropic::Resources::Beta::MemoryStores::MemoryVersions.new(client: client)
end

Instance Attribute Details

#memoriesAnthropic::Resources::Beta::MemoryStores::Memories (readonly)



8
9
10
# File 'lib/anthropic/resources/beta/memory_stores.rb', line 8

def memories
  @memories
end

#memory_versionsAnthropic::Resources::Beta::MemoryStores::MemoryVersions (readonly)



11
12
13
# File 'lib/anthropic/resources/beta/memory_stores.rb', line 11

def memory_versions
  @memory_versions
end

Instance Method Details

#archive(memory_store_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsMemoryStore

Archive a memory store

Some parameter documentations has been truncated, see Models::Beta::MemoryStoreArchiveParams for more details.

Parameters:

  • memory_store_id (String)

    Path parameter memory_store_id

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Optional header to specify the beta version(s) you want to use.

  • workspace_id (String)

    Optional header to select the Workspace for this request. The value is a Workspa

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



205
206
207
208
209
210
211
212
213
214
# File 'lib/anthropic/resources/beta/memory_stores.rb', line 205

def archive(memory_store_id, params = {})
  parsed, options = Anthropic::Beta::MemoryStoreArchiveParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["v1/memory_stores/%1$s/archive?beta=true", memory_store_id],
    headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"),
    model: Anthropic::Beta::BetaManagedAgentsMemoryStore,
    options: {extra_headers: {"anthropic-beta" => "agent-memory-2026-07-22"}, **options}
  )
end

#create(name:, description: nil, metadata: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsMemoryStore

Create a memory store

Some parameter documentations has been truncated, see Models::Beta::MemoryStoreCreateParams for more details.

Parameters:

  • name (String)

    Body param: Human-readable name for the store. Required; 1–255 characters; no co

  • description (String)

    Body param: Free-text description of what the store contains, up to 1024 charact

  • metadata (Hash{Symbol=>String})

    Body param: Arbitrary key-value tags for your own bookkeeping (such as the end u

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Header param: Optional header to specify the beta version(s) you want to use.

  • workspace_id (String)

    Header param: Optional header to select the Workspace for this request. The valu

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/anthropic/resources/beta/memory_stores.rb', line 35

def create(params)
  parsed, options = Anthropic::Beta::MemoryStoreCreateParams.dump_request(params)
  header_params = {betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"}
  @client.request(
    method: :post,
    path: "v1/memory_stores?beta=true",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Anthropic::Beta::BetaManagedAgentsMemoryStore,
    options: {extra_headers: {"anthropic-beta" => "agent-memory-2026-07-22"}, **options}
  )
end

#delete(memory_store_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsDeletedMemoryStore

Delete a memory store

Some parameter documentations has been truncated, see Models::Beta::MemoryStoreDeleteParams for more details.

Parameters:

  • memory_store_id (String)

    Path parameter memory_store_id

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Optional header to specify the beta version(s) you want to use.

  • workspace_id (String)

    Optional header to select the Workspace for this request. The value is a Workspa

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



176
177
178
179
180
181
182
183
184
185
# File 'lib/anthropic/resources/beta/memory_stores.rb', line 176

def delete(memory_store_id, params = {})
  parsed, options = Anthropic::Beta::MemoryStoreDeleteParams.dump_request(params)
  @client.request(
    method: :delete,
    path: ["v1/memory_stores/%1$s?beta=true", memory_store_id],
    headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"),
    model: Anthropic::Beta::BetaManagedAgentsDeletedMemoryStore,
    options: {extra_headers: {"anthropic-beta" => "agent-memory-2026-07-22"}, **options}
  )
end

#list(created_at_gte: nil, created_at_lte: nil, include_archived: nil, limit: nil, page: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Internal::PageCursor<Anthropic::Models::Beta::BetaManagedAgentsMemoryStore>

List memory stores

Some parameter documentations has been truncated, see Models::Beta::MemoryStoreListParams for more details.

Parameters:

  • created_at_gte (Time)

    Query param: Return only stores whose created_at is at or after this time (inc

  • created_at_lte (Time)

    Query param: Return only stores whose created_at is at or before this time (in

  • include_archived (Boolean)

    Query param: When true, archived stores are included in the results. Defaults

  • limit (Integer)

    Query param: Maximum number of stores to return per page. Must be between 1 and

  • page (String)

    Query param: Opaque pagination cursor (a page_... value). Pass the next_page

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Header param: Optional header to specify the beta version(s) you want to use.

  • workspace_id (String)

    Header param: Optional header to select the Workspace for this request. The valu

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/anthropic/resources/beta/memory_stores.rb', line 140

def list(params = {})
  query_params = [:created_at_gte, :created_at_lte, :include_archived, :limit, :page]
  parsed, options = Anthropic::Beta::MemoryStoreListParams.dump_request(params)
  query = Anthropic::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :get,
    path: "v1/memory_stores?beta=true",
    query: query.transform_keys(created_at_gte: "created_at[gte]", created_at_lte: "created_at[lte]"),
    headers: parsed.except(*query_params).transform_keys(
      betas: "anthropic-beta",
      workspace_id: "anthropic-workspace-id"
    ),
    page: Anthropic::Internal::PageCursor,
    model: Anthropic::Beta::BetaManagedAgentsMemoryStore,
    options: {extra_headers: {"anthropic-beta" => "agent-memory-2026-07-22"}, **options}
  )
end

#retrieve(memory_store_id, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsMemoryStore

Retrieve a memory store

Some parameter documentations has been truncated, see Models::Beta::MemoryStoreRetrieveParams for more details.

Parameters:

  • memory_store_id (String)

    Path parameter memory_store_id

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Optional header to specify the beta version(s) you want to use.

  • workspace_id (String)

    Optional header to select the Workspace for this request. The value is a Workspa

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



66
67
68
69
70
71
72
73
74
75
# File 'lib/anthropic/resources/beta/memory_stores.rb', line 66

def retrieve(memory_store_id, params = {})
  parsed, options = Anthropic::Beta::MemoryStoreRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["v1/memory_stores/%1$s?beta=true", memory_store_id],
    headers: parsed.transform_keys(betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"),
    model: Anthropic::Beta::BetaManagedAgentsMemoryStore,
    options: {extra_headers: {"anthropic-beta" => "agent-memory-2026-07-22"}, **options}
  )
end

#update(memory_store_id, description: nil, metadata: nil, name: nil, betas: nil, workspace_id: nil, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsMemoryStore

Update a memory store

Some parameter documentations has been truncated, see Models::Beta::MemoryStoreUpdateParams for more details.

Parameters:

  • memory_store_id (String)

    Path param: Path parameter memory_store_id

  • description (String, nil)

    Body param: New description for the store, up to 1024 characters. Pass an empty

  • metadata (Hash{Symbol=>String, nil}, nil)

    Body param: Metadata patch. Set a key to a string to upsert it, or to null to de

  • name (String, nil)

    Body param: New human-readable name for the store. 1–255 characters; no control

  • betas (Array<String, Symbol, Anthropic::Models::AnthropicBeta>)

    Header param: Optional header to specify the beta version(s) you want to use.

  • workspace_id (String)

    Header param: Optional header to select the Workspace for this request. The valu

  • request_options (Anthropic::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/anthropic/resources/beta/memory_stores.rb', line 101

def update(memory_store_id, params = {})
  parsed, options = Anthropic::Beta::MemoryStoreUpdateParams.dump_request(params)
  header_params = {betas: "anthropic-beta", workspace_id: "anthropic-workspace-id"}
  @client.request(
    method: :post,
    path: ["v1/memory_stores/%1$s?beta=true", memory_store_id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Anthropic::Beta::BetaManagedAgentsMemoryStore,
    options: {extra_headers: {"anthropic-beta" => "agent-memory-2026-07-22"}, **options}
  )
end