We’re starting to see AI Agents everywhere, built with many frameworks and with a huge diversity of capabilities. Ideally, we want these agents to be able to work with one another, but to maintain observability and security. The Agent2Agent (A2A) protocol handles the communication between agents- things like task negotiation, state, and identity. Agents can belong to different organizations and use different frameworks, but still communicate efficiently and safely with each other. A2A protocol has formally joined the Agentic AI Foundation https://aaif.io/ and sits alongside other standards like Goose, Agents.md, MCP, and agentgateway. To read more about it, go to — https://a2a-protocol.org/latest/.
Existing Agent
Previously I had built a compliance agent in Bedrock AgentCore, it is functional and hosted on CloudFront with a Cognito login. See https://dev.to/aws-builders/but-wait-theres-more-sharpening-our-agentic-compliance-tools-1c0i for a write up. The agent that helps with:
Gap analysis against many frameworks
Maturity assessment (SCR-CMM Levels 0–5)
Framework mapping (HIPAA, NIST, ISO, PCI, …)
Evidence checklists for audits
Compensating controls for gaps
Live web research for current regulatory info
Historical answer research
Approved answer compilation and tracking
The Issue
So, we have our compliance agent, and when the caller is an AWS principal in this account, my IAM / SigV4 authentication works fine. However, when the caller is another agent (possibly in another company’s cloud), SigV4 is the wrong tool. In this case, we need standard OAuth2/OIDC bearer tokens. In the real world, multi-org means multiple identity providers. In my case: our Amazon Cognito and a Microsoft Entra ID tenant had to work, independently. Adding A2A protocol made this easier. Here’s how I chose to implement it in this project: https://github.com/mgbec/SCF-Agent-with-A2A
The Design
A2A client goes through an API Gateway HTTP API with a per-route JWT authorizer. The API Gateway flows into a sort of “bridge” Lambda which then invokes the existing agent.
Things to call out:
Native JWT authorizers
Authorizers on API Gateway HTTP APIs accept any OIDC issuer, so Cognito and Entra each get their own authorizer on their own route (/cognito/rpc, /entra/rpc).
Bridge Lambda
This Lambda does the translation: A2A JSON-RPC traffic is processed in a two step process. The agent itself doesn’t need to change anything to make A2A work. Instead, I used:
handler.py performs routing, JSON-RPC dispatch, A2A:AgentCore translation, and task storage in DynamoDB.
agent_card.py an Agent Card is like a business card for the agent. GET /.well-known/agent-card.json will pull up the public card, which tells potential coworker agents what this agent can do. It will also specify which authentication scheme it will work with. This script produces a spec-compliant Agent2Agent (A2A) AgentCard describing the SCF
Compliance Assessment Agent. One card is built per auth “prefix” so that each route advertises only the identity provider that guards it. The card will contain the agent description — in this case, “AI-driven Secure Controls Framework (SCF) 2026.2 compliance assessment: control lookup, framework mapping, gap analysis, maturity assessment, evidence checklists, and questionnaire answers”. Skills are also listed, along with communication capabilities: “streaming”: False, “pushNotifications”: False, “stateTransitionHistory”: True.
JSON-RPC methods — A2A supports multiple methods for consumers to call — https://github.com/a2aproject/A2A/blob/main/docs/specification.md#53-method-mapping-reference. The agent advertises the methods it supports. My scf-agent doesn’t implement all of the supported methods- more on that later.
The JSON-RPC methods I do support for this agent are: message/send and tasks/get. For the non-supported A2A methods, the agent will return :
Testing A2A
I have a Microsoft Foundry agent I’ve built in another project and I will test A2A communication with our AgentCore agent in the next article. For the time being, I am testing using Cognito- python scripts/a2a_test_client.py --auth login "" drives the whole flow. It opens a browser to the Cognito hosted UI, catches the PKCE redirect with a local loopback server (no copy-pasting a code out of the address bar), exchanges it, and sends a real message/send. --auth m2m does the same with client_credentials (no browser). The “--card-only” switch just fetches the Agent Card. Finally, ”--interactive” gives you a chat loop reusing the same contextId. You will need at least one confirmed user in the pool and redirect_uri (default http://localhost:8501/oauth2callback) registered in cognito_a2a_web_callback_urls.
A2A Communication
A2A supports both streaming and async communication- https://agent2agent.info/docs/topics/streaming-and-async/ I worked through a few ideas and in the end, left streaming implementation for another day. To read more about some options for my agent in the future, see -
https://github.com/mgbec/SCF-Agent-with-A2A/blob/main/docs/a2a-streaming.md. I initially tried synchronous communication, but the time out was too short to be functional. For now, I have async responses to the users’ queries. This type of polling gives the caller visibility that work is still happening, but it is not an incrementally delivered answer. Users receive progress indicators but don’t see the answer until the end, as the whole payload.
Side note, since I did not implement streaming, I needed to create the agent card with streaming specified as “false”. There are also a number of methods that apply to streaming. For these, I needed to return the appropriate error codes.
Future Plans
A2A is still a newish protocol and I anticipate changes in the future. My next test is to finish my MS Foundry agent setup and test with that. Additionally, I’ve just started digging into Google ADK, so consuming this AgentCore agent in a ADK workflow would be a good experiment. Digging into the security aspects of A2A also sounds intriguing. One article I’ve been looking at is https://cloudsecurityalliance.org/blog/2025/04/30/threat-modeling-google-s-a2a-protocol-with-the-maestro-framework. Stay tuned and thanks for reading!




Top comments (0)