Skip to content

feat: add protocol mode support (HTTP, MCP, A2A)#550

Merged
notgitika merged 12 commits intomainfrom
protocol-mode-support
Mar 18, 2026
Merged

feat: add protocol mode support (HTTP, MCP, A2A)#550
notgitika merged 12 commits intomainfrom
protocol-mode-support

Conversation

@tejaskash
Copy link
Contributor

@tejaskash tejaskash commented Mar 17, 2026

Summary

Adds protocol mode as a first-class dimension to the agent creation flow. Users can now create HTTP (default), MCP, and A2A agents through both CLI flags and the TUI wizard.

  • Schema: New protocol field on AgentEnvSpec (optional, defaults to HTTP for backwards compat)
  • Templates: Protocol-first directory layout (python/{protocol}/{framework}/). New templates for MCP standalone and A2A (Strands, GoogleADK, LangGraph)
  • TUI wizard: Protocol selection step after build type. MCP skips framework/model/memory steps and jumps to confirm
  • Non-interactive: --protocol flag on create and add agent commands with full validation
  • Validation: Protocol/framework compatibility matrix enforced. MCP rejects --framework, --model-provider, --memory
  • CDK: Companion PR wires protocolConfiguration to CfnRuntime for non-HTTP protocols

AGUI support removed (CDK L1 doesn't support it yet). Can be re-added when L1 is ready.

Test plan

  • Unit tests: 645 targeted tests pass (schema, templates, validation, schema-mapper)
  • agentcore create --name McpTest --protocol MCP --language Python creates MCP standalone project
  • agentcore create --name A2aTest --protocol A2A --framework Strands --model-provider Bedrock --memory none --language Python creates A2A project
  • agentcore add agent --protocol MCP --name McpAgent --language Python in existing project
  • TUI: Create -> Add Agent -> New Agent -> select MCP -> skips framework/model -> confirm works
  • TUI: Protocol step shows HTTP, MCP, A2A options
  • Default (no --protocol) continues to work as HTTP

Add the protocol dimension to all agent creation flows: non-interactive
CLI, TUI wizard, and BYO agent. Each protocol mode routes to the correct
template directory under a new protocol-first layout
(python/{protocol}/{framework}/base/).

Key changes:
- Schema: ProtocolModeSchema, PROTOCOL_FRAMEWORK_MATRIX, helpers
- Templates: restructure under http/, add mcp/, a2a/, agui/ dirs
- Rendering: BaseRenderer uses protocol in template path, new McpRenderer
- CLI: --protocol flag on add agent and create commands with validation
- TUI: protocol step in wizard, conditional framework/model filtering
- Schema mapper: protocolMode passthrough, MCP skips model/memory/creds
- Tests: unit tests for schema, validation, rendering, and mapping
Add create-protocols.test.ts covering MCP, A2A, AGUI, and HTTP create
and add-agent flows. Fix MCP create defaulting undefined model provider
by falling back to Bedrock (no credential needed). Add protocol option
to createTestProject helper.
Previously HTTP agents omitted protocolMode for backwards compatibility.
Now all agents have an explicit protocolMode field set to HTTP, MCP,
A2A, or AGUI. This makes the config self-documenting and consistent.
Align templates with bedrock-agentcore-sdk-python PRs #349 and #350:

A2A templates now use serve_a2a() from bedrock_agentcore.runtime:
- Strands: StrandsA2AExecutor from strands.multiagent.a2a.executor
- GoogleADK: A2aAgentExecutor with Runner + AgentCard from a2a-sdk
- LangGraph: custom AgentExecutor subclass with AgentCard from a2a-sdk
- Dependencies: bedrock-agentcore[a2a], removed uvicorn/langgraph-a2a

AGUI templates now use serve_ag_ui() and AGUIApp from runtime:
- Strands: StrandsAgent from ag_ui_strands + serve_ag_ui()
- GoogleADK: AGUIApp decorator with Runner, yields AG-UI events
- LangGraph: AGUIApp decorator with graph.ainvoke, yields AG-UI events
- Dependencies: bedrock-agentcore[ag-ui], removed uvicorn/fake adapters
- Rename `protocolMode` field to `protocol` in AgentEnvSpec schema and
  all downstream types (GenerateConfig, AddAgentConfig, AgentRenderConfig)
- Remove AGUI protocol support (CDK L1 does not support it yet):
  delete all agui templates, remove from enums/matrix/tests/options
- Fix TUI crash in Add Agent -> New Agent flow: ADD_AGENT_STEP_LABELS
  was missing the 'protocol' step, causing StepIndicator to crash on
  undefined.length
- Pass protocol selection through AddAgentConfig so it isn't silently
  dropped when creating agents via the TUI add-agent flow
- Fix type error in create/validate.ts: capture validated ProtocolMode
  from safeParse instead of using untyped string
@tejaskash tejaskash requested a review from a team March 17, 2026 19:09
@github-actions github-actions bot added the size/xl PR size: XL label Mar 17, 2026
- Remove unnecessary type assertion on cliOptions.protocol
- Remove unused SDK_OPTIONS import from GenerateWizardUI
- Remove unused getSDKOptionsForProtocol import from useGenerateWizard
- Prefix unused destructured variable with underscore in test
- Run prettier on 4 files that failed format check
@github-actions github-actions bot added size/xl PR size: XL and removed size/xl PR size: XL labels Mar 17, 2026
The integration test still referenced the old `protocolMode` field name
instead of `protocol`, and included an AGUI test case that was removed
from the schema.
@github-actions github-actions bot added size/xl PR size: XL and removed size/xl PR size: XL labels Mar 17, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 17, 2026

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 43.19% 3922 / 9080
🔵 Statements 42.8% 4142 / 9677
🔵 Functions 44.5% 762 / 1712
🔵 Branches 45.13% 2641 / 5851
Generated in workflow #993 for commit 6d2aac2 by the Vitest Coverage Report Action

- Add model/__init__.py to all A2A template directories (strands,
  googleadk, langchain_langgraph) matching HTTP template structure
- Move build type validation before MCP early return in create/validate
  so invalid --build values are caught for MCP agents too
- Add clarifying comment for phantom framework/modelProvider defaults
  in MCP path of create/command.tsx
@github-actions github-actions bot added size/xl PR size: XL and removed size/xl PR size: XL labels Mar 17, 2026
Copy link
Contributor

@notgitika notgitika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Few higher level comments:

  1. Make the port differnce between protocols more visible in the readme. So something like MCP template starts on port 8000, A2A templates start on port 9000, HTTP templates use 8080.
  2. BYO agents only have HTTP, is this intentional? Which means I cant bring my own MCP server code. Or are we adding support for all of these protocols there (now or in the future?) If in the future, pls cut an issue to track
  3. The model/load.py and gitignore.template files are identical between a2a/strands/ and http/strands/, a2a/googleadk/ and http/googleadk/, etc. That's a lot of surface area to keep in sync. Maybe future work but can we simplify it? We cna use symlinks or a shared directory for common files, with only main.py and pyproject.toml differing per protocol? This would reduce the blast radius when updating model loading logic.

…ocol

- Add shouldRenderMemory() hook to BaseRenderer, override in McpRenderer
  to return false instead of reimplementing entire render() method
- Make framework/modelProvider optional in CreateWithAgentOptions, resolve
  defaults explicitly in createProjectWithAgent for MCP path
- Make protocol field required in AgentEnvSpecSchema (no backwards compat
  needed per reviewer)
- Update tests for required protocol field
@github-actions github-actions bot added size/xl PR size: XL and removed size/xl PR size: XL labels Mar 18, 2026
Copy link
Contributor Author

@tejaskash tejaskash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed both inline comments:

  1. McpRenderer override → shouldRenderMemory(): Added shouldRenderMemory() hook to BaseRenderer. McpRenderer now just overrides that to return false instead of reimplementing the full render() method.

  2. Phantom defaults: Made framework and modelProvider optional in CreateWithAgentOptions. createProjectWithAgent now explicitly resolves defaults for MCP (Strands/Bedrock placeholders) and non-MCP paths, so the caller no longer silently injects phantom values.

Also made protocol required in AgentEnvSpecSchema (both CLI and CDK) per CDK review feedback.


Re: review-level comments:

  1. Port differences: Each template README already documents its port (MCP: 8000, A2A: 9000, HTTP: 8080). Happy to add a summary table somewhere if you think it's needed.

  2. BYO agents HTTP only: Intentional scope limit for this PR. The non-interactive CLI path (add agent --type byo --protocol MCP) works. TUI BYO + protocol selection is follow-up work — will cut an issue.

  3. File duplication (model/load.py, gitignore): Agreed this is maintenance surface area. Symlinks or a shared base directory would reduce it. Deferring to a follow-up since it's a template restructure orthogonal to protocol support.

jesseturner21
jesseturner21 previously approved these changes Mar 18, 2026
Copy link
Contributor

@jesseturner21 jesseturner21 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approved but will need to fix broken tests at bottom. And need approved from gitika as she requested changes

Making protocol required on AgentEnvSpecSchema means every test fixture
that constructs an AgentCoreRuntime object needs protocol: 'HTTP'.
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).
Local test directory was inadvertently staged during merge commit.
Added to .gitignore to prevent recurrence.
@github-actions github-actions bot added size/xl PR size: XL and removed size/xl PR size: XL labels Mar 18, 2026
@notgitika notgitika self-requested a review March 18, 2026 16:09
Copy link
Contributor

@notgitika notgitika left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, nice work!

Just wanna make sure we are tracking BYO agent using any protocol in the TUI

@notgitika notgitika merged commit 3aaa062 into main Mar 18, 2026
18 of 19 checks passed
@notgitika notgitika deleted the protocol-mode-support branch March 18, 2026 16:15
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.

3 participants