Skip to content

[FEATURE] Agent to Agent Communication (A2A) #24

@ryanycoleman

Description

@ryanycoleman

Problem Statement

Strands builders are increasingly asking for enhanced agent interoperability capabilities that enable seamless communication between agents across different systems and deployments.

  • Standardized Agent Communication: Builders want native SDK support for agents to communicate with other agents using industry-standard protocols without custom integration work
  • Agent Discovery and Service Registry: The community needs automatic capability discovery so agents can find and connect to other agents based on their skills and availability
  • Production-Ready Inter-Agent Protocols: Developers want enterprise-grade communication protocols supporting authentication, streaming, task lifecycle management, and distributed coordination
  • Protocol-Agnostic Architecture: Requests for agents that can participate in multiple communication standards simultaneously without being locked into proprietary systems
  • Seamless Multi-Agent Integration: Standardized agents should work within existing Strands multi-agent patterns (swarms, graphs, handoffs, agents-as-tools)

Proposed Solution

In response to builder requests, we propose introducing comprehensive Agent-to-Agent (A2A) protocol integration through Google's Agent-to-Agent Protocol, enabling Strands agents to communicate with other using JSON-RPC 2.0 over HTTP and the A2A protocol.

1. A2A Agent Wrapper

The A2AAgent class adapts existing Strands agents to the A2A protocol without modifying existing agent code.

from strands import Agent
from strands.multiagent.a2a import A2AAgent

# Existing Strands agent code unchanged
strands_agent = Agent(tools=[...])

# A2A capabilities added to the agent
a2a_agent = A2AAgent(strands_agent)

# Easily serve Strands agents over the A2A protocol
a2a_agent.serve()

# Or use with any ASGI server
a2a_agent.to_asgi()

2. Agent Discovery and Agent Cards

The A2AAgent class automatically generates Agent Cards from Strands Agent metadata, providing standardized capability discovery. Agent Cards include:

  • Basic Metadata: Name, description, version, and provider information derived from Agent configuration
  • Skills Discovery: Automatically generated from available tools, enabling precise capability matching
  • Communication Capabilities: Streaming support, push notifications, and state transition tracking
  • Optional Overwrites and Augmentation: Agent builders can add to or overwrite generated agent metadata, skills, etc.
agent = Agent(
    name="research_specialist",
    system_prompt="You are an expert researcher with web access",
    tools=[http_request, memory, file_write]
)

# Agent Card automatically generated from Strands Agent with skills derived from tools
a2a_agent = A2AAgent(agent)

3. Built-in Server and ASGI Integration

The A2AAgent class includes a built-in FastAPI and uvicorn server that hosts both the Agent Card at /.well-known/agent.json and JSON-RPC 2.0 endpoints. Features include:

  • Standardized Discovery: Agent Cards accessible via HTTP GET requests
  • JSON-RPC API: Complete A2A protocol implementation with method routing
  • ASGI Compatibility: to_asgi() function for custom routes and deployment

4. Communication Patterns

The A2A implementation supports three distinct communication patterns:

Request/Response (Polling)

  • Traditional synchronous communication
  • Immediate response for quick tasks and status queries
  • Polling for longer running tasks

Streaming (Server-Sent Events)

  • Real-time updates during task execution using SSE
  • Progress monitoring and intermediate result streaming

Push Notifications (Long-Running Tasks)

  • Webhook-based notifications for longer running tasks
  • Asynchronous task management with callback mechanisms

5. Tasks, Messages, and Artifacts Integration

Complete integration with A2A's core data structures:

  • Tasks: Full lifecycle management (submitted → working → completed/failed/canceled/input-required) with state persistence
  • Messages: Rich messaging system supporting TextPart, FilePart, and DataPart for comprehensive agent communication
  • Artifacts: Structured data exchange enabling agents to share complex outputs and generated content

6. Multi-Agent Pattern Integration

A2A agents can be used directly in multi-agent patterns provided by Strands (#214):

a2a_analyzer_remote = A2AAgent(url="https://my-agent-endpoint.com/.well-known/agent.json")
a2a_analyzer_local = A2AAgent(url="http://localhost:8000/.well-known/agent.json") 
strands_analyzer = Agent(system_prompt="Perform deep analysis on the given context.")

# Agents-as-Tools
orchestrator = Agent(tools=[a2a_analyzer_remote, a2a_analyzer_local, strands_analyzer])

# Direct usage in Swarms
swarm = Swarm([a2a_analyzer_remote, a2a_analyzer_local, strands_analyzer])

# Graph workflows  
builder = GraphBuilder()
builder.add_node(a2a_analyzer_remote, "a2a_analyzer_remote")
builder.add_node(a2a_analyzer_local, "a2a_analyzer_local")
builder.add_node(strands_analyzer, "strands_analyzer")
graph = builder.build()

7. Authentication and Authorization

A2A has built-in authentication and authorization concepts. A2A clients send authentication data when communicating with agents, handled by the Strands A2AAgent server.

Additional Context

Please share your feedback and use cases to help shape A2A integration in Strands Agents.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

Status

We're Working On It

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions