MemoryProps
- class aws_cdk.aws_bedrockagentcore.MemoryProps(*, description=None, execution_role=None, expiration_duration=None, kms_key=None, memory_name=None, memory_strategies=None, stream_delivery_resources=None, tags=None)
Bases:
objectProperties for creating a Memory resource.
- Parameters:
description (
Optional[str]) – Optional description for the memory Valid characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and spaces The description can have up to 200 characters. Default: - No descriptionexecution_role (
Optional[IRole]) – The IAM role that provides permissions for the memory to access AWS services when using custom strategies. Default: - A new role will be created.expiration_duration (
Optional[Duration]) – Short-term memory expiration in days (between 7 and 365). Sets the short-term (raw event) memory retention. Events older than the specified duration will expire and no longer be stored. Default: - 90 dayskms_key (
Optional[IKey]) – Custom KMS key to use for encryption. Default: - Your data is encrypted with a key that AWS owns and manages for youmemory_name (
Optional[str]) – The name of the memory Valid characters are a-z, A-Z, 0-9, _ (underscore) The name must start with a letter and can be up to 48 characters long Pattern: [a-zA-Z][a-zA-Z0-9_]{0,47}. Default: - auto generatememory_strategies (
Optional[Sequence[IMemoryStrategy]]) – If you need long-term memory for context recall across sessions, you can setup memory extraction strategies to extract the relevant memory from the raw events. Default: - No extraction strategies (short term memory only)stream_delivery_resources (
Optional[Sequence[StreamDeliveryResource]]) – Stream delivery resources for real-time push-based streaming of memory record lifecycle events (created, updated, deleted) to Amazon Kinesis Data Streams. The memory execution role will automatically be granted write permissions to each stream. Only one stream delivery resource is currently supported (CloudFormation maximum); providing more than one fails at synth withTooManyStreamDeliveryResources:: declare const stream: kinesis.IStream; new agentcore.Memory(this, ‘Memory’, { streamDeliveryResources: [ agentcore.StreamDeliveryResource.kinesis(stream, { contentConfigurations: [{ type: agentcore.StreamDeliveryContentType.MEMORY_RECORDS, level: agentcore.StreamDeliveryContentLevel.METADATA_ONLY, }], }), ], }); Default: - No stream delivery (events are not pushed to Kinesis)tags (
Optional[Mapping[str,str]]) – Tags (optional) A list of key:value pairs of tags to apply to this memory resource. Default: - no tags
- ExampleMetadata:
fixture=default infused
Example:
# Create a Kinesis Data Stream stream = kinesis.Stream(self, "MemoryEventStream", stream_name="memory-events" ) memory = agentcore.Memory(self, "MemoryWithStreamDelivery", memory_name="memory_with_stream", description="Memory with Kinesis stream delivery", expiration_duration=cdk.Duration.days(90), stream_delivery_resources=[ agentcore.StreamDeliveryResource.kinesis(stream, content_configurations=[agentcore.StreamDeliveryContentConfiguration( type=agentcore.StreamDeliveryContentType.MEMORY_RECORDS, level=agentcore.StreamDeliveryContentLevel.METADATA_ONLY ) ] ) ] )
Attributes
- description
Optional description for the memory Valid characters are a-z, A-Z, 0-9, _ (underscore), - (hyphen) and spaces The description can have up to 200 characters.
- Default:
No description
- execution_role
The IAM role that provides permissions for the memory to access AWS services when using custom strategies.
- Default:
A new role will be created.
- expiration_duration
Short-term memory expiration in days (between 7 and 365).
Sets the short-term (raw event) memory retention. Events older than the specified duration will expire and no longer be stored.
- Default:
90 days
- kms_key
Custom KMS key to use for encryption.
- Default:
Your data is encrypted with a key that AWS owns and manages for you
- memory_name
[a-zA-Z][a-zA-Z0-9_]{0,47}.
- Default:
auto generate
- Type:
The name of the memory Valid characters are a-z, A-Z, 0-9, _ (underscore) The name must start with a letter and can be up to 48 characters long Pattern
- memory_strategies
If you need long-term memory for context recall across sessions, you can setup memory extraction strategies to extract the relevant memory from the raw events.
- Default:
No extraction strategies (short term memory only)
- stream_delivery_resources
Stream delivery resources for real-time push-based streaming of memory record lifecycle events (created, updated, deleted) to Amazon Kinesis Data Streams.
The memory execution role will automatically be granted write permissions to each stream.
Only one stream delivery resource is currently supported (CloudFormation maximum); providing more than one fails at synth with
TooManyStreamDeliveryResources:# stream: kinesis.IStream agentcore.Memory(self, "Memory", stream_delivery_resources=[ agentcore.StreamDeliveryResource.kinesis(stream, content_configurations=[agentcore.StreamDeliveryContentConfiguration( type=agentcore.StreamDeliveryContentType.MEMORY_RECORDS, level=agentcore.StreamDeliveryContentLevel.METADATA_ONLY )] ) ] )
- Default:
No stream delivery (events are not pushed to Kinesis)
- See:
https://docs.aws.amazon.com/bedrock-agentcore/latest/devguide/memory-record-streaming.html