TriggerConditions

class aws_cdk.aws_bedrock_agentcore_alpha.TriggerConditions(*, message_based_trigger=None, time_based_trigger=None, token_based_trigger=None)

Bases: object

(experimental) Trigger conditions for self managed memory strategy When first condition is met, batched payloads are sent to specified S3 bucket.

Parameters:
  • message_based_trigger (Union[int, float, None]) – (experimental) Triggers memory processing when specified number of new messages is reached. Default: - 1

  • time_based_trigger (Optional[Duration]) – (experimental) Triggers memory processing when the session has been idle for the specified duration. Value in seconds. Default: - 10

  • token_based_trigger (Union[int, float, None]) – (experimental) Triggers memory processing when the token size reaches the specified threshold. Default: - 100

Stability:

experimental

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

message_based_trigger

(experimental) Triggers memory processing when specified number of new messages is reached.

Default:
  • 1

Stability:

experimental

Required:
  • No

time_based_trigger

(experimental) Triggers memory processing when the session has been idle for the specified duration.

Value in seconds.

Default:
  • 10

Stability:

experimental

Required:
  • No

token_based_trigger

(experimental) Triggers memory processing when the token size reaches the specified threshold.

Default:
  • 100

Stability:

experimental

Required:
  • No