feat(capacity-provider): complete CLI DevEx for journeys 2-4 (attach, volumes, TUI wizard, J4 delete-session) - #2133
Conversation
…d DevEx polish - J2/J3: attach a runtime to a capacity provider by name or ARN, and mount CP volumes - J4: `capacity-provider delete-session` data-plane command - TUI: full add-capacity-provider wizard (volumes, encryption/KMS, instance profile, lifecycle timeouts); capacity-provider attach in the agent create/template and BYO flows - paired `--volume-name`/`--volume-size` flags (replacing `--volume name:sizeGiB`) - referential-integrity guard: block removing a capacity provider still referenced by a runtime - drop `[preview]` from the capacity-provider add/remove menus Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
- BYO mapper (mapByoConfigToAgent) omits networkMode when a CP is attached —
the AgentEnvSpec schema rejects a capacityProviderConfiguration combined with
any networkMode, so a BYO CP submission was failing to persist.
- delete-session by-name resolution collects all deployed-state matches and
disambiguates by region (resolve within --region; reject cross-region
ambiguity) instead of blindly taking the first target.
- forward capacityProviderConfiguration + volumes through the import path
(executeImportAgent params + AgentPrimitive/useAddAgent/create callers).
- create rejects the capacity-provider name form (a new project has no sibling
to resolve); only an external ARN can attach at create time.
- generate + BYO wizard advanced-settings routing matches the steps memo when
network and capacityProvider are both selected (CP wins; no skipped screen).
- preserve an explicit volumeEncrypted=false in the CP wizard so the primitive
emits Encrypted:false (service default is true).
- tighten CAPACITY_PROVIDER_ARN_PATTERN to {name}-{10 alnum} so malformed
external ARNs fail at validate time (kept in sync with @aws/agentcore-cdk).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Claude Security Review: no high-confidence findings. (run) |
There was a problem hiding this comment.
AgentCore Harness Review
Verdict: Looks good
Nice work — this PR is thorough and well-covered. Highlights I looked at closely:
- Schema invariants (
CapacityProviderConfigurationexactly-one, mutual exclusion withnetworkMode/networkConfig,capacityProviderVolumerequires an attachment, referential integrity for in-project sibling references + volume names inAgentCoreProjectSpecSchema) all have matching tests. resolveDeleteTargetdisambiguates a by-name CP across regions correctly, prefers the ARN-derived region, and never mixes an id from one target with a region from another. Nice guards.- Destructive prompt: refuses to proceed on non-TTY, defaults to N on bare Enter, and requires
--yesfor non-interactive. Session-id and CP-id/ARN validation happen before any network call. - Telemetry is instrumented for
capacity-provider.delete-session, plushas_capacity_provider/capacity_provider_by_arn/cp_volume_mount_countoncreateandadd.agentin both the CLI and TUI paths. - Wizard sequencing:
computeByoSteps/useGenerateWizardcorrectly drop network steps when CP is selected (CP wins), and both the BYO screen'sonSelecthandlers and the TUI dispatch match that precedence — with tests, including the duplicate-menu guard. - Deploy flow:
useDeployFlowwas updated to parse CP outputs so TUI deploys populate deployed-state (needed for the by-name path ofdelete-session). - The
--volume name:sizeGiB→ paired--volume-name/--volume-sizemigration is a breaking flag change, but the PR body calls it out as intentional pre-GA polish (the[preview]label is also being removed in this PR), and the integ tests + snapshots are updated to match.
The PR body notes a merge-order dependency on the L3 constructs PR (@aws/agentcore-cdk pin bump) before capacity-provider deploys work off the pinned version — worth confirming that lands before this ships, but that's an author-flagged coordination item, not a code issue.
No changes requested.
Coverage Report
|
tejaskash
left a comment
There was a problem hiding this comment.
Re-reviewed the clean head after the earlier capacity-provider findings were addressed. The fixes for network-mode exclusivity, regional target resolution, import/create forwarding, wizard routing, explicit false encryption, and ARN validation are present with focused coverage; the broader CI and e2e suites are green.
Description
Completes the AgentCore Capacity Provider feature end to end and brings its DevEx to parity with the rest of the CLI.
This PR carries two commits — the revert-of-revert that restores Journey 1, plus a new commit adding Journeys 2–4 and the DevEx polish — so it delivers the full feature:
add capacity-provider/remove capacity-provider), persisted toagentcore.jsonand synthesized to anAWS::BedrockAgentCore::CapacityProviderCloudFormation resource (VPC, launch parameters, named EBS volumes, lifecycle, auto-created operator role), withdeploy/statusintegration. (Restored here viarevert-of-revert; originally feat(capacity-provider): add capacity-provider resource (Journey 1) #2030, reverted in revert: remove capacity-provider Journey 1 #2045 for release timing.)
add agent --capacity-provider <name-or-arn>), rendered ascapacityProviderConfigurationon the runtime (network configis mutually exclusive and omitted).
--cp-volume-name/--cp-volume-mount-path), routed through the existing filesystem-mount framework.capacity-provider delete-sessiondata-plane command to deprovision a live CP session (destructive confirm,--yes, name/id/ARN resolution).add capacity-providerwizard (named volumes, EBS encryption + KMS key, instance profile, lifecycle timeouts); capacity-provider attach is now available in the agentcreate/template flow (and
agentcore create) as well as the BYO flow.--volume-name/--volume-sizeflags (replacing--volume name:sizeGiB, for consistency with the other paired flags); a referential-integrity guard that blocks removing a capacityprovider still referenced by a runtime; and removal of the
[preview]label from the CP add/remove menus.@aws-sdk/client-bedrock-agentcoreto a version that shipsDeleteCapacityProviderSessionCommand.Related Issue
Closes #
Documentation PR
Type of Change
Testing
How have you tested the change?
npm run test:unitandnpm run test:integnpm run typechecknpm run lintsrc/assets/, I rannpm run test:update-snapshotsand committed the updated snapshotsDetails:
buildCreateAgentConfigmapping, theuseGenerateWizardCP flow, the wizardbuildStepssequencing, and a duplicate-menu guard.add capacity-providerwizard (forward + back-navigation, including encrypt→KMS→back→No), the agent create/template CP attach,agentcore createwith a CP-by-ARN, andthe BYO CP flow.
READY, invoke returned a response,delete-sessiondeprovisioned the session,and teardown removed the stack cleanly.
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.