Skip to content

feat: add VPC network mode support#545

Open
tejaskash wants to merge 4 commits intomainfrom
feat/vpc-mode
Open

feat: add VPC network mode support#545
tejaskash wants to merge 4 commits intomainfrom
feat/vpc-mode

Conversation

@tejaskash
Copy link
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
# Add an AgentCore Gateway with `agentcore add gateway`, or configure your own endpoint below.


async def get_streamable_http_mcp_tools() -> List:
@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
Copy link
Contributor

github-actions bot commented Mar 13, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 43.15% 3886 / 9005
🔵 Statements 42.76% 4105 / 9598
🔵 Functions 44.62% 759 / 1701
🔵 Branches 45.31% 2599 / 5735
Generated in workflow #975 for commit 74157e4 by the Vitest Coverage Report Action

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
aidandaly24
aidandaly24 previously approved these changes Mar 13, 2026
Copy link
Contributor

@aidandaly24 aidandaly24 left a comment

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
@tejaskash tejaskash deployed to e2e-testing March 13, 2026 20:26 — with GitHub Actions Active
@github-actions github-actions bot added the size/xl PR size: XL label Mar 13, 2026
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