class OnlineEvaluationConfig (construct)
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.Bedrock.Agentcore.Alpha.OnlineEvaluationConfig |
Go | github.com/aws/aws-cdk-go/awsbedrockagentcorealpha/v2#OnlineEvaluationConfig |
Java | software.amazon.awscdk.services.bedrock.agentcore.alpha.OnlineEvaluationConfig |
Python | aws_cdk.aws_bedrock_agentcore_alpha.OnlineEvaluationConfig |
TypeScript (source) | @aws-cdk/aws-bedrock-agentcore-alpha ยป OnlineEvaluationConfig |
Implements
IConstruct, IDependable, IResource, IEnvironment, IOnline, IGrantable, IOnline
Online evaluation configuration for Amazon Bedrock AgentCore.
Enables continuous evaluation of agent performance using built-in or custom evaluators. Supports CloudWatch Logs and Agent Endpoint data sources.
Example
// Basic usage with built-in evaluators
const evaluation = new agentcore.OnlineEvaluationConfig(this, 'MyEvaluation', {
onlineEvaluationConfigName: 'my_evaluation',
evaluators: [
agentcore.EvaluatorReference.builtin(agentcore.BuiltinEvaluator.HELPFULNESS),
agentcore.EvaluatorReference.builtin(agentcore.BuiltinEvaluator.CORRECTNESS),
],
dataSource: agentcore.DataSourceConfig.fromCloudWatchLogs({
logGroupNames: ['/aws/bedrock-agentcore/my-agent'],
serviceNames: ['my-agent.default'],
}),
});
Initializer
new OnlineEvaluationConfig(scope: Construct, id: string, props: OnlineEvaluationConfigProps)
Parameters
- scope
Construct - id
string - props
OnlineEvaluation Config Props
Construct Props
| Name | Type | Description |
|---|---|---|
| data | Data | The data source configuration that specifies where to read agent traces from. |
| evaluators | Evaluator[] | The list of evaluators to apply during online evaluation. |
| online | string | The name of the online evaluation configuration. |
| description? | string | The description of the online evaluation configuration. |
| execution | IRole | The IAM role that provides permissions for the evaluation to access AWS services. |
| execution | Execution | The execution status of the online evaluation configuration. |
| filters? | Filter[] | The list of filters that determine which agent traces should be evaluated. |
| sampling | number | The percentage of agent traces to sample for evaluation. |
| session | Duration | The duration of inactivity after which an agent session is considered complete and ready for evaluation. |
dataSource
Type:
Data
The data source configuration that specifies where to read agent traces from.
evaluators
Type:
Evaluator[]
The list of evaluators to apply during online evaluation.
Can include both built-in evaluators and custom evaluators.
onlineEvaluationConfigName
Type:
string
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.
description?
Type:
string
(optional, default: No description)
The description of the online evaluation configuration.
executionRole?
Type:
IRole
(optional, default: A new role will be created)
The IAM role that provides permissions for the evaluation to access AWS services.
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?
Type:
Execution
(optional, default: ExecutionStatus.ENABLED)
The execution status of the online evaluation configuration.
Controls whether the evaluation actively processes agent traces.
filters?
Type:
Filter[]
(optional, default: No filters (evaluate all sampled traces))
The list of filters that determine which agent traces should be evaluated.
samplingPercentage?
Type:
number
(optional, default: 10)
The percentage of agent traces to sample for evaluation.
sessionTimeout?
Type:
Duration
(optional, default: 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).
Properties
| Name | Type | Description |
|---|---|---|
| env | Resource | The environment this resource belongs to. |
| grant | IPrincipal | The principal to grant permissions to. |
| node | Node | The tree node. |
| online | string | The ARN of the online evaluation configuration. |
| online | string | The unique identifier of the online evaluation configuration. |
| online | string | The name of the online evaluation configuration. |
| online | Online | A reference to this OnlineEvaluationConfig resource. |
| stack | Stack | The stack in which this resource is defined. |
| created | string | The timestamp when the configuration was created. |
| execution | IRole | The IAM execution role for the evaluation. |
| execution | string | The execution status of the evaluation (ENABLED or DISABLED). |
| status? | string | The lifecycle status of the configuration. |
| updated | string | The timestamp when the configuration was last updated. |
| static PROPERTY_INJECTION_ID | string | Uniquely identifies this class. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
grantPrincipal
Type:
IPrincipal
The principal to grant permissions to.
node
Type:
Node
The tree node.
onlineEvaluationConfigArn
Type:
string
The ARN of the online evaluation configuration.
onlineEvaluationConfigId
Type:
string
The unique identifier of the online evaluation configuration.
onlineEvaluationConfigName
Type:
string
The name of the online evaluation configuration.
onlineEvaluationConfigRef
Type:
Online
A reference to this OnlineEvaluationConfig resource.
stack
Type:
Stack
The stack in which this resource is defined.
createdAt?
Type:
string
(optional)
The timestamp when the configuration was created.
executionRole?
Type:
IRole
(optional)
The IAM execution role for the evaluation.
executionStatus?
Type:
string
(optional)
The execution status of the evaluation (ENABLED or DISABLED).
status?
Type:
string
(optional)
The lifecycle status of the configuration.
updatedAt?
Type:
string
(optional)
The timestamp when the configuration was last updated.
static PROPERTY_INJECTION_ID
Type:
string
Uniquely identifies this class.
Methods
| Name | Description |
|---|---|
| apply | Apply the given removal policy to this resource. |
| grant(grantee, ...actions) | Grants IAM actions to the IAM Principal. |
| to | Returns a string representation of this construct. |
| with(...mixins) | Applies one or more mixins to this construct. |
| static from | Import an existing OnlineEvaluationConfig by its ARN. |
| static from | Import an existing OnlineEvaluationConfig from its attributes. |
| static from | Import an existing OnlineEvaluationConfig by its ID. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
RemovalPolicy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN).
grant(grantee, ...actions)
public grant(grantee: IGrantable, ...actions: string[]): Grant
Parameters
- grantee
IGrantableโ - The IAM principal to grant permissions to. - actions
stringโ - The actions to grant.
Returns
Grants IAM actions to the IAM Principal.
[disable-awslint:no-grants]
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
with(...mixins)
public with(...mixins: IMixin[]): IConstruct
Parameters
- mixins
IMixin
Returns
Applies one or more mixins to this construct.
Mixins are applied in order. The list of constructs is captured at the
start of the call, so constructs added by a mixin will not be visited.
Use multiple with() calls if subsequent mixins should apply to added
constructs.
static fromOnlineEvaluationConfigArn(scope, id, onlineEvaluationConfigArn)
public static fromOnlineEvaluationConfigArn(scope: Construct, id: string, onlineEvaluationConfigArn: string): IOnlineEvaluationConfig
Parameters
- scope
Constructโ - The construct scope. - id
stringโ - Construct identifier. - onlineEvaluationConfigArn
stringโ - The configuration ARN to import.
Returns
Import an existing OnlineEvaluationConfig by its ARN.
static fromOnlineEvaluationConfigAttributes(scope, id, attrs)
public static fromOnlineEvaluationConfigAttributes(scope: Construct, id: string, attrs: OnlineEvaluationConfigAttributes): IOnlineEvaluationConfig
Parameters
- scope
Constructโ - The construct scope. - id
stringโ - Construct identifier. - attrs
Onlineโ - The configuration attributes.Evaluation Config Attributes
Returns
Import an existing OnlineEvaluationConfig from its attributes.
static fromOnlineEvaluationConfigId(scope, id, onlineEvaluationConfigId)
public static fromOnlineEvaluationConfigId(scope: Construct, id: string, onlineEvaluationConfigId: string): IOnlineEvaluationConfig
Parameters
- scope
Constructโ - The construct scope. - id
stringโ - Construct identifier. - onlineEvaluationConfigId
stringโ - The configuration ID to import.
Returns
Import an existing OnlineEvaluationConfig by its ID.

.NET
Go
Java
Python
TypeScript (