create_space
¶
create_space(
name: SpaceName,
*,
config_overrides: Optional[OpenSearchMemoryClientConfig] = None,
memory_strategies: Optional[MemoryStrategyList] = None,
event_expiry_days: Optional[EventExpiryDays] = None,
memory_expiry_days: Optional[MemoryExpiryDays] = None,
extraction_model_id: Optional[ExtractionModelId] = None,
encryption_configuration: Optional[EncryptionConfiguration] = None,
tags: Optional[TagList] = None,
client_token: Optional[ClientToken] = None,
) -> CreateSpaceResponse
Creates a space. A space is an AWS resource that stores the events you send and the memories extracted from them, and defines the memory strategies that extract those memories.
The operation returns before provisioning finishes, with status CREATING. Call GetSpace until the status is ACTIVE, and then use the space. If provisioning fails, the status becomes FAILED and statusReason says why.
Parameters:
-
name(SpaceName) –A name for the space, unique within your account in the Region. If another space already has the name, the request fails with
ConflictException. -
memory_strategies(Optional[MemoryStrategyList], default:None) –The memory strategies that extract memories from the space's events: up to 10 strategies, each with a name that is unique within the space.
Optional. Omit it, or send an empty list, to create a space with no memory strategies. Such a space stores the conversation events you send it and returns them through
SearchEventsandListEvents, but extracts no memories and has none to search. You can add strategies later withUpdateSpace.The serialized list can be at most 384 KiB.
-
event_expiry_days(Optional[EventExpiryDays], default:None) –How many days the space keeps each event, from 1 to 365. The default is 90.
-
memory_expiry_days(Optional[MemoryExpiryDays], default:None) –How many days the space keeps each memory, from 0 to 3650, counted from when the service writes the memory. Updating a memory with
UpdateMemorydoesn't restart the count. 0 means memories never expire. If you omit it, memories never expire.Searches and lists leave out a memory past its expiry, and reading, updating, or deleting it returns
ResourceNotFoundException. -
extraction_model_id(Optional[ExtractionModelId], default:None) –The model that extracts and consolidates memories for every strategy in the space, as an Amazon Bedrock model ID without an inference-profile prefix:
anthropic.claude-opus-5-5oranthropic.claude-haiku-5-5. Another value fails withValidationException, and the message lists the supported IDs. Omit it to use the service default, which can change over time and isn't returned byGetSpace. Setting a value pins the model. -
encryption_configuration(Optional[EncryptionConfiguration], default:None) –The AWS KMS key that encrypts the space's data. Omit it, or omit its
kmsKeyArn, to use an AWS owned key. You can't change the key after you create the space. -
tags(Optional[TagList], default:None) –The tags to add to the space.
-
client_token(Optional[ClientToken], default:None) –A unique, case-sensitive identifier that makes the request idempotent. A retry with the same token and the same parameters within 2 hours returns the space that the first request created, instead of creating another. Reusing the token with different parameters, or while the first request is still in progress, fails with
ConflictException.
Raises:
-
AccessDeniedException–You don't have sufficient access to perform this operation. To use this operation, you must have AWS Identity and Access Management (IAM) permissions for the operation, and on the resource it acts on. If the space uses a customer managed AWS Key Management Service (AWS KMS) key, you must also have permission to use the key.
-
ConflictException–The request conflicts with the current state of the resource. For example, the space is being created, updated, or deleted, a space with the same name already exists, or you reused a client token with different parameters. Wait for the space to finish being created, updated, or deleted, or use a different name or client token, and then retry.
-
InternalServerException–The service couldn't process the request because of an internal error. Retry the request.
-
ServiceQuotaExceededException–The request would exceed a quota, such as the number of spaces in your account or the number of strategies in a space.
-
ThrottlingException–The service throttled the request. Retry the request with exponential backoff.
-
ValidationException–The request isn't valid. The
reason,message, andfieldListmembers describe the problem. Fix the request, and then try again. -
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_opensearchmemory/_services/open_search_memory.py
385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 | |