OnlineEvaluationConfig

class aws_cdk.aws_bedrock_agentcore_alpha.OnlineEvaluationConfig(scope, id, *, data_source, evaluators, tags=None, online_evaluation_config_name, description=None, execution_role=None, execution_status=None, filters=None, sampling_percentage=None, session_timeout=None)

Bases: OnlineEvaluationBase

(experimental) 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.

Stability:

experimental

Resource:

AWS::BedrockAgentCore::OnlineEvaluationConfig

Example:

# Basic usage with built-in evaluators
evaluation = agentcore.OnlineEvaluationConfig(self, "MyEvaluation",
    online_evaluation_config_name="my_evaluation",
    evaluators=[
        agentcore.EvaluatorReference.builtin(agentcore.BuiltinEvaluator.HELPFULNESS),
        agentcore.EvaluatorReference.builtin(agentcore.BuiltinEvaluator.CORRECTNESS)
    ],
    data_source=agentcore.DataSourceConfig.from_cloud_watch_logs(
        log_group_names=["/aws/bedrock-agentcore/my-agent"],
        service_names=["my-agent.default"]
    )
)
Parameters:
  • scope (Construct)

  • id (str)

  • data_source (DataSourceConfig) – (experimental) The data source configuration that specifies where to read agent traces from.

  • evaluators (Sequence[EvaluatorReference]) – (experimental) The list of evaluators to apply during online evaluation. Can include both built-in evaluators and custom evaluators.

  • tags (Optional[Mapping[str, str]]) – (experimental) Tags for the online evaluation configuration. A list of key:value pairs of tags to apply to this OnlineEvaluationConfig resource. Default: - No tags

  • online_evaluation_config_name (str) – (experimental) 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 (Optional[str]) – (experimental) The description of the online evaluation configuration. Default: - No description

  • execution_role (Optional[IRole]) – (experimental) 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. Default: - A new role will be created

  • execution_status (Optional[ExecutionStatus]) – (experimental) The execution status of the online evaluation configuration. Controls whether the evaluation actively processes agent traces. Default: ExecutionStatus.ENABLED

  • filters (Optional[Sequence[Union[FilterConfig, Dict[str, Any]]]]) – (experimental) The list of filters that determine which agent traces should be evaluated. Default: - No filters (evaluate all sampled traces)

  • sampling_percentage (Union[int, float, None]) – (experimental) The percentage of agent traces to sample for evaluation. Default: 10

  • session_timeout (Optional[Duration]) – (experimental) 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). Default: Duration.minutes(15)

Stability:

experimental

Methods

apply_removal_policy(policy)

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).

Parameters:

policy (RemovalPolicy)

Return type:

None

grant(grantee, *actions)

(experimental) Grants IAM actions to the IAM Principal.

[disable-awslint:no-grants]

Parameters:
  • grantee (IGrantable) –

    • The IAM principal to grant permissions to.

  • actions (str) –

    • The actions to grant.

Return type:

Grant

Returns:

An IAM Grant object representing the granted permissions

Stability:

experimental

to_string()

Returns a string representation of this construct.

Return type:

str

with_(*mixins)

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.

Parameters:

mixins (IMixin)

Return type:

IConstruct

Attributes

PROPERTY_INJECTION_ID = '@aws-cdk.aws-bedrock-agentcore-alpha.OnlineEvaluationConfig'
created_at

(experimental) The timestamp when the configuration was created.

Stability:

experimental

Attribute:

true

env

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.

execution_role

(experimental) The IAM execution role for the evaluation.

Stability:

experimental

execution_status

(experimental) The execution status of the evaluation (ENABLED or DISABLED).

Stability:

experimental

grant_principal

(experimental) The principal to grant permissions to.

Stability:

experimental

node

The tree node.

online_evaluation_config_arn

(experimental) The ARN of the online evaluation configuration.

Stability:

experimental

Attribute:

true

online_evaluation_config_id

(experimental) The unique identifier of the online evaluation configuration.

Stability:

experimental

Attribute:

true

online_evaluation_config_name

(experimental) The name of the online evaluation configuration.

Stability:

experimental

Attribute:

true

online_evaluation_config_ref

(experimental) A reference to this OnlineEvaluationConfig resource.

Stability:

experimental

stack

The stack in which this resource is defined.

status

(experimental) The lifecycle status of the configuration.

Stability:

experimental

Attribute:

true

updated_at

(experimental) The timestamp when the configuration was last updated.

Stability:

experimental

Attribute:

true

Static Methods

classmethod from_online_evaluation_config_arn(scope, id, online_evaluation_config_arn)

(experimental) Import an existing OnlineEvaluationConfig by its ARN.

Parameters:
  • scope (Construct) –

    • The construct scope.

  • id (str) –

    • Construct identifier.

  • online_evaluation_config_arn (str) –

    • The configuration ARN to import.

Return type:

IOnlineEvaluationConfig

Returns:

An IOnlineEvaluationConfig reference

Stability:

experimental

classmethod from_online_evaluation_config_attributes(scope, id, *, online_evaluation_config_arn, online_evaluation_config_id, online_evaluation_config_name, execution_role_arn=None)

(experimental) Import an existing OnlineEvaluationConfig from its attributes.

Parameters:
  • scope (Construct) –

    • The construct scope.

  • id (str) –

    • Construct identifier.

  • online_evaluation_config_arn (str) – (experimental) The ARN of the online evaluation configuration.

  • online_evaluation_config_id (str) – (experimental) The ID of the online evaluation configuration.

  • online_evaluation_config_name (str) – (experimental) The name of the online evaluation configuration.

  • execution_role_arn (Optional[str]) – (experimental) The ARN of the IAM execution role. Default: - No role ARN provided

Return type:

IOnlineEvaluationConfig

Returns:

An IOnlineEvaluationConfig reference

Stability:

experimental

classmethod from_online_evaluation_config_id(scope, id, online_evaluation_config_id)

(experimental) Import an existing OnlineEvaluationConfig by its ID.

Parameters:
  • scope (Construct) –

    • The construct scope.

  • id (str) –

    • Construct identifier.

  • online_evaluation_config_id (str) –

    • The configuration ID to import.

Return type:

IOnlineEvaluationConfig

Returns:

An IOnlineEvaluationConfig reference

Stability:

experimental

classmethod is_construct(x)

Checks if x is a construct.

Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.

Parameters:

x (Any) – Any object.

Return type:

bool

Returns:

true if x is an object created from a class which extends Construct.

classmethod is_owned_resource(construct)

Returns true if the construct was created by CDK, and false otherwise.

Parameters:

construct (IConstruct)

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct)

Return type:

bool