Repository navigation
fix(runtime): allowlist the A2A protocol headers on A2A runtimes - #2982
Open
waitasecant wants to merge 1 commit into
Open
waitasecant wants to merge 1 commit into
waitasecant wants to merge 1 commit into
Conversation
AgentCore Runtime only forwards request headers that are in the runtime's requestHeaderAllowlist, so an A2A server never received A2A-Version or A2A-Extensions. When the protocol is A2A, add both headers to the allowlist in `add runtime` and in the A2A Strands template (case-insensitive, headers the user passed are kept, other protocols are unchanged). Closes aws#2981 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
For an A2A runtime, the CLI now adds the A2A protocol request headers (
A2A-VersionandA2A-Extensions) to the runtime'srequestHeaderAllowlist. AgentCore Runtime forwards only allowlisted request headers to the container, so before this change an A2A server created by the CLI never received them.withProtocolRequestHeaders(protocol, allowlist)insrc/projectSchemas/runtime.tsreturns the allowlist with the A2A headers added when the protocol is A2A. Matching is case-insensitive, headers the user passed (--request-header-allowlist) are kept as written and come first, and other protocols are returned unchanged.buildDocsRuntimeSpec(agentcore add runtime, flag handler and wizard) and thea2a-python-strandstemplate resolver (also used bya2a-python-strands-box).No CDK or CloudFormation change is needed: the pinned
@aws/agentcore-cdk@1.5.0already mapsrequestHeaderAllowlistto the runtime'srequestHeaderConfiguration.allowlistedHeaders.Related Issue
Closes #2981
Documentation PR
Documentation is included here (runtime docs templates).
command.mdis not changed.Type of Change
Testing
How have you tested the change?
Unit tests: a helper test (A2A, user headers kept, case-insensitive dedupe, other protocols unchanged, defaults pass the header-name check), a flag-handler test (
add runtime --protocol A2Aand--protocol MCPwith--request-header-allowlist), and a template test table (a2a-python-strandswith and without user headers,agent-python-strands,mcp-python-fastmcp). The existing "typescript A2A" and "docs-only runtimes" expectations and the A2A manifest snapshot now include the allowlist (the snapshot diff is exactly the 4 added lines).Ran the real CLI from source on a scratch project:
create --template a2a-python-strandsandadd runtime --protocol A2Awrite["A2A-Version","A2A-Extensions"]; with--request-header-allowlist X-Tenant a2a-versionthe result is["X-Tenant","a2a-version","A2A-Extensions"]; an HTTP runtime has no allowlist.Deployed with
agentcore deploy(this branch, us-west-2) a project fromagentcore create --template a2a-python-strands, and invoked it throughInvokeAgentRuntimewithA2A-VersionandA2A-Extensionsheaders. With the allowlist this branch writes, the runtime'srequestHeaderConfigurationisrequestHeaderAllowlist: [A2A-Version, A2A-Extensions]and the container received both headers. With the allowlist removed fromagentcore.json(what the CLI wrote before), the runtime has no header configuration and the container received none. Details are in A2A runtimes are created without the A2A-Version / A2A-Extensions request headers allowlisted #2981. The scratch stack was deleted afterwards. I did not run the e2e suite (bun run test:e2e).I ran
bun test: 7207 pass, 5 fail. The 5 failures are Windows-only and also fail on an unmodifiedv1.x(src/io/source.test.tsstdin test, symlink tests inboxNetworkSource.test.ts,migrate/workspace.test.tsandruntimeBuild.test.ts).I ran the relevant end-to-end tests with
bun run test:e2e, or explained why they are not applicable (not run; I deployed and checked a project by hand instead, see above)I ran
bun run typecheckI ran
bun run lint:checkI ran
bun run format:checkI ran
bun run audit: it reports 4 vulnerabilities (cross-spawn,react-router), unrelated to this change; no dependency files changedI ran
bun run secrets:checkI ran
bun run buildIf I modified
src/assets/, I updated affected snapshots withbun test <test-file> --update-snapshotsand committed themIf I re-recorded fixtures or golden files, every change beyond account identifiers is explained by this PR (none re-recorded)
This PR does not change
command.md(the release workflow regenerates it)Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the
terms of your choice.