OpenSearchMemory / Client / update_space
update_space¶
- OpenSearchMemory.Client.update_space(**kwargs)¶
Updates a space’s memory strategies, retention settings, or extraction model. Supply only the fields to change. Omitted fields keep their current values.
If the request changes the set of strategies, a strategy’s configuration, a retention setting, or the extraction model, the space moves to
UPDATING. When the change is complete, the space returns toACTIVE, or moves toFAILEDif the change can’t be applied. While the space isUPDATING,GetSpacereturns the previous configuration. A request that only changes strategy descriptions or repeats the values the space has stored is applied immediately and doesn’t change the status. Sending a retention value that the space never set also moves the space toUPDATING, even one that matches the behavior without it, such as 90 foreventExpiryDaysor 0 formemoryExpiryDays. A space that isCREATING,UPDATING, orDELETINGcan’t be updated: the request fails withConflictException.See also: AWS API Documentation
Request Syntax
response = client.update_space( spaceId='string', memoryStrategies=[ { 'type': 'SEMANTIC'|'SUMMARY'|'CUSTOM', 'name': 'string', 'description': 'string', 'configuration': { 'extractionPrompt': 'string', 'extractEveryNMessages': 123, 'extractEveryNTokens': 123, 'idleTimeoutSeconds': 123, 'extractionSeedTopK': 123, 'extractionSeedRecentN': 123, 'consolidationEnabled': True|False } }, ], eventExpiryDays=123, memoryExpiryDays=123, extractionModelId='string' )
- Parameters:
spaceId (string) –
[REQUIRED]
The ID of the space to update.
memoryStrategies (list) –
The complete new list of memory strategies. The service removes strategies that aren’t in the list from the space. Removing a strategy stops extraction for it but doesn’t delete its memories: they’re kept, until they expire if the space sets
memoryExpiryDays, and they’re available again if you later add a strategy with the sametypeandname. To delete them, useDeleteMemorybefore you remove the strategy, or delete the space.To keep a strategy, include it with the same
typeandnamethatGetSpacereturns. For a kept strategy, anyconfigurationmember you omit keeps its current value. It doesn’t return to the default, and you can’t clear a member once it’s set. Omit this field to leave the strategies unchanged. The list must name at least one strategy. You can’t remove every strategy from a space withUpdateSpace.The serialized list can be at most 384 KiB.
(dict) –
A memory strategy: how a space extracts one kind of memory from its events.
type (string) – [REQUIRED]
The type of memory the strategy extracts.
name (string) –
A name for the strategy, unique within the space. Omit it to have the service generate one from the type, for example
semantic_1. The name must be 1 to 64 characters: letters, digits, periods, hyphens, and underscores, starting with a letter or digit. A strategy’s name can’t be changed, and the strategy’s memories are stored under it: a strategy added under a new name starts with no memories.description (string) –
A description of the strategy.
configuration (dict) –
Settings for the strategy. When you create a strategy, omit it to use the defaults for the strategy’s type.
A
CUSTOMstrategy must setextractionPrompt.extractionPrompt (string) –
Instructions that define what a
CUSTOMstrategy extracts, up to 30,720 characters. Required for aCUSTOMstrategy:CreateSpaceandUpdateSpacefail withValidationExceptionif aCUSTOMstrategy has none.Only
CUSTOMstrategies use it.SEMANTICandSUMMARYstrategies always extract with the service’s built-in instructions: the service accepts and stores a prompt on them, andGetSpacereturns it, but extraction doesn’t use it.extractEveryNMessages (integer) –
Extract once this many messages have accumulated, from 1 to 1000. Lower values extract more often, in smaller batches. The default is 12.
Messages accumulate until the first of
extractEveryNMessages,extractEveryNTokens, andidleTimeoutSecondsis reached. The service then extracts them together in one pass.extractEveryNTokens (integer) –
Extract once this many tokens of conversation have accumulated, from 1 to 80,000, however few messages that takes. Use it to bound how much text one extraction call carries when message sizes vary widely. Omit it to bound a batch only by
extractEveryNMessages,idleTimeoutSeconds, and the service’s maximum batch size.idleTimeoutSeconds (integer) –
Extract what has accumulated once the conversation has been idle for this many seconds, from 1 to 86,400. The default is 60. This is what extracts the end of a conversation that stops. Raise it when the pauses in your conversations are longer than that, so that one exchange isn’t split across several extraction passes.
extractionSeedTopK (integer) –
How many of the strategy’s stored memories that are most relevant to the conversation to include in the extraction prompt, from 0 to 20, to improve extraction and reduce duplicates. If you omit this or set it to 0, the service uses its default (see
extractionSeedRecentN). When this andextractionSeedRecentNare both set, the two sets of memories are combined without duplicates.extractionSeedRecentN (integer) –
How many of the strategy’s most recent stored memories to include in the extraction prompt, from 0 to 20. If you omit this or set it to 0, the service uses its default: no seeding for most strategy types, and the 10 most recent memories for a
SUMMARYstrategy when neither seed setting is given. When this andextractionSeedTopKare both set, the two sets of memories are combined without duplicates.consolidationEnabled (boolean) –
Specifies whether the strategy consolidates memories. With consolidation, each new memory is compared with similar stored memories, and the service adds it, updates a stored memory, or skips it, so duplicate or contradicting facts don’t accumulate. Without it, every extracted memory is stored as a new memory, which costs less and keeps a full history.
When omitted, the default depends on the strategy’s type: on for
SEMANTICandSUMMARY, off forCUSTOM.
eventExpiryDays (integer) – How many days the space keeps each event, from 1 to 365. Omit it to leave the current value unchanged. Events already stored keep the expiry they were written with.
memoryExpiryDays (integer) –
How many days the space keeps each memory, from 0 to 3650. 0 means memories never expire. Omit it to leave the current value unchanged. You can’t clear the setting. To make memories written from then on never expire, send 0.
GetSpacethen returns 0.A change applies to memories written after it. Memories already stored keep the expiry they were written with. A memory the service rewrites later, such as a summary it keeps up to date, takes the setting in force at that rewrite. A change moves the space to
UPDATING. Sending the value that the space has stored doesn’t.extractionModelId (string) – The model that extracts and consolidates memories for every strategy in the space:
anthropic.claude-opus-5-5oranthropic.claude-haiku-5-5. Omit it to leave the current value unchanged. Once set, it can’t be cleared back to the service default.
- Return type:
dict
- Returns:
Response Syntax
{ 'spaceId': 'string', 'status': 'CREATING'|'ACTIVE'|'UPDATING'|'DELETING'|'DELETED'|'FAILED' }
Response Structure
(dict) –
spaceId (string) –
The ID of the space.
status (string) –
The status of the space:
UPDATINGwhen the change has to be applied to the space’s strategies, retention, or extraction model. Otherwise, the space’s current status.
Exceptions