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

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:



195
196
197
198
199
# File 'lib/anthropic/resources/beta/memory_stores.rb', line 195

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, request_options: {}) ⇒ Anthropic::Models::Beta::BetaManagedAgentsMemoryStore

Archive a memory store

Parameters:

Returns:

See Also:



181
182
183
184
185
186
187
188
189
190
# File 'lib/anthropic/resources/beta/memory_stores.rb', line 181

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"),
    model: Anthropic::Beta::BetaManagedAgentsMemoryStore,
    options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **options}
  )
end

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

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

Create a memory store

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.

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

Returns:

See Also:



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

def create(params)
  parsed, options = Anthropic::Beta::MemoryStoreCreateParams.dump_request(params)
  header_params = {betas: "anthropic-beta"}
  @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" => "managed-agents-2026-04-01"}, **options}
  )
end

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

Delete a memory store

Parameters:

Returns:

See Also:



157
158
159
160
161
162
163
164
165
166
# File 'lib/anthropic/resources/beta/memory_stores.rb', line 157

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"),
    model: Anthropic::Beta::BetaManagedAgentsDeletedMemoryStore,
    options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **options}
  )
end

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

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

List memory stores

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.

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

Returns:

See Also:



129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/anthropic/resources/beta/memory_stores.rb', line 129

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"),
    page: Anthropic::Internal::PageCursor,
    model: Anthropic::Beta::BetaManagedAgentsMemoryStore,
    options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **options}
  )
end

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

Retrieve a memory store

Parameters:

Returns:

See Also:



59
60
61
62
63
64
65
66
67
68
# File 'lib/anthropic/resources/beta/memory_stores.rb', line 59

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"),
    model: Anthropic::Beta::BetaManagedAgentsMemoryStore,
    options: {extra_headers: {"anthropic-beta" => "managed-agents-2026-04-01"}, **options}
  )
end

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

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

Update a memory store

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.

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

Returns:

See Also:



92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/anthropic/resources/beta/memory_stores.rb', line 92

def update(memory_store_id, params = {})
  parsed, options = Anthropic::Beta::MemoryStoreUpdateParams.dump_request(params)
  header_params = {betas: "anthropic-beta"}
  @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" => "managed-agents-2026-04-01"}, **options}
  )
end