Create online evaluation
The CreateOnlineEvaluationConfig API creates a new online evaluation configuration that continuously monitors your agent’s performance using live traffic. This asynchronous operation tells the service to evaluate agent traces as they are generated during normal operation.
To create an online evaluation, provide a unique configuration name, choose what to monitor, select up to 10 evaluators, and provide an IAM service role ARN for execution. The data source can be CloudWatch Logs, selected by exact log group names or log group name prefixes, or an agent endpoint. The required enableOnCreate parameter controls the initial executionStatus: true starts the configuration in ENABLED, and false starts it in DISABLED.
Topics
Execution status control
The executionStatus parameter determines whether the evaluation job actively processes traces:
-
ENABLED – The evaluation job runs continuously, processing incoming traces and generating evaluation results.
-
DISABLED – The evaluation configuration exists but the job is paused. No traces are processed or evaluated.
You can control execution status using the CLI:
# Pause a running online evaluation agentcore pause online-eval "your_config_name" # Resume a paused online evaluation agentcore resume online-eval "your_config_name"
Select input log groups
If your data source is CloudWatch Logs, configure dataSourceConfig.cloudWatchLogs in exactly one of these ways:
-
logGroupNames– Provide an explicit list of log group names. -
logGroupNamePrefixes– Provide 1–5 log group name prefixes. The service evaluates traces from any log group whose name starts with one of those prefixes, including matching log groups that are created later.
In either case, set serviceNames so the service can identify your agent’s traces in the selected log groups.
If you use logGroupNamePrefixes to match Amazon Bedrock AgentCore Runtime log groups, make sure your runtime sends spans to the agent’s own log group. For agents that still use the shared aws/spans log group, set UNIFIED_TRACES_DESTINATION_ENABLED=true on the runtime. For more information, see Span destination for agents hosted in Amazon Bedrock AgentCore runtime.
# Match input log groups by prefix instead of exact names dataSourceConfig={ "cloudWatchLogs": { "logGroupNamePrefixes": ["/aws/agentcore/my-agent-"], "serviceNames": ["my_agent.DEFAULT"] } }
For more information about where results and score metrics are written, including dedicated, custom, and source log groups, see Results and output.
Evaluator protection
When you create an evaluation configuration with executionStatus set to ENABLED , the system automatically locks any custom evaluators you’ve selected. Once locked:
-
No modifications allowed – You cannot update the evaluator’s configuration, prompts, or settings. Clone a new evaluator if you need to make changes.
-
No deletion allowed – You cannot delete the evaluator while any evaluation job is using it (running).
Code samples for AgentCore CLI, AgentCore SDK, and AWS SDK
The following code samples demonstrate how to create online evaluation configurations using different development approaches. Choose the method that best fits your development environment and preferences.
Example
Console
You can create online evaluation configurations using the Amazon Bedrock AgentCore console’s visual interface. This method provides guided forms and validation to help you configure your evaluation settings.
To create an AgentCore online evaluation
-
Open the Amazon Bedrock AgentCore console.
-
In the left navigation pane, choose Evaluation.
-
Choose Create evaluation configuration.
-
(Optional) For Evaluation name , enter a name for the online evaluation configuration.
-
(Optional) To enable the evaluation configuration after it’s created, select the checkbox under the evaluation name.
-
(Optional) For Evaluation configuration description , enter a description for the AgentCore evaluation configuration.
-
(Optional) For Session idle timeout , enter a duration between 1 and 60 minutes. The default is 15 minutes.
-
-
For Data source , choose one of the following:
-
Define with an agent endpoint – Choose an agent that you previously created on AgentCore Runtime, or create a new agent by choosing Agents . Then, choose an endpoint from the agent.
-
Select a CloudWatch log group – Select up to 5 log groups. Enter the service name used by your agent for observability. For agents hosted on AgentCore Runtime, service name follows the format <agent-runtime-name>.<agent-runtime-endpoint-name>. For agents running outside AgentCore Runtime, service name is configured in OTEL_RESOURCE_ATTRIBUTES environment variable.
-
-
For Evaluators , select up to 10 evaluators per evaluation configuration, including built-in and custom evaluators.
-
(Optional) For Filters , add up to 5 filters to identify which sessions to evaluate.
-
(Optional) For Sampling , choose a percentage between 0.01% and 100% to control the percentage of sessions that are evaluated. The default is 10%.
-
For Amazon Bedrock IAM role , choose one of the following:
-
Use an existing role – Select an IAM service role that already has the required permissions.
-
Create a new role – Create a new IAM service role.
-
-
Choose Create evaluation configuration to create the AgentCore online evaluation configuration.