Skip to content

feat: add imperative batch-insights command - #2066

Merged
nborges-aws merged 2 commits into
refactorfrom
batch-eval-insights
Aug 24, 2026
Merged

feat: add imperative batch-insights command#2066
nborges-aws merged 2 commits into
refactorfrom
batch-eval-insights

Conversation

@nborges-aws

@nborges-aws nborges-aws commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Description

Adds imperative batch insights commands for AgentCore evaluations:

  • eval batch-insights run
  • eval batch-insights get
  • eval batch-insights list

Summary of changes

  • run starts a batch eval with the insights field populated; --insight defaults to Builtin.Insight.FailureAnalysis
  • get verifies that the requested batch evaluation contains insights and returns service-provided insight results
  • list filters the shared Batch Evaluation response to entries containing insights and preserves pagination
  • extracts existing batch-evaluation source parsing and validation into a shared sessionSource utility

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Other (please describe):

Testing

Added unit tests along with golden fixture tests (recorded against team AWS account). Also ran manual smoke tests against runtime invocations in my personal account, succeeding on all three added commands.

  • Focused tests: 20 pass, 0 fail
  • bun run typecheck
  • bun run lint:check
  • bun run format:check
  • bun test (1627 pass, 0 fail)

Checklist

  • I have read the CONTRIBUTING document
  • I have added tests that prove the feature works
  • No documentation changes are required for this implementation layer
  • My changes generate no new warnings
  • No dependent asset or snapshot changes are required

Stack created with GitHub Stacks CLIGive Feedback 💬

@github-actions github-actions Bot added agentcore-harness-reviewing AgentCore Harness review in progress and removed agentcore-harness-reviewing AgentCore Harness review in progress labels Aug 21, 2026
@codecov-commenter

codecov-commenter commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.40%. Comparing base (1a297be) to head (883630f).

Additional details and impacted files
@@             Coverage Diff              @@
##           refactor    #2066      +/-   ##
============================================
+ Coverage     97.26%   97.40%   +0.14%     
============================================
  Files           398      403       +5     
  Lines         24194    24321     +127     
============================================
+ Hits          23532    23690     +158     
+ Misses          662      631      -31     

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

Left some comments. Pretty good thou

Comment thread src/core/batchInsights.test.tsx Outdated
import { EvalClient } from "./eval";
import type { AwsClients } from "./types";

describe("EvalClient.startBatchInsights", () => {

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.

We don't need this unit test. This should be captured by handler unit tests

z.string().optional(),
),
flag(
"online-eval",

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.

Can you use online-eval as a data source for batch insight?

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.

yea you can, the API accepts both online-evals and insights together. Current CLI exposes online-eval for insights as well

Comment thread src/handlers/eval/sessionSource.tsx Outdated
import { parseJsonFlag } from "../utils";
import type { SessionSourceValue, SessionWindow } from "./types";

export const sessionSourceFlags = [

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.

Encapsulate this as a class please :)

@jariy17
jariy17 requested a review from notgitika August 24, 2026 15:46

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

Nice! one comment for behavior I just noticed that wasnt introduced here but worth acting upon

description: "list batch insights runs",
flags: [
flag("next-token", "pagination token returned by a previous request", z.string().optional()),
flag("max-results", "maximum number of service items to inspect", z.number().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.

not introduced in this PR but I just wanted to make a note.

since we filter after fetching the page, --max-results is really "items to look at" not "insights returned", so you can get an empty list back with a nextToken still set. Your help text already says as much and pagination still works, so I'm ok with it here. Only calling it out because the TUI builds on this same filter. Do you want a follow-up for server-side filtering down the line? or maybe just open up an issue for polish later

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.

Yeah good call out. Filtering between insights and evals seems to be a recurring theme (same issues are coming up in online-insights / online-evals). I'll take an AI to think through this and polish

@nborges-aws
nborges-aws merged commit 3d8bd3c into refactor Aug 24, 2026
9 checks passed
@nborges-aws
nborges-aws deleted the batch-eval-insights branch August 24, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants