feat(project): add online-insight to project add - #2063
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## refactor #2063 +/- ##
============================================
+ Coverage 97.10% 97.12% +0.01%
============================================
Files 384 385 +1
Lines 22683 22790 +107
============================================
+ Hits 22027 22134 +107
Misses 656 656 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| flag("name", "the name of the online insight config", z.string().optional()), | ||
| flag( | ||
| "agent", | ||
| "harness/runtime name whose traffic to sample (mutually exclusive with --log-group-name)", |
There was a problem hiding this comment.
The flag here says "harness/runtime", but looking at the projectSchema I'm pretty sure this will always fail for harness.
ProjectSpecSchema builds agentNames list from spec.runtimes. Harnesses are never read into this list. So when if (config.agent && !agentNames.has(config.agent)) runs, agentNames will never see harnesses and this will always fail.
There was a problem hiding this comment.
Good catch — you're right. Properly supporting a harness target needs changes in the CDK constructs (a harness would have to resolve to its underlying runtime in both the validation set and the log-group derivation), so I've filed aws/agentcore-l3-cdk-constructs#335 to track that.
For now I've narrowed the --agent description to runtime-only so it stops promising harness support that isn't wired up. I've also opened a follow-up PR (#2065) to make the same one-line correction on online-eval.
nborges-aws
left a comment
There was a problem hiding this comment.
One comment to address about harness source for --agent failing validation. PR looks good otherwise
Only runtimes are valid online-eval targets end-to-end: the project superRefine builds agentNames from spec.runtimes, and the CDK construct resolves config.agent against the runtime-only environments map. The prior 'harness/runtime' wording promised harness support no layer implements. Addresses review comment.
Command structure
online-insightis the insights counterpart ofonline-eval(#2048): same schema, sameonlineEvalConfigsarray, same spec key — it fillsinsightsinstead ofevaluatorsand adds--clustering-frequency. Source options are identical (--agentXOR--log-group-name).agentcore.json fields written
Each invocation appends one entry to
onlineEvalConfigs[]inagentcore/agentcore.json:name--nameagent--agentlogGroupNamesendpoint--endpointagentlogGroupNames--log-group-nameagentserviceNames--service-namelogGroupNamesinsights--insightBuiltin.Insight.*or an ARNclusteringConfig.frequencies--clustering-frequencysamplingRate--sampling-ratedescription--descriptionenableOnCreate--enable-on-createtrue/false;falsedeploys the config pausedtags--tagsCross-field rules are enforced by
OnlineEvalConfigSchema(agent XOR log groups, endpoint→agent, serviceNames→log groups, clustering→insights). Insight-ID format (Builtin.Insight.*/ ARN) is validated in the handler.--agentexistence is checked project-wide on the post-writeProjectSpecSchemavalidation inaddResource.Implementation
Mirrors the merged
online-evalPR — 1 new handler + 1 co-located test + 3 small wirings:src/handlers/project/add/online-insight/index.tssrc/handlers/project/add/online-insight/index.test.tsadd/index.ts— register the handlerproject/types.ts— addonline-insighttoAddResourceInputcore/project/manager.tsx— stack into the no-scaffold case +toProjectSpecKeyVerification
tsc --noEmit0 errors;bun test— new suite 15/15, project+manager regression 148/148;prettier --check .clean.AWS::BedrockAgentCore::OnlineEvaluationConfig(Insights wired, ENABLED at sampling 50), a second config deployed paused (--enable-on-create false→ DISABLED), both verified via the control plane and torn down.Related: aws/agentcore-l3-cdk-constructs#335 —
OnlineEvaluationConfigagentresolves runtimes only (harness targets unsupported). The--agenthelp text here says "runtime" to match.