Skip to content

feat(batch-evaluation): add --output-config and rename --qualifier to --endpoint - #2265

Merged
jariy17 merged 4 commits into
refactorfrom
feat/batch-eval-output-config
Sep 14, 2026
Merged

jariy17 merged 4 commits into
refactorfrom
feat/batch-eval-output-config

Conversation

@jariy17

@jariy17 jariy17 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Renamed --qualifier to --endpoint in both agentcore eval batch-evaluation simulate and agentcore eval ondemand simulate to match the other commands' runtime-endpoint flag. This is a breaking rename on both commands. We also introduce --output-config to agentcore eval batch-evaluation simulate and agentcore eval batch-evaluation evaluate so customers can control where their results go (docs).

--help

agentcore eval batch-evaluation evaluate

Usage: agentcore eval batch-evaluation evaluate [options]

evaluate existing sessions service-side (async; returns a job ID)

Configuration:
  --name <name>                              batch evaluation name (must be unique in the account)
  --description <description>                optional description
  --kms-key-arn <kms-key-arn>                KMS key to encrypt evaluation data at rest

Session source (choose exactly one):
  --agent <agent>                            harness ID or Runtime ID whose sessions to use
  --online-eval <online-eval>                use sessions an online-eval config already sampled
  --data-source-config <data-source-config>  the traces to read (JSON DataSourceConfig); escape hatch

Source filters:
  --endpoint <endpoint>                      Runtime endpoint qualifier (default DEFAULT; only with --agent)
  --start-time <start-time>                  window start (ISO-8601, with --end-time)
  --end-time <end-time>                      window end (ISO-8601, with --start-time)
  --session-ids <session-ids...>             specific session IDs (only with --agent)

Evaluation:
  --evaluators <evaluators...>               evaluator ID(s) to apply
  --ground-truth <ground-truth>              expected answers for the sessions (JSON SessionMetadataShape[])

Result output:
  --output-config <output-config>            where results and metrics are written (JSON OutputConfig)

Other options:
  -h, --help                                 display help for command

Global Options:
  --region <region>                          AWS region
  --debug                                    debug logging (default: false)
  --json                                     JSON output (default: false)
  --endpoint-url <endpoint-url>              endpoint URL override

Parameter details:

  --data-source-config (JSON: tagged union object)
      Where sessions and traces are read from, for sources the --agent and
      --online-eval convenience flags cannot express. Only top-level key:
      cloudWatchLogs.

      Accepts inline JSON, file://<path>, or - to read stdin.

      JSON syntax:
        {
          "cloudWatchLogs": {
            "logGroupNames": ["string", ...],  // [required] groups holding the traces
            "serviceNames": ["string", ...],   // e.g. "my_agent.DEFAULT"
            "filterConfig": {
              "sessionIds": ["string", ...],
              "timeRange": {
                "startTime": "timestamp",
                "endTime": "timestamp"
              }
            }
          }
        }

      API reference:
        https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_DataSourceConfig.html

      Example:
        --data-source-config '{"cloudWatchLogs":{"logGroupNames":["/aws/bedrock-agentcore/runtimes/support_agent-AbC123XyZ9-DEFAULT"],"serviceNames":["support_agent.DEFAULT"],"filterConfig":{"sessionIds":["session-123"]}}}'

  --ground-truth (JSON: list of objects)
      Expected answers for the sessions being evaluated, so an evaluator can score a
      response against a reference instead of judging it on its own. Each entry names
      one session; omit an entry for a session that has no reference answer.

      Accepts inline JSON, file://<path>, or - to read stdin.

      JSON syntax:
        [
          {
            "sessionId": "string",              // [required] the session this applies to
            "testScenarioId": "string",         // groups sessions replaying one scenario
            "groundTruth": {                    // exactly one key; only inline today
              "inline": {
                "turns": [                      // the expected exchange, in order
                  {
                    "input": { "prompt": "string" },
                    "expectedResponse": { "text": "string" }
                  },
                  ...
                ],
                "assertions": [                 // statements the response must satisfy
                  { "text": "string" },
                  ...
                ],
                "expectedTrajectory": {
                  "toolNames": ["string", ...]  // tools the agent should have called
                }
              }
            },
            "metadata": { "string": "string", ... }
          },
          ...
        ]

      Example:
        --ground-truth '[{"sessionId":"session-123","groundTruth":{"inline":{"turns":[{"input":{"prompt":"Where is my order?"},"expectedResponse":{"text":"It shipped on Tuesday."}}]}}}]'

        --ground-truth file://ground-truth.json

  --output-config (JSON: tagged union object)
      Where evaluation results and metrics are written. Omit it and results go to the
      service-managed default location. Only top-level key: cloudWatchConfig.

      Accepts inline JSON, file://<path>, or - to read stdin.

      JSON syntax:
        {
          "cloudWatchConfig": {
            "logGroupName": "string",      // result log group; omit for
                                           // SOURCE_LOG_GROUP, and it cannot sit
                                           // under /aws/bedrock-agentcore/evaluations/
            "logStreamName": "string",     // result log stream
            "metricsNamespace": "string",  // defaults to
                                           // Bedrock-AgentCore/Evaluations; cannot
                                           // begin with "AWS/"
            "resultDestination": "DEDICATED_LOG_GROUP" | "SOURCE_LOG_GROUP"
                                           // DEDICATED_LOG_GROUP (default) writes to
                                           // a dedicated result group;
                                           // SOURCE_LOG_GROUP writes back to the log
                                           // group the traces were read from
          }
        }

      API reference:
        https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_OutputConfig.html

      Example:
        --output-config '{"cloudWatchConfig":{"logGroupName":"/company/agent-evaluations","metricsNamespace":"Company/AgentEvaluations","resultDestination":"DEDICATED_LOG_GROUP"}}'

agentcore eval batch-evaluation simulate

Usage: agentcore eval batch-evaluation simulate [options]

replay a dataset against a Runtime, then batch-evaluate the resulting sessions

Runtime invocation:
  --runtime-id <runtime-id>                Runtime ID to invoke per scenario
  --endpoint <endpoint>                    Runtime endpoint qualifier (default DEFAULT)
  --payload-template <payload-template>    request body per example (JSON object); {input} is replaced with the input
  --header <header...>                     an ordered application header (repeatable)
  --bearer-token <bearer-token>            CUSTOM_JWT bearer token (for JWT-auth Runtimes)
  --user-id <user-id>                      Runtime user ID

Dataset:
  --dataset <dataset>                      dataset source: local JSONL path or a dataset ID
  --dataset-version <dataset-version>      dataset version (with a dataset ID)
  --ingestion-wait-ms <ingestion-wait-ms>  ms to wait for span ingestion before grading (default 180000; 0 to skip)

Configuration:
  --name <name>                            batch evaluation name (unique in the account)
  --description <description>              description for the batch evaluation
  --kms-key-arn <kms-key-arn>              KMS key to encrypt evaluation data at rest

Evaluation:
  --evaluators <evaluators...>             evaluator ID(s) to apply

Result output:
  --output-config <output-config>          where results and metrics are written (JSON OutputConfig)

Other options:
  -h, --help                               display help for command

Global Options:
  --region <region>                        AWS region
  --debug                                  debug logging (default: false)
  --json                                   JSON output (default: false)
  --endpoint-url <endpoint-url>            endpoint URL override

Parameter details:

  --payload-template (JSON object)
      The request body sent to the Runtime for each dataset example. Every occurrence
      of {input} is replaced with that example's input, so the template describes the
      shape your agent expects and {input} marks where the prompt goes.

      Example:
        --payload-template '{"prompt":"{input}"}'

        --payload-template '{"messages":[{"role":"user","content":"{input}"}],"stream":false}'

  --output-config (JSON: tagged union object)
      Where evaluation results and metrics are written. Omit it and results go to the
      service-managed default location. Only top-level key: cloudWatchConfig.

      Accepts inline JSON, file://<path>, or - to read stdin.

      JSON syntax:
        {
          "cloudWatchConfig": {
            "logGroupName": "string",      // result log group; omit for
                                           // SOURCE_LOG_GROUP, and it cannot sit
                                           // under /aws/bedrock-agentcore/evaluations/
            "logStreamName": "string",     // result log stream
            "metricsNamespace": "string",  // defaults to
                                           // Bedrock-AgentCore/Evaluations; cannot
                                           // begin with "AWS/"
            "resultDestination": "DEDICATED_LOG_GROUP" | "SOURCE_LOG_GROUP"
                                           // DEDICATED_LOG_GROUP (default) writes to
                                           // a dedicated result group;
                                           // SOURCE_LOG_GROUP writes back to the log
                                           // group the traces were read from
          }
        }

      API reference:
        https://docs.aws.amazon.com/bedrock-agentcore/latest/APIReference/API_OutputConfig.html

      Example:
        --output-config '{"cloudWatchConfig":{"logGroupName":"/company/agent-evaluations","metricsNamespace":"Company/AgentEvaluations","resultDestination":"DEDICATED_LOG_GROUP"}}'

@github-actions github-actions Bot added the size/l PR size: L label Sep 9, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Sep 9, 2026

@agentcore-devx-automation agentcore-devx-automation Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AgentCore Harness Review

Verdict: Looks good

Nice, well-scoped PR. The three changes are cleanly separated, the tests cover each layer where it can fail (handler, SessionSource timestamp parsing, and — deliberately — the Core→SDK seam that the TestCoreClient and fixture suites can't cover), and the "resolve --output-config before any Runtime invocation" ordering in simulate is exactly the right call for a command that bills per example. The BatchOutputConfig module and long-form parameter help follow existing conventions and are appropriately API-shaped.

No blocking issues. A couple of small notes, take or leave:

  • eval ondemand simulate still uses --qualifier (src/handlers/eval/ondemand/simulate/index.tsx:19,69,92). The PR body justifies the rename by aligning simulate with its own command family (eval), but this sibling command in the same family is left inconsistent. If it's intentionally deferred, a follow-up TODO/issue reference would help; otherwise consider renaming it in the same breaking change so users only see one flag flip.
  • Timestamp regex accepts HH:MM with no seconds (sessionSource.tsx:171) — that's fine and matches ISO-8601, but the error message example (2026-09-01T00:00:00Z) and all tests use the seconds form; worth confirming 2026-09-01T00:00Z is intentionally allowed (looks like it is, and it's a superset of what customers will type).

Live verification, mutation-testing notes, and the explanation for the new src/core/eval.test.ts file (the gap between handler-level TestCoreClient assertions and re-record-only fixture assertions) are all appreciated.

@jariy17
jariy17 added this pull request to stack #2270 September 10, 2026 15:43
@jariy17
jariy17 force-pushed the feat/batch-eval-output-config branch from 73e7c29 to 2a11a5b Compare September 10, 2026 15:53
@github-actions github-actions Bot added size/l PR size: L and removed size/l PR size: L labels Sep 10, 2026
@codecov-commenter

codecov-commenter commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.07%. Comparing base (df85f30) to head (8ab7dd6).
⚠️ Report is 1 commits behind head on refactor.

Additional details and impacted files
@@            Coverage Diff            @@
##           refactor    #2265   +/-   ##
=========================================
  Coverage     97.07%   97.07%           
=========================================
  Files           571      572    +1     
  Lines         39442    39478   +36     
=========================================
+ Hits          38287    38323   +36     
  Misses         1155     1155           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jariy17
jariy17 force-pushed the feat/batch-eval-output-config branch from 2a11a5b to ccd369d Compare September 10, 2026 17:07
@github-actions github-actions Bot added size/l PR size: L and removed size/l PR size: L labels Sep 10, 2026
Comment thread src/core/eval.test.ts Outdated
import { createSilentLogger } from "../testing";
import type { OutputConfig } from "@aws-sdk/client-bedrock-agentcore";

// The TestCoreClient suites assert what a handler hands to Core; the fixture

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use Golden tests.

@jariy17
jariy17 force-pushed the feat/batch-eval-output-config branch from ccd369d to 290780f Compare September 10, 2026 23:23
@github-actions github-actions Bot added size/m PR size: M and removed size/l PR size: L size/m PR size: M labels Sep 10, 2026
@@ -97,6 +99,8 @@ export const createSimulateBatchEvaluationHandler = (core: Core, _io: AppIO) =>

// Ctrl-C aborts the run (invokes, the ingestion wait, the dataset download).
// TODO(#1986): swap for the shared SIGINT/abort helper once it merges.

@jariy17 jariy17 Sep 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll fix this TODO later in a follow up PR.

Example:
--output-config '{"cloudWatchConfig":{"logGroupName":"/company/agent-evaluations","metricsNamespace":"Company/AgentEvaluations","resultDestination":"DEDICATED_LOG_GROUP"}}'`;

const RESULT_OUTPUT = "Result output:";

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need this

Comment thread src/handlers/eval/types.tsx Outdated
// Already-parsed --ground-truth (SessionMetadataShape[]) → evaluationMetadata.
groundTruth?: SessionMetadataShape[];
kmsKeyArn?: string;
// Already-parsed --output-config, forwarded to the request untouched. Left

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this code comment

@jariy17
jariy17 force-pushed the feat/batch-eval-output-config branch from 290780f to 7a95dc7 Compare September 11, 2026 17:16
@github-actions github-actions Bot added the size/xl PR size: XL label Sep 14, 2026
@jariy17
jariy17 marked this pull request as ready for review September 14, 2026 18:22
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Sep 14, 2026

@notgitika notgitika left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks solid! my agent found some bugs that I added in the comments.

apart from this, the PR title still mentions requiring timestamp timezones, but the current diff and commit msg say that change was dropped. lets update the PR title

] as const;

static async resolve(value: string | undefined, io: AppIO): Promise<OutputConfig | undefined> {
const resolver = new SourceResolver({ stdin: io.stdin });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SourceResolver owns the one-stdin-option guard, but this creates a new instance separate from the resolvers used by SessionSource and --ground-truth in evaluate. With --ground-truth - --output-config - (or --data-source-config - --output-config -), the first option drains stdin and this one receives an empty string instead of reporting the conflict. Could we share one resolver or prevalidate that only one option uses stdin, and add a regression test?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will share one resolved then and I'll add a regression test!

Comment thread bun.lock Outdated
"@aws-sdk/client-bedrock-agent": ["@aws-sdk/client-bedrock-agent@3.1121.0", "", { "dependencies": { "@aws-sdk/core": "^3.977.9", "@aws-sdk/credential-provider-node": "^3.972.81", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-RAjn1g6X+u4WwnuwxYU8sKna5q1waTBCM+kzXWAvxSaNbgRsXFL6ZylPjOl0qCDZ7x6aVTj7Jb7Q0z6DZifP3w=="],

"@aws-sdk/client-bedrock-agentcore": ["@aws-sdk/client-bedrock-agentcore@3.1131.0", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/credential-provider-node": "^3.972.83", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-xyPxp33VylkesNriC2WOJMkYmj0BX7borAUMojWg/sFcoTyEU0KVs0U6bElZkq7X46/1w6w3hhSGrMVEti7RcA=="],
"@aws-sdk/client-bedrock-agentcore": ["@aws-sdk/client-bedrock-agentcore@3.1130.0", "", { "dependencies": { "@aws-sdk/core": "^3.978.0", "@aws-sdk/credential-provider-node": "^3.972.83", "@aws-sdk/types": "^3.974.5", "@smithy/core": "^3.33.3", "@smithy/fetch-http-handler": "^5.7.2", "@smithy/node-http-handler": "^4.11.3", "@smithy/types": "^4.17.2", "tslib": "^2.6.2" } }, "sha512-HgHR24kDJwRN9NNrtWNeuyrJZgl0nXOikeeD2HBAprsRXFl3tvZQw6hHOADHR41sjT4z3+SmqIqN5U7JiaF40Q=="],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This downgrades @aws-sdk/client-bedrock-agentcore from 3.1131.0 to 3.1130.0, and the control client is downgraded on the next entry as well, while package.json is unchanged. Could we regenerate the lockfile or otherwise preserve the parent branch's 3.1131.0 resolutions to avoid an unrelated dependency regression?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

flags: [
flag("runtime-id", "Runtime ID to invoke per scenario", z.string().optional()),
flag("qualifier", "Runtime endpoint qualifier (default DEFAULT)", z.string().optional()),
flag("endpoint", "Runtime endpoint qualifier (default DEFAULT)", z.string().optional()),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also makes the breaking --qualifier--endpoint rename for on-demand simulate, while the PR description only calls out batch-evaluation simulate. Please document both affected commands. Should we retain --qualifier as a deprecated alias to avoid breaking existing scripts?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update the PR description and we haven't released the CLI to the public so it's okay to make breaking changes :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah makes sense to me I think we wanted to use --endpoint anyway AFAIK but I wanted to just point it out

Base automatically changed from feat/eval-cli-router-groups to refactor September 14, 2026 18:45
jariy17 added 2 commits September 14, 2026 14:45
… --endpoint

--output-config lets a customer say where results and metrics are written
instead of taking the service-managed default. An API-shaped passthrough:
BatchOutputConfig resolves inline JSON, file://, or stdin and hands the parsed
object to StartBatchEvaluation with field names and nested values untouched.
Field documentation goes in the flag's `help:` block, rendered under "Parameter
details".

`simulate --qualifier` becomes `--endpoint`, matching SessionSource, which has
always called the same concept --endpoint. The InvokeDatasetInput field stays
`qualifier` — that is the Runtime API's name, not ours.

simulate resolves --output-config before invoking the Runtime, since the replay
bills the customer per dataset example and malformed JSON must not surface only
after the whole run.

Dependencies move to @aws-sdk/client-bedrock-agentcore 3.1129.0, the first
release exposing request-side outputConfig on StartBatchEvaluationRequest. The
generated type is used directly; no cast papers over an older model.

src/core/eval.test.ts covers the seam the other suites miss: the TestCoreClient
suites assert what a handler hands to Core, and the fixture suites need an
account to re-record. Deleting Core's outputConfig forwarding passed every test
until this one existed.

Timestamp handling is unchanged. An earlier revision required an explicit
timezone on --start-time/--end-time; that is a breaking change and has been
dropped.
The aws/spans log group holding trace data has 30-day retention, so the
previous window (2026-08-12/13) aged out and StartQuery failed with
MalformedQueryException on replay. Re-recorded against two sessions invoked
within the retention window and bumped FIXTURE_SESSION_IDS/WINDOW together.
@jariy17
jariy17 force-pushed the feat/batch-eval-output-config branch from 599ca0f to 03e5003 Compare September 14, 2026 18:45
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Sep 14, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Sep 14, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Sep 14, 2026
jariy17 added 2 commits September 14, 2026 19:35
…lags

Each stdin-capable flag built its own SourceResolver, so the resolver's
one-stdin guard never fired across options. With --ground-truth - --output-config -
the first drained stdin and the second read an empty string instead of reporting
the conflict. Thread one resolver through SessionSource.resolve and
BatchOutputConfig.resolve on evaluate/simulate/batch-insights so the guard covers
every flag. Adds a regression test.
A rebase re-resolved @aws-sdk/client-bedrock-agentcore and its control client
down to 3.1130.0 while package.json stayed at ^3.1129.0, downgrading against the
base branch. Restore the 3.1131.0 resolutions refactor already uses.
@jariy17 jariy17 changed the title feat(batch-evaluation): add --output-config, rename --qualifier to --endpoint, require timestamp timezones feat(batch-evaluation): add --output-config and rename --qualifier to --endpoint Sep 14, 2026
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Sep 14, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Sep 14, 2026
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Sep 14, 2026
@agentcore-devx-automation

Copy link
Copy Markdown
Contributor

Claude Security Review: no high-confidence findings. (run)

@agentcore-devx-automation agentcore-devx-automation Bot removed the claude-security-reviewing Claude Code /security-review in progress label Sep 14, 2026

@notgitika notgitika left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the comments LGTM!

@nborges-aws nborges-aws left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR LGTM after fixes. Thanks!

@jariy17
jariy17 merged commit e7a7aae into refactor Sep 14, 2026
30 checks passed
@jariy17
jariy17 deleted the feat/batch-eval-output-config branch September 14, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xl PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants