interface TriggerConditions
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Bedrock.Agentcore.Alpha.TriggerConditions |
Go | github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2#TriggerConditions |
Java | software.amazon.awscdk.services.bedrock.agentcore.alpha.TriggerConditions |
Python | aws_cdk.aws_bedrock_agentcore_alpha.TriggerConditions |
TypeScript (source) | @aws-cdk/aws-bedrock-agentcore-alpha ยป TriggerConditions |
Trigger conditions for self managed memory strategy When first condition is met, batched payloads are sent to specified S3 bucket.
Example
const bucket = new s3.Bucket(this, 'memoryBucket', {
bucketName: 'test-memory',
removalPolicy: cdk.RemovalPolicy.DESTROY,
autoDeleteObjects: true,
});
const topic = new sns.Topic(this, 'topic');
// Create a custom semantic memory strategy
const selfManagedStrategy = agentcore.MemoryStrategy.usingSelfManaged({
name: "selfManagedStrategy",
description: "self managed memory strategy",
historicalContextWindowSize: 5,
invocationConfiguration: {
topic: topic,
s3Location: {
bucketName: bucket.bucketName,
objectKey: 'memory/',
}
},
triggerConditions: {
messageBasedTrigger: 1,
timeBasedTrigger: cdk.Duration.seconds(10),
tokenBasedTrigger: 100
}
});
// Create memory with custom strategy
const memory = new agentcore.Memory(this, "MyMemory", {
memoryName: "my-custom-memory",
description: "Memory with custom strategy",
expirationDuration: cdk.Duration.days(90),
memoryStrategies: [selfManagedStrategy],
});
Properties
| Name | Type | Description |
|---|---|---|
| message | number | Triggers memory processing when specified number of new messages is reached. |
| time | Duration | Triggers memory processing when the session has been idle for the specified duration. |
| token | number | Triggers memory processing when the token size reaches the specified threshold. |
messageBasedTrigger?
Type:
number
(optional, default: 1)
Triggers memory processing when specified number of new messages is reached.
timeBasedTrigger?
Type:
Duration
(optional, default: 10)
Triggers memory processing when the session has been idle for the specified duration.
Value in seconds.
tokenBasedTrigger?
Type:
number
(optional, default: 100)
Triggers memory processing when the token size reaches the specified threshold.

.NET
Go
Java
Python
TypeScript (