class SelfManagedMemoryStrategy
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Bedrock.Agentcore.Alpha.SelfManagedMemoryStrategy |
Go | github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2#SelfManagedMemoryStrategy |
Java | software.amazon.awscdk.services.bedrock.agentcore.alpha.SelfManagedMemoryStrategy |
Python | aws_cdk.aws_bedrock_agentcore_alpha.SelfManagedMemoryStrategy |
TypeScript (source) | @aws-cdk/aws-bedrock-agentcore-alpha ยป SelfManagedMemoryStrategy |
Implements
IMemory
Use AgentCore memory for event storage with custom triggers.
Define memory processing logic in your own environment.
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],
});
Initializer
new SelfManagedMemoryStrategy(strategyType: MemoryStrategyType, props: SelfManagedStrategyProps)
Parameters
- strategyType
Memoryโ The type of memory strategy.Strategy Type - props
SelfManaged Strategy Props
Properties
| Name | Type | Description |
|---|---|---|
| historical | number | Historical context window size for self managed memory strategy. |
| invocation | Invocation | Invocation configuration for self managed memory strategy. |
| name | string | The name of the memory strategy. |
| strategy | Memory | The type of memory strategy. |
| trigger | Trigger | Trigger conditions for self managed memory strategy. |
| description? | string | The description of the memory strategy. |
historicalContextWindowSize
Type:
number
Historical context window size for self managed memory strategy.
invocationConfiguration
Type:
Invocation
Invocation configuration for self managed memory strategy.
name
Type:
string
The name of the memory strategy.
strategyType
Type:
Memory
The type of memory strategy.
triggerConditions
Type:
Trigger
Trigger conditions for self managed memory strategy.
description?
Type:
string
(optional)
The description of the memory strategy.
Methods
| Name | Description |
|---|---|
| grant(grantee) | Grants the necessary permissions to the role. |
| render() | Renders internal attributes to CloudFormation. |
grant(grantee)
public grant(grantee: IGrantable): Grant
Parameters
- grantee
IGrantableโ - The grantee to grant permissions to.
Returns
Grants the necessary permissions to the role.
render()
public render(): MemoryStrategyProperty
Returns
Renders internal attributes to CloudFormation.

.NET
Go
Java
Python
TypeScript (