Skip to content

Conversation

@minorun365
Copy link

Summary

This PR adds support for the A2A (Agent-to-Agent) protocol, enabling agents to communicate with each other using the JSON-RPC 2.0 protocol.

New Features

  • BedrockAgentCoreA2AApp: A Starlette-based application class for hosting A2A agents
  • AgentCard & AgentSkill: Models for describing agent capabilities
  • @entrypoint decorator: For defining message handlers
  • JSON-RPC 2.0 support: Standard A2A protocol implementation on port 9000

New Files

  • src/bedrock_agentcore/runtime/a2a_app.py - Main A2A application class
  • src/bedrock_agentcore/runtime/a2a_models.py - A2A data models
  • tests/bedrock_agentcore/runtime/test_a2a_app.py - Unit tests for A2A app
  • tests/bedrock_agentcore/runtime/test_a2a_models.py - Unit tests for A2A models

Usage Example

from bedrock_agentcore.runtime import AgentCard, AgentSkill, BedrockAgentCoreA2AApp

agent_card = AgentCard(
    name="My Agent",
    description="A helpful assistant",
    version="1.0.0",
    skills=[AgentSkill(id="qa", name="Q&A", description="Answer questions")],
)

app = BedrockAgentCoreA2AApp(agent_card=agent_card)

@app.entrypoint
async def handle_message(request, context):
    user_text = request.params.get("message", {}).get("parts", [{}])[0].get("text", "")
    return {"artifacts": [{"parts": [{"kind": "text", "text": f"Response to: {user_text}"}]}]}

if __name__ == "__main__":
    app.run()

Test Plan

  • All 54 unit tests pass
  • Linter checks pass
  • Tested locally with curl commands
  • Deployed to AgentCore Runtime and verified working

- Add BedrockAgentCoreA2AApp class for hosting A2A agents
- Add A2A models (AgentCard, AgentSkill, JsonRpcRequest/Response, etc.)
- Add @entrypoint decorator for message handling
- Support JSON-RPC 2.0 protocol on port 9000
- Export A2A classes from runtime module
- Add comprehensive unit tests (54 tests)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant