Skip to content

feat(project): add --model-provider to project add evaluator llm-as-a-judge - #2298

Open
jariy17 wants to merge 1 commit into
refactorfrom
model-provider-project
Open

jariy17 wants to merge 1 commit into
refactorfrom
model-provider-project

Conversation

@jariy17

@jariy17 jariy17 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

What

Adds --model-provider (Bedrock default / OpenResponses) to agentcore project add evaluator llm-as-a-judge, so a project can declare an OpenResponses judge alongside the existing Bedrock one.

Part 1 of 2. PR 2 (stacked) adds the same to the imperative eval evaluator llm-as-a-judge create/update commands and makes updates provider-safe.

Changes

  • Schema (src/projectSchemas/evaluator.ts): EvaluatorModelProviderSchema (Bedrock | OpenResponses), a provider-neutral EvaluatorModelIdSchema, isValidOpenResponsesModelId, and an optional modelProvider on LlmAsAJudgeConfigSchema.
  • Handler (project add evaluator llm-as-a-judge): --model-provider flag, defaults to Bedrock, validates the model per resolved provider, and persists modelProvider only for OpenResponses.

Compatibility

  • Bedrock stays the default and remains implicit in agentcore.json — existing Bedrock projects require no changes.
  • OpenResponses model IDs are validated as non-empty printable identifiers without spaces (no hard-coded catalog).

Verification

  • bun test src/projectSchemas/evaluator.test.ts + .../add/evaluator/llm-as-a-judge/index.test.ts — 30 pass.
  • bun run typecheck + bun run lint:check clean.
  • --help lists Bedrock (default) and OpenResponses.

Bug-bash recording against the explore account to follow in a comment.

@github-actions github-actions Bot added the size/m PR size: M label Sep 14, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added agentcore-harness-reviewing AgentCore Harness review in progress claude-security-reviewing Claude Code /security-review in progress 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

@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: Changes requested

Main issue: OpenResponses cannot actually be deployed

This PR teaches the CLI to accept --model-provider OpenResponses and persist modelProvider: "OpenResponses" into agentcore.json, but the deployment path in aws/agentcore-l3-cdk-constructs doesn't know about this field:

  • src/schema/schemas/primitives/evaluator.tsLlmAsAJudgeConfigSchema has no modelProvider field. Default zod objects strip unknown keys, so on deploy the field is silently dropped.
  • src/cdk/constructs/components/primitives/evaluator/AgentCoreEvaluator.ts (around line 92–108) unconditionally emits evaluatorConfig.llmAsAJudge.modelConfig.bedrockEvaluatorModelConfig.modelId = llmAsAJudge.model. There is no OpenResponses branch.

The user-visible consequence is that agentcore add evaluator llm-as-a-judge --model-provider OpenResponses --model openai.gpt-5.4 ... will happily write the project file, but agentcore deploy will pass openai.gpt-5.4 as a Bedrock model ID and CloudFormation will fail (or, worse, silently try to invoke it against Bedrock). There's nothing between the CLI validator and CFN that tells the user the deploy path doesn't support OpenResponses.

Options to fix:

  1. Land the L3 side first (preferred). Add modelProvider to LlmAsAJudgeConfigSchema in agentcore-l3-cdk-constructs, teach AgentCoreEvaluator to select the appropriate modelConfig variant (openResponsesEvaluatorModelConfig/whatever the CFN resource exposes), cut a release, bump the pinned version in the CLI, then merge this PR.
  2. Gate the flag behind the L3 gaining support. Keep the schema change, but have the handler throw InputValidationError for --model-provider OpenResponses with a "not yet supported end-to-end" message until the L3 catches up. Avoids shipping a footgun.
  3. Reject at deploy time. Add a validation step in the deploy flow (e.g. in handlers/project/deploy or the CDK backend's spec check) that fails fast when it encounters llmAsAJudge.modelProvider === "OpenResponses" while the pinned L3 version doesn't support it. Less nice than option 1 or 2 because failure happens later.

Please pick one — as it stands the new flag is functionally advertising a capability the product doesn't have.

Nit-level (not blocking)

Not flagging any of the style items. Tests and validation logic themselves look good and use real temp projects (no fs mocking), matching the harness guidance.

@codecov-commenter

codecov-commenter commented Sep 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.03%. Comparing base (53f13f6) to head (551e07b).

Additional details and impacted files
@@            Coverage Diff            @@
##           refactor    #2298   +/-   ##
=========================================
  Coverage     97.03%   97.03%           
=========================================
  Files           580      580           
  Lines         39630    39659   +29     
=========================================
+ Hits          38453    38482   +29     
  Misses         1177     1177           

☔ 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 commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

Bug bash — project add evaluator (live)

Recorded with the TUI harness in a scratch project.

  • project add evaluator llm-as-a-judge without --model-provider → Bedrock, and modelProvider is absent from agentcore.json (existing Bedrock projects are byte-for-byte unchanged).
  • --model-provider OpenResponses --model openai.gpt-5.4modelProvider: "OpenResponses" persisted explicitly.
  • Verified via a jq view of the written spec: the Bedrock evaluator shows modelProvider: null (key absent), the OpenResponses one shows modelProvider: "OpenResponses".

Validation (--model-provider value, per-provider --model format) is covered by unit tests; invalid combinations are rejected before the spec is touched.

A screen recording of this run is archived internally (Artifactory); it is not linked here because this repository is public.

@jariy17
jariy17 added this pull request to stack #2302 September 14, 2026 22:32
@jariy17
jariy17 marked this pull request as ready for review September 15, 2026 18:41
…-judge

Support choosing the judge model provider on
`agentcore project add evaluator llm-as-a-judge`. Bedrock stays the default
and remains implicit in agentcore.json so existing projects are unchanged;
OpenResponses is persisted explicitly as `modelProvider`.

- Extend the evaluator project schema with EvaluatorModelProviderSchema, a
  provider-neutral model-id schema, and optional modelProvider on
  LlmAsAJudgeConfigSchema (kept optional for backward compatibility).
- Validate the model per resolved provider: Bedrock via isValidBedrockModelId,
  OpenResponses as a non-empty printable identifier without spaces.
@jariy17
jariy17 force-pushed the model-provider-project branch from 82502a8 to 551e07b Compare September 15, 2026 18:41
@github-actions github-actions Bot added size/m PR size: M and removed size/m PR size: M labels Sep 15, 2026
@agentcore-devx-automation agentcore-devx-automation Bot added the claude-security-reviewing Claude Code /security-review in progress label Sep 15, 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 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/m PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants