MemoryProps

class aws_cdk.aws_bedrockagentcore.MemoryProps(*, description=None, execution_role=None, expiration_duration=None, kms_key=None, memory_name=None, memory_strategies=None, tags=None)

Bases: object

Properties 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 description

  • execution_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 days

  • kms_key (Optional[IKey]) – Custom KMS key to use for encryption. Default: - Your data is encrypted with a key that AWS owns and manages for you

  • memory_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 generate

  • memory_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)

  • 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 custom execution role
execution_role = iam.Role(self, "MemoryExecutionRole",
    assumed_by=iam.ServicePrincipal("bedrock-agentcore.amazonaws.com"),
    managed_policies=[
        iam.ManagedPolicy.from_aws_managed_policy_name("AmazonBedrockAgentCoreMemoryBedrockModelInferenceExecutionRolePolicy")
    ]
)

# Create memory with custom execution role
memory = agentcore.Memory(self, "MyMemory",
    memory_name="my_memory",
    description="Memory with custom execution role",
    expiration_duration=cdk.Duration.days(90),
    execution_role=execution_role
)

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)

tags

value pairs of tags to apply to this memory resource.

Default:
  • no tags

Type:

Tags (optional) A list of key