Location

class aws_cdk.aws_s3.Location(*, bucket_name, object_key, object_version=None)

Bases: object

An interface that represents the location of a specific object in an S3 Bucket.

Parameters:
  • bucket_name (str) – The name of the S3 Bucket the object is in.

  • object_key (str) – The path inside the Bucket where the object is located at.

  • object_version (Optional[str]) – The S3 object version.

ExampleMetadata:

fixture=default infused

Example:

bucket = s3.Bucket(self, "memoryBucket",
    bucket_name="test-memory",
    removal_policy=cdk.RemovalPolicy.DESTROY,
    auto_delete_objects=True
)

topic = sns.Topic(self, "topic")

# Create a custom semantic memory strategy
self_managed_strategy = agentcore.MemoryStrategy.using_self_managed(
    name="selfManagedStrategy",
    description="self managed memory strategy",
    historical_context_window_size=5,
    invocation_configuration=agentcore.InvocationConfiguration(
        topic=topic,
        s3_location=s3.Location(
            bucket_name=bucket.bucket_name,
            object_key="memory/"
        )
    ),
    trigger_conditions=agentcore.TriggerConditions(
        message_based_trigger=1,
        time_based_trigger=cdk.Duration.seconds(10),
        token_based_trigger=100
    )
)

# Create memory with custom strategy
memory = agentcore.Memory(self, "MyMemory",
    memory_name="my-custom-memory",
    description="Memory with custom strategy",
    expiration_duration=cdk.Duration.days(90),
    memory_strategies=[self_managed_strategy]
)

Attributes

bucket_name

The name of the S3 Bucket the object is in.

object_key

The path inside the Bucket where the object is located at.

object_version

The S3 object version.