Skip to content

feat: add VPC network mode support#545

Merged
aidandaly24 merged 6 commits into
mainfrom
feat/vpc-mode
Mar 18, 2026
Merged

feat: add VPC network mode support#545
aidandaly24 merged 6 commits into
mainfrom
feat/vpc-mode

Conversation

@tejaskash

Copy link
Copy Markdown
Contributor

Summary

  • Replace PRIVATE network mode with VPC across the full CLI stack
  • Add NetworkConfigSchema with Zod-validated subnet/security group IDs and cross-field .superRefine() enforcement
  • Add --network-mode, --subnets, --security-groups CLI flags to create and add agent commands with shared validation (vpc-utils.ts)
  • Add VPC prompts to both create (GenerateWizard) and BYO (AddAgentScreen) TUI paths with inline subnet/SG format validation
  • Fix AgentPrimitive.tsx to persist VPC config through both handleCreatePath and handleByoPath to agentcore.json
  • Skip Exa AI MCP example endpoint in scaffolded templates when VPC mode is selected (external endpoints unreachable without NAT)
  • Add VPC endpoint warning on completion screens and warnings in dev/invoke commands
  • Extract VPC_ENDPOINT_WARNING constant and parseCommaSeparatedList utility to eliminate duplication

Depends on https://github.com/aws/agentcore-l3-cdk-constructs/pull/80 for CDK construct changes.

Test plan

  • npm run build passes
  • npm test — 489+ tests pass (schema, validation, mapper, vpc-utils, snapshots)
  • TUI create flow: select VPC → prompted for subnets/SGs → invalid format rejected inline → confirm shows VPC fields → agentcore.json contains networkConfig
  • TUI BYO flow: same VPC prompts after model provider → persists correctly
  • Non-interactive: agentcore add agent --name test --network-mode VPC --subnets subnet-12345678 --security-groups sg-12345678 --json works
  • Non-interactive: agentcore add agent --name test --network-mode VPC --json fails with missing subnets error
  • VPC template: scaffolded mcp_client/client.py contains stub returning None, not Exa endpoint
  • PUBLIC template: scaffolded mcp_client/client.py still contains Exa example
  • agentcore dev with VPC agent shows local dev warning

Replace the PRIVATE network mode placeholder with VPC across the full
CLI stack: schema validation, TUI wizards, CLI flags, template rendering,
and CDK config persistence.

Schema:
- NetworkModeSchema enum: PUBLIC | PRIVATE → PUBLIC | VPC
- Add NetworkConfigSchema with subnet/security group ID validation
- Cross-field superRefine: VPC requires networkConfig, non-VPC forbids it

CLI flags:
- Add --network-mode, --subnets, --security-groups to create and add agent
- Shared vpc-utils.ts with parseCommaSeparatedList, validateVpcOptions,
  validateSubnetIds, validateSecurityGroupIds, and VPC_ENDPOINT_WARNING

TUI:
- VPC prompts in both create (GenerateWizard) and BYO (AddAgentScreen) paths
- Inline validation for subnet/SG ID format in TextInput fields
- VPC endpoint warning on completion screens

Template rendering:
- Add isVpc flag to AgentRenderConfig
- Skip Exa AI MCP example endpoint in VPC mode (unreachable without NAT)
- VPC stubs return None/empty so main.py null-checks work unchanged

Data persistence:
- AgentPrimitive passes VPC config through both handleCreatePath and
  handleByoPath to agentcore.json
- useAddAgent mappers (mapByoConfigToAgent, mapAddAgentConfigToGenerateConfig)
  thread VPC fields through TUI path

Warnings:
- dev command warns about VPC behavior differences in local mode
- invoke command warns about VPC endpoint requirements
@tejaskash tejaskash requested a review from a team March 13, 2026 18:01
@github-actions github-actions Bot added the size/xl PR size: XL label Mar 13, 2026
Comment thread src/assets/python/autogen/base/mcp_client/client.py Dismissed
@github-actions github-actions Bot removed the size/xl PR size: XL label Mar 13, 2026
@github-actions github-actions Bot added the size/xl PR size: XL label Mar 13, 2026
@github-actions

github-actions Bot commented Mar 13, 2026

Copy link
Copy Markdown
Contributor

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 43.14% 3886 / 9006
🔵 Statements 42.76% 4105 / 9599
🔵 Functions 44.59% 759 / 1702
🔵 Branches 45.31% 2599 / 5735
Generated in workflow #988 for commit ae26065 by the Vitest Coverage Report Action

Comment thread src/cli/commands/shared/vpc-utils.ts
The original VPC commit accidentally replaced three test files instead
of appending to them. This restores all existing tests from main and
adds VPC-specific tests at the end of each file.
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Mar 13, 2026
Comment thread src/cli/tui/screens/agent/types.ts
aidandaly24
aidandaly24 previously approved these changes Mar 13, 2026

@aidandaly24 aidandaly24 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.

Really clean PR, I have one small nit but it is not a necessary update for this PR. LGTM

…pcOptions type

- validateVpcOptions now calls validateSubnetIds/validateSecurityGroupIds
  so the non-interactive CLI path gives friendly format errors instead of
  falling through to Zod regex failures
- CreateOptions, AddAgentOptions, and AgentPrimitive.AddAgentOptions now
  extend VpcOptions instead of redeclaring networkMode/subnets/securityGroups
@github-actions github-actions Bot removed the size/xl PR size: XL label Mar 13, 2026
@github-actions github-actions Bot added the size/xl PR size: XL label Mar 13, 2026
aidandaly24
aidandaly24 previously approved these changes Mar 13, 2026
The non-interactive CLI paths had VPC warnings but the TUI screens did not.
- DevScreen: warn that local dev runs outside VPC
- InvokeScreen: warn about VPC endpoint requirements
- Thread networkMode through useInvokeFlow config
@github-actions github-actions Bot added size/xl PR size: XL and removed size/xl PR size: XL labels Mar 17, 2026
The GenerateWizard collected networkMode/subnets/securityGroups but
useCreateFlow did not include them when building the GenerateConfig,
so agents created via TUI always defaulted to PUBLIC.
@github-actions github-actions Bot removed the size/xl PR size: XL label Mar 17, 2026
@github-actions github-actions Bot added the size/xl PR size: XL label Mar 17, 2026

@aidandaly24 aidandaly24 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.

Thanks for making the update to add the warning. LGTM, approved.

@aidandaly24 aidandaly24 merged commit a61ebdd into main Mar 18, 2026
18 of 19 checks passed
@aidandaly24 aidandaly24 deleted the feat/vpc-mode branch March 18, 2026 15:44
tejaskash added a commit that referenced this pull request Mar 18, 2026
Resolve merge conflicts between protocol mode and VPC network mode
features. Both feature sets are preserved: protocol (HTTP/MCP/A2A)
and network mode (PUBLIC/VPC with subnets/securityGroups).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xl PR size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants