feat(project): add project add evaluator code-based - #2144
Conversation
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
Small, focused fix that surfaces two real footguns of the code-based evaluator scaffold:
- Empty stub silently returns
Passfor every session (verified againstsrc/assets/evaluators/python-lambda/lambda_function.py, which returnslabel="Pass"). - Managed code-based evaluators aren't yet provisioned by
project deploy.
Logic in index.ts (lines 158–166) matches the commit message: the "returns Pass" note is gated on !hasLambda && !hasMetric, and the "not yet provisioned" note is gated on !hasLambda, so --lambda-arn (external) correctly prints neither.
Tests in index.test.ts use real temp directories via mkdtemp and drive the handler through the router — no excessive mocking — and cover both the stub and external paths. Telemetry isn't warranted here since this only adds informational stderr output, not a new feature.
Nothing blocking.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #2144 +/- ##
============================================
+ Coverage 97.22% 97.24% +0.01%
============================================
Files 507 509 +2
Lines 33809 34009 +200
============================================
+ Hits 32872 33073 +201
+ Misses 937 936 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Claude Security Review: no high-confidence findings. (run) |
303c8db to
9bd7998
Compare
|
Claude Security Review: no high-confidence findings. (run) |
|
Claude Security Review: no high-confidence findings. (run) |
|
Claude Security Review: no high-confidence findings. (run) |
e78e9bc to
32a10ef
Compare
|
Claude Security Review: no high-confidence findings. (run) |
Hweinstock
left a comment
There was a problem hiding this comment.
Looks good, two comments worth thinking about before merging related to the dependency inversion and version pinning.
| # autoevals grades via LiteLLMClient -> Bedrock (Converse); litellm replaces the openai judge | ||
| "litellm>=1.60,<1.85", | ||
| {{else}} | ||
| "openai>=1.0.0", |
There was a problem hiding this comment.
could we use compatible releases or pin this above to avoid the templates breaking on version bumps?
https://packaging.python.org/en/latest/specifications/version-specifiers/#compatible-release
| EVALUATOR_LIBRARIES, | ||
| type EvaluatorLibrary, | ||
| type ManagedEvaluatorScaffoldInput, | ||
| } from "../../../../../core/project/templates/evaluator"; |
There was a problem hiding this comment.
isn't this breaking the dependency inversion? The downside being that we're coupling the UI to the underlying core implementation, which I think the dependency inversion aims to avoid.
There was a problem hiding this comment.
Yeah i missed this completely. Ill fix this.
…(DI) Addresses PR feedback: the handler was importing EVALUATOR_LIBRARIES + ManagedEvaluatorScaffoldInput from core/project/templates, coupling the UI layer to core. Mirror runtime's ScaffoldRuntimeInput placement: define EVALUATOR_LIBRARIES (names) + EvaluatorLibrary + ManagedEvaluatorScaffoldInput in handlers/project/types.ts; templates/evaluator.ts imports those and keeps the asset/timeout map (EVALUATOR_ASSETS). Arrow now points core -> handler-types.
|
Claude Security Review: no high-confidence findings. (run) |
Addresses PR feedback on version pinning. The ported templates left bedrock-agentcore (incl. [deepeval]/[autoevals] extras), openai, and aiobotocore with >= but no upper bound; cap each at the next major so a release bump can't silently break a scaffolded evaluator. deepeval (<3), autoevals (<1), and litellm (<1.85) were already capped.
|
Claude Security Review: no high-confidence findings. (run) |
Addresses PR feedback (parity with the runtime templates, which ship a README). Each README explains the files, how to customize the handler, and that 'project deploy' packages the dir into the evaluator Lambda; rendered through the same handlebars context (Name, EvaluatorClass).
|
Claude Security Review: no high-confidence findings. (run) |
|
Blocking issue: the generated DeepEval scaffold is not currently installable/runnable.
Could we align the DeepEval/AgentCore dependency versions and add a scaffold smoke test that runs |
…ld installs The generated deepeval scaffold was not installable/runnable: - 'uv lock' failed. Our explicit deepeval>=2,<3 pin fought the version the [deepeval] extra owns (4.x), and aiobotocore<3.0.0 excluded the only line (3.x) that accepts the botocore bedrock-agentcore requires. - Without a model the deps resolved but importing the handler failed: the resolved bedrock-agentcore predated third_party.deepeval.DeepEvalAdapter. Raise the floor to 1.20.0 (first release with the deepeval/autoevals adapters), drop the explicit deepeval/autoevals pins so the extras own them, and require aiobotocore 3.x for the Bedrock judge. Verified: uv lock + uv sync + import of the rendered handler now succeed for deepeval(bedrock), autoevals(bedrock), autoevals(default), and the empty stub.
|
Claude Security Review: no high-confidence findings. (run) |
5d5e079 to
220a2f5
Compare
|
Claude Security Review: no high-confidence findings. (run) |
Command structure
agentcore project add evaluator code-based --help:Commits
c4430c03feat — the command + 3 scaffold templates +remove evaluatorbaec1630fix — guardapp/<name>collisions (up-front, no partial writes)e7bc3675fix — validate--metricclass + require a Bedrock--model9bd79980fix — echo the inferred mode + caveats at add time32a10ef9refactor — sharetoPythonPackageNameviafsUtils;DEFAULT_TIMEOUTconst853dcf86refactor — move template knowledge intotemplates/evaluator.ts(runtime layering)Testing
bun run buildOK ·bun test src/handlers/project src/core/project→ 597 pass / 0 fail.AWS::BedrockAgentCore::Evaluator+ Lambda + role + permissions, and generated Pythonast.parses for deepeval + autoevals (bedrock + openai branches). Full report shared separately.