Start batch evaluation
Start a batch evaluation to run evaluators against multiple agent sessions. The service discovers sessions from CloudWatch Logs, runs each evaluator against each session, and produces aggregate results.
Code samples
Example
Request parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
|
|
String |
Yes |
A name for the batch evaluation job. Pattern: starts with a letter, alphanumeric and underscores, max 48 characters. |
|
|
Object |
Yes |
Where to find agent sessions. Specify a |
|
|
List |
Yes |
List of evaluators. Each entry has an |
|
|
Object |
No |
Contains |
|
|
Object |
No |
Optional CloudWatch destination for per-session results and score metrics. Specify a |
|
|
String |
No |
Idempotency token. If you retry a request with the same client token, the service returns the existing job instead of creating a new one. |
Session source
The dataSourceConfig parameter specifies the CloudWatch Logs location where the service discovers agent sessions.
Required fields
| Field | Type | Description |
|---|---|---|
|
|
List of strings (exactly 1) |
The service name that identifies your agent’s traces in CloudWatch. Convention: |
|
|
List of strings (1–5) |
One way to select input log groups. Specify the exact CloudWatch log group names where agent telemetry is stored. Mutually exclusive with |
|
|
List of strings (1–5) |
One way to select input log groups. The service discovers sessions from every log group whose name starts with one of these prefixes, so newly created matching log groups are picked up automatically. Mutually exclusive with |
Specify exactly one of logGroupNames or logGroupNamePrefixes. In both cases, serviceNames is required to identify your agent’s traces within 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/bedrock-agentcore/runtimes/MyAgent-"], "serviceNames": ["MyAgent.DEFAULT"] } }
Optional fields
| Field | Type | Description |
|---|---|---|
|
|
List of strings |
Evaluate only these specific session IDs. When omitted, the service discovers all sessions in the log group. |
|
|
ISO 8601 datetime |
Filter sessions created after this time. |
|
|
ISO 8601 datetime |
Filter sessions created before this time. |
Result output
By default, batch evaluation results go to a dedicated, service-managed log group. Use outputConfig.cloudWatchConfig to control where per-session results are written and which CloudWatch metrics namespace receives evaluation scores.
Choose where results are written
-
DEDICATED_LOG_GROUP(default) – Writes results to a dedicated result log group. If you don’t setlogGroupName, the service manages the group for you. To use your own group, setlogGroupName(see Use a custom output log group). -
SOURCE_LOG_GROUP– Writes results back to the same log group the agent traces were read from. When you use this value, don’t setlogGroupName.
Use a custom output log group
For DEDICATED_LOG_GROUP, set logGroupName to write results to a log group you choose. An existing log group is used as-is; if it doesn’t exist, the service creates it, which requires the execution role to grant logs:CreateLogGroup. The name can’t be under the service-reserved /aws/bedrock-agentcore/evaluations/ namespace, apart from the service-managed default group.
# Write results back to the trace source log group outputConfig={ "cloudWatchConfig": { "resultDestination": "SOURCE_LOG_GROUP" } } # Write results to a custom dedicated log group outputConfig={ "cloudWatchConfig": { "resultDestination": "DEDICATED_LOG_GROUP", "logGroupName": "/my/team/batch-evaluation-results" } }
Publish metrics to a custom namespace
Set metricsNamespace to publish score metrics under your own CloudWatch namespace instead of Bedrock-AgentCore/Evaluations. The value can’t begin with AWS/.
outputConfig={ "cloudWatchConfig": { "metricsNamespace": "MyTeam/Evaluations" } }
Response
| Field | Type | Description |
|---|---|---|
|
|
String |
Unique identifier for the batch evaluation. |
|
|
String |
ARN of the batch evaluation. |
|
|
String |
The name you specified. |
|
|
String |
Initial status. One of: |
|
|
List |
The evaluators used. |
|
|
Timestamp |
When the job was created. |
|
|
Object |
CloudWatch destination for per-session results and score metrics. |
Errors
| Error | HTTP status | Description |
|---|---|---|
|
|
400 |
Invalid request parameters. Check field constraints and required fields. |
|
|
403 |
Insufficient permissions. Verify IAM policies. |
|
|
409 |
A batch evaluation with the same client token already exists with different parameters. |
|
|
429 |
Request rate exceeded. Retry with exponential backoff. |
|
|
500 |
Service-side error. Retry the request. |