> **Experimental**
>
> `@aws-cdk/aws-bedrock-agentcore-alpha` is an [**experimental**](/stability) (alpha) package: its API may change in any release, without a major version bump.
# SelfManagedMemoryStrategy

Use AgentCore memory for event storage with custom triggers.

Define memory processing logic in your own environment.

Extends: SelfManagedMemoryStrategy
Implements: IMemoryStrategy

- Source: [`lib/memory/strategies/self-managed-strategy.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0-alpha.0/packages/@aws-cdk/aws-bedrock-agentcore-alpha/lib/memory/strategies/self-managed-strategy.ts#L153)

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as bedrock_agentcore_alpha from '@aws-cdk/aws-bedrock-agentcore-alpha';
import * as cdk from 'aws-cdk-lib';
import { aws_sns as sns } from 'aws-cdk-lib';

declare const topic: sns.Topic;
const selfManagedMemoryStrategy = new bedrock_agentcore_alpha.SelfManagedMemoryStrategy(bedrock_agentcore_alpha.MemoryStrategyType.SUMMARIZATION, {
  invocationConfiguration: {
    s3Location: {
      bucketName: 'bucketName',
      objectKey: 'objectKey',

      // the properties below are optional
      objectVersion: 'objectVersion',
    },
    topic: topic,
  },
  name: 'name',

  // the properties below are optional
  description: 'description',
  historicalContextWindowSize: 123,
  triggerConditions: {
    messageBasedTrigger: 123,
    timeBasedTrigger: cdk.Duration.minutes(30),
    tokenBasedTrigger: 123,
  },
});
```

## Initializer

```ts
new SelfManagedMemoryStrategy(strategyType: MemoryStrategyType, props: SelfManagedStrategyProps)
```

## Properties

- `description`: string — The description of the memory strategy.

- `historicalContextWindowSize`: number — Historical context window size for self managed memory strategy.

- `invocationConfiguration`: [InvocationConfiguration](/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.InvocationConfiguration.html) — Invocation configuration for self managed memory strategy.

- `name`: string — The name of the memory strategy.

- `strategyType`: [MemoryStrategyType](/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.MemoryStrategyType.html) — The type of memory strategy.

- `triggerConditions`: [TriggerConditions](/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.TriggerConditions.html) — Trigger conditions for self managed memory strategy.

## Methods

- `grant(grantee: IGrantable): Grant` — Grants the necessary permissions to the role.

  [disable-awslint:no-grants]

  **Parameters**

  - `grantee` — - The grantee to grant permissions to.

  **Returns:** The Grant object for chaining

- `render(): CfnMemory.MemoryStrategyProperty` — Renders internal attributes to CloudFormation.
