Skip to content

feat(evaluator): add derived evaluators (reuse a base metric on your own model) - #2015

Open
jariy17 wants to merge 2 commits into
mainfrom
Dervived_evaluators
Open

feat(evaluator): add derived evaluators (reuse a base metric on your own model)#2015
jariy17 wants to merge 2 commits into
mainfrom
Dervived_evaluators

Conversation

@jariy17

@jariy17 jariy17 commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

What this does — 1 line

agentcore add evaluator --type derived --base-evaluator-id <id> --model <m> — create an evaluator that reuses a managed base metric's prompt/scoring on your own model. The base is a 3P library metric (ThirdParty.<Provider>.<Metric>) or a built-in (Builtin.<Metric>).

Try it

# derive from a 3P metric (level auto-resolves to SESSION)
agentcore add evaluator --name my_tool_use \
  --type derived --base-evaluator-id ThirdParty.DeepEval.ToolUse \
  --model us.anthropic.claude-sonnet-4-6

# derive from a built-in (level auto-resolves to TRACE)
agentcore add evaluator --name my_helpfulness \
  --type derived --base-evaluator-id Builtin.Helpfulness \
  --model us.anthropic.claude-sonnet-4-6

Output:

Added evaluator 'my_tool_use' (derived from ThirdParty.DeepEval.ToolUse evaluator)

add evaluator --help (new options)

  --type <type>              llm-as-a-judge (default) | code-based | derived        ← now includes derived
  --base-evaluator-id <id>   [derived] "ThirdParty.<Provider>.<Metric>" or "Builtin.<Metric>"   ← new
  --level <level>            SESSION | TRACE | TOOL_CALL (auto-resolved from the base for derived)
  --model <model>            [LLM] Bedrock/OpenResponses model; [derived] your judge model

--instructions / --rating-scale / --model-provider are rejected for --type derived (the base owns the prompt + scale).

Additions to agentcore.json

{
  "name": "my_tool_use",
  "level": "SESSION",
  "config": { "derived": { "baseEvaluatorId": "ThirdParty.DeepEval.ToolUse", "model": "us.anthropic.claude-sonnet-4-6" } }
}

How level is set

The API requires the derived evaluator's level to match the base metric's level. The CLI resolves it for you at add time via GetEvaluator(baseEvaluatorId) and bakes it into agentcore.json — you never type it. --level stays available as an offline override.

Changes

  1. schema — new EvaluatorConfig.derived arm { baseEvaluatorId, model }; config is exactly-one-of llmAsAJudge | codeBased | derived; level required for every evaluator.
  2. CLI--type derived + --base-evaluator-id; auto-level via GetEvaluator; derived success message.
  3. telemetryEvaluatorType gains derived.

Verification

  • Schema + primitive unit tests pass; regenerated JSON schema.
  • Verified end-to-end on gamma (us-west-2): both 3P (ThirdParty.DeepEval.ToolUse → SESSION) and built-in (Builtin.Helpfulness → TRACE) auto-resolve their level and write the right config.derived.
  • The add online-eval TUI evaluator picker lists the managed ThirdParty.* evaluators alongside Builtin.*.

Companion CDK change (emits EvaluatorConfig.Derived into the CFN Evaluator): aws/agentcore-l3-cdk-constructs#323

@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 17, 2026
…own model)

Add a 'derived' evaluator config: point at a managed base metric — a 3P
library metric (ThirdParty.<Provider>.<Metric>) or a built-in (Builtin.<Metric>)
— and run its prompt/scoring on your own model.

- schema: new EvaluatorConfig.derived arm { baseEvaluatorId, model };
  EvaluatorConfig is now exactly-one-of llmAsAJudge | codeBased | derived.
  level is required for every evaluator (must match the base for derived).
- CLI: 'agentcore add evaluator --type derived --base-evaluator-id <id> --model <m>'.
  level is auto-resolved from the base via GetEvaluator at add time (--level
  overrides/offline). --instructions/--rating-scale rejected for derived.
- telemetry: EvaluatorType gains 'derived'.
@jariy17
jariy17 force-pushed the Dervived_evaluators branch from 5e1fa1a to bf0cc80 Compare August 17, 2026 21:06
…-context (#2027)

* fix(evaluator): derived --config handling, region fallback, base-id regex, llm-context

Follow-up fixes from the derived bug bash:
- Reject --config with --type derived instead of silently ignoring it (the
  derived arm ran before the config loader).
- Resolve the base metric's region via ConfigIO.resolveRegionFallback so a
  profile-only region works on a fresh project with no saved deploy targets
  (the old path mapped over an empty targets array and dropped the fallback).
- Tighten BASE_EVALUATOR_ID_PATTERN to Builtin.<Metric> / ThirdParty.<Provider>.<Metric>;
  rejects malformed ids (ThirdParty.DeepEval, ThirdParty..ToolUse, trailing dot)
  that --level previously let through.
- Sync llm-compacted schema so generated project guidance includes the derived arm.

* refactor: drop redundant try/catch in region resolution

resolveRegionFallback already checks env vars first and returns undefined
rather than throwing (it's called bare in resolveAWSDeploymentTargets), so the
catch that re-read the env vars was dead.

---------

Co-authored-by: jariy17 <tjariy+jariy17@users.noreply.github.com>
Base automatically changed from bug_bash_aug_18th to main August 19, 2026 19:24
@aidandaly24
aidandaly24 requested a review from a team August 19, 2026 19:24
@github-actions github-actions Bot added the size/m PR size: M label Aug 19, 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.

1 participant