# OnlineEvaluationConfigProps

Struct · Deprecated

Deprecated: Use the equivalent construct from `aws-cdk-lib/aws-bedrockagentcore` instead.

Properties for creating an OnlineEvaluationConfig.

Extends: [OnlineEvaluationBaseProps](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.OnlineEvaluationBaseProps.html)
Used as props by: [OnlineEvaluationConfig](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.OnlineEvaluationConfig.html)

- Source: [`lib/evaluation/online-evaluation.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/@aws-cdk/aws-bedrock-agentcore-alpha/lib/evaluation/online-evaluation.ts#L49)

## Example

TypeScript:

```ts
// Create a custom LLM-as-a-Judge evaluator
const evaluator = new agentcore.Evaluator(this, 'MyEvaluator', {
  evaluatorName: 'my_custom_evaluator',
  level: agentcore.EvaluationLevel.SESSION,
  evaluatorConfig: agentcore.EvaluatorConfig.llmAsAJudge({
    instructions: 'Evaluate whether the agent response is helpful and accurate.',
    modelId: 'us.anthropic.claude-sonnet-4-6',
    ratingScale: agentcore.EvaluatorRatingScale.categorical([
      { label: 'Good', definition: 'The response is helpful and accurate.' },
      { label: 'Bad', definition: 'The response is not helpful or contains errors.' },
    ]),
  }),
});

// Use the custom evaluator in an online evaluation configuration
new agentcore.OnlineEvaluationConfig(this, 'MyEvaluation', {
  onlineEvaluationConfigName: 'my_evaluation',
  evaluators: [
    agentcore.EvaluatorReference.builtin(agentcore.BuiltinEvaluator.HELPFULNESS),
    agentcore.EvaluatorReference.custom(evaluator),
  ],
  dataSource: agentcore.DataSourceConfig.fromCloudWatchLogs({
    logGroupNames: ['/aws/bedrock-agentcore/my-agent'],
    serviceNames: ['my-agent.default'],
  }),
});
```

Python:

```python
# Create a custom LLM-as-a-Judge evaluator
evaluator = agentcore.Evaluator(self, "MyEvaluator",
    evaluator_name="my_custom_evaluator",
    level=agentcore.EvaluationLevel.SESSION,
    evaluator_config=agentcore.EvaluatorConfig.llm_as_a_judge(
        instructions="Evaluate whether the agent response is helpful and accurate.",
        model_id="us.anthropic.claude-sonnet-4-6",
        rating_scale=agentcore.EvaluatorRatingScale.categorical([agentcore.CategoricalRatingOption(label="Good", definition="The response is helpful and accurate."), agentcore.CategoricalRatingOption(label="Bad", definition="The response is not helpful or contains errors.")
        ])
    )
)

# Use the custom evaluator in an online evaluation configuration
agentcore.OnlineEvaluationConfig(self, "MyEvaluation",
    online_evaluation_config_name="my_evaluation",
    evaluators=[
        agentcore.EvaluatorReference.builtin(agentcore.BuiltinEvaluator.HELPFULNESS),
        agentcore.EvaluatorReference.custom(evaluator)
    ],
    data_source=agentcore.DataSourceConfig.from_cloud_watch_logs(
        log_group_names=["/aws/bedrock-agentcore/my-agent"],
        service_names=["my-agent.default"]
    )
)
```

Java:

```java
// Create a custom LLM-as-a-Judge evaluator
Evaluator evaluator = Evaluator.Builder.create(this, "MyEvaluator")
        .evaluatorName("my_custom_evaluator")
        .level(EvaluationLevel.SESSION)
        .evaluatorConfig(EvaluatorConfig.llmAsAJudge(LlmAsAJudgeOptions.builder()
                .instructions("Evaluate whether the agent response is helpful and accurate.")
                .modelId("us.anthropic.claude-sonnet-4-6")
                .ratingScale(EvaluatorRatingScale.categorical(List.of(CategoricalRatingOption.builder().label("Good").definition("The response is helpful and accurate.").build(), CategoricalRatingOption.builder().label("Bad").definition("The response is not helpful or contains errors.").build())))
                .build()))
        .build();

// Use the custom evaluator in an online evaluation configuration
// Use the custom evaluator in an online evaluation configuration
OnlineEvaluationConfig.Builder.create(this, "MyEvaluation")
        .onlineEvaluationConfigName("my_evaluation")
        .evaluators(List.of(EvaluatorReference.builtin(BuiltinEvaluator.HELPFULNESS), EvaluatorReference.custom(evaluator)))
        .dataSource(DataSourceConfig.fromCloudWatchLogs(CloudWatchLogsDataSourceConfig.builder()
                .logGroupNames(List.of("/aws/bedrock-agentcore/my-agent"))
                .serviceNames(List.of("my-agent.default"))
                .build()))
        .build();
```

C#:

```csharp
// Install: dotnet add package Amazon.CDK.AWS.Bedrock.Agentcore.Alpha
// Create a custom LLM-as-a-Judge evaluator
var evaluator = new Evaluator(this, "MyEvaluator", new EvaluatorProps {
    EvaluatorName = "my_custom_evaluator",
    Level = EvaluationLevel.SESSION,
    EvaluatorConfig = EvaluatorConfig.LlmAsAJudge(new LlmAsAJudgeOptions {
        Instructions = "Evaluate whether the agent response is helpful and accurate.",
        ModelId = "us.anthropic.claude-sonnet-4-6",
        RatingScale = EvaluatorRatingScale.Categorical(new [] { new CategoricalRatingOption { Label = "Good", Definition = "The response is helpful and accurate." }, new CategoricalRatingOption { Label = "Bad", Definition = "The response is not helpful or contains errors." } })
    })
});

// Use the custom evaluator in an online evaluation configuration
// Use the custom evaluator in an online evaluation configuration
new OnlineEvaluationConfig(this, "MyEvaluation", new OnlineEvaluationConfigProps {
    OnlineEvaluationConfigName = "my_evaluation",
    Evaluators = new [] { EvaluatorReference.Builtin(BuiltinEvaluator.HELPFULNESS), EvaluatorReference.Custom(evaluator) },
    DataSource = DataSourceConfig.FromCloudWatchLogs(new CloudWatchLogsDataSourceConfig {
        LogGroupNames = new [] { "/aws/bedrock-agentcore/my-agent" },
        ServiceNames = new [] { "my-agent.default" }
    })
});
```

Go:

```go
// Install: go get github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2
// Create a custom LLM-as-a-Judge evaluator
evaluator := agentcore.NewEvaluator(this, jsii.String("MyEvaluator"), &EvaluatorProps{
	EvaluatorName: jsii.String("my_custom_evaluator"),
	Level: agentcore.EvaluationLevel_SESSION(),
	EvaluatorConfig: agentcore.EvaluatorConfig_LlmAsAJudge(&LlmAsAJudgeOptions{
		Instructions: jsii.String("Evaluate whether the agent response is helpful and accurate."),
		ModelId: jsii.String("us.anthropic.claude-sonnet-4-6"),
		RatingScale: agentcore.EvaluatorRatingScale_Categorical([]CategoricalRatingOption{
			&CategoricalRatingOption{
				Label: jsii.String("Good"),
				Definition: jsii.String("The response is helpful and accurate."),
			},
			&CategoricalRatingOption{
				Label: jsii.String("Bad"),
				Definition: jsii.String("The response is not helpful or contains errors."),
			},
		}),
	}),
})

// Use the custom evaluator in an online evaluation configuration
// Use the custom evaluator in an online evaluation configuration
agentcore.NewOnlineEvaluationConfig(this, jsii.String("MyEvaluation"), &OnlineEvaluationConfigProps{
	OnlineEvaluationConfigName: jsii.String("my_evaluation"),
	Evaluators: []EvaluatorReference{
		agentcore.EvaluatorReference_Builtin(agentcore.BuiltinEvaluator_HELPFULNESS()),
		agentcore.EvaluatorReference_Custom(evaluator),
	},
	DataSource: agentcore.DataSourceConfig_FromCloudWatchLogs(&CloudWatchLogsDataSourceConfig{
		LogGroupNames: []*string{
			jsii.String("/aws/bedrock-agentcore/my-agent"),
		},
		ServiceNames: []*string{
			jsii.String("my-agent.default"),
		},
	}),
})
```

## Properties

- `dataSource`: [DataSourceConfig](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.DataSourceConfig.html) (required) — The data source configuration that specifies where to read agent traces from.

- `description`: string — The description of the online evaluation configuration.

  **Default:** No description

- `evaluators`: [EvaluatorReference](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.EvaluatorReference.html)[] (required) — The list of evaluators to apply during online evaluation.

  Can include both built-in evaluators and custom evaluators.

- `executionRole`: [IRole](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — The IAM role that provides permissions for the evaluation to access AWS services.

  **Default:** A new role will be created

  If not provided, a role will be created automatically with the required permissions
  including cross-region Bedrock model invocation (to support cross-region inference
  profiles). For strict cost controls or data residency compliance, provide a custom
  role with region-scoped permissions.

- `executionStatus`: [ExecutionStatus](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.ExecutionStatus.html) = ExecutionStatus.ENABLED — The execution status of the online evaluation configuration.

  Controls whether the evaluation actively processes agent traces.

- `filters`: [FilterConfig](https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-bedrock-agentcore-alpha.FilterConfig.html)[] — The list of filters that determine which agent traces should be evaluated.

  **Default:** No filters (evaluate all sampled traces)

- `onlineEvaluationConfigName`: string (required) — The name of the online evaluation configuration.

  Must be unique within your account. Valid characters are a-z, A-Z, 0-9, _ (underscore).
  Must start with a letter and can be up to 48 characters long.

- `samplingPercentage`: number = 10 — The percentage of agent traces to sample for evaluation.

- `sessionTimeout`: [Duration](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.minutes(15) — The duration of inactivity after which an agent session is considered complete and ready for evaluation.

  Must be between 1 minute and 1440 minutes (24 hours).

- `tags`: { [key: string]: string } — Tags for the online evaluation configuration.

  **Default:** No tags

  A list of key:value pairs of tags to apply to this OnlineEvaluationConfig resource.
