# TriggerConditions

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

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

## Example

TypeScript:

```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';
const triggerConditions: bedrock_agentcore_alpha.TriggerConditions = {
  messageBasedTrigger: 123,
  timeBasedTrigger: cdk.Duration.minutes(30),
  tokenBasedTrigger: 123,
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_bedrock_agentcore_alpha as bedrock_agentcore_alpha
import aws_cdk as cdk

trigger_conditions = bedrock_agentcore_alpha.TriggerConditions(
    message_based_trigger=123,
    time_based_trigger=cdk.Duration.minutes(30),
    token_based_trigger=123
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.bedrock.agentcore.alpha.*;
import software.amazon.awscdk.*;

TriggerConditions triggerConditions = TriggerConditions.builder()
        .messageBasedTrigger(123)
        .timeBasedTrigger(Duration.minutes(30))
        .tokenBasedTrigger(123)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Agentcore.Alpha
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Bedrock.Agentcore.Alpha;
using Amazon.CDK;

var triggerConditions = new TriggerConditions {
    MessageBasedTrigger = 123,
    TimeBasedTrigger = Duration.Minutes(30),
    TokenBasedTrigger = 123
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import bedrock_agentcore_alpha "github.com/aws/aws-cdk-go/awsbedrockagentcorealpha"
import cdk "github.com/aws/aws-cdk-go/awscdk"

triggerConditions := &TriggerConditions{
	MessageBasedTrigger: jsii.Number(123),
	TimeBasedTrigger: cdk.Duration_Minutes(jsii.Number(30)),
	TokenBasedTrigger: jsii.Number(123),
}
```

## Properties

- `messageBasedTrigger`: number = 1 — Triggers memory processing when specified number of new messages is reached.

- `timeBasedTrigger`: [Duration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — Triggers memory processing when the session has been idle for the specified duration.

  **Default:** 10 seconds

  Value in seconds.

- `tokenBasedTrigger`: number = 100 — Triggers memory processing when the token size reaches the specified threshold.
