Skip to content

AIwithTim/a2a

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

A2A: The Dawn of Agent Collaboration and What It Means for Enterprise AI

In a significant move that could reshape how AI functions across organizations, Google has unveiled Agent-to-Agent (A2A), an open protocol designed to enable seamless communication between AI agents from different vendors and platforms. This breakthrough addresses one of the most pressing limitations in today's AI landscape: the inability of specialized AI systems to effectively collaborate with one another.

Breaking Down the Silos

Today's enterprises rely on dozens, sometimes hundreds, of specialized software systems. Similarly, they're beginning to deploy specialized AI agents to handle specific tasks - customer support agents, document processing agents, HR screening agents, and more. But these agents have largely operated in isolation, creating a new kind of digital silo.

A2A changes this paradigm by establishing a common language for these agents to communicate, enabling them to:

  • Discover each other's capabilities
  • Exchange information securely
  • Coordinate on complex multi-step tasks
  • Negotiate how user experiences should be handled

Technical Architecture That Makes Sense

Rather than reinventing the wheel, A2A builds upon established standards including HTTP, Server-Sent Events (SSE), and JSON-RPC. This pragmatic approach means A2A can be integrated into existing enterprise environments without requiring complete infrastructure overhauls.

The protocol incorporates five key design principles:

  1. Embrace agentic capabilities - Recognizing the unique properties of AI agents versus traditional APIs
  2. Build on existing standards - Leveraging proven technologies for compatibility
  3. Secure by default - Implementing enterprise-grade authentication and authorization
  4. Support long-running tasks - Enabling complex workflows that may take minutes or hours
  5. Modality agnostic - Supporting text, audio, video, and other forms of communication

How A2A Works in Practice

At its core, A2A enables agents to advertise their capabilities through standardized "Agent Cards" in JSON format. This allows client agents to discover which other agents might best assist with a particular task.

Tasks in A2A follow a defined lifecycle, with support for both immediate responses and long-running operations. As tasks progress, they produce "artifacts" - standardized outputs that can be passed between agents.

Consider this real-world example shared by Google: A recruiting workflow where multiple specialized agents collaborate:

  • A sourcing agent identifies potential candidates
  • A screening agent evaluates their qualifications
  • A scheduling agent coordinates interviews with internal stakeholders

Without A2A, creating such workflows would require custom integration work between each agent. With A2A, these agents can dynamically discover each other and coordinate their efforts regardless of which vendors created them.

Industry Support and Momentum

Perhaps most telling about A2A's potential impact is the impressive roster of technology and service partners that have already aligned with the protocol. Over 50 organizations including Atlassian, Salesforce, SAP, Accenture, Deloitte, and KPMG have signaled support.

As Stefan Jansen from Atlassian notes, A2A enables agents to "successfully discover, coordinate, and reason with one another," while ServiceNow believes it will "pave the way for more efficient and connected support experiences."

Complementary, Not Competitive

It's worth noting that A2A complements rather than competes with other emerging standards in the AI space, such as Anthropic's Model Context Protocol (MCP). While MCP focuses on how models interact with context and knowledge, A2A addresses the agent-to-agent communication layer.

Inside the Protocol: A Technical Deep Dive

The A2A protocol is structured around three core components:

1. Agent Cards

Agent Cards are JSON manifests that describe an agent's identity and capabilities. They serve as a discovery mechanism, allowing client agents to understand what a server agent can do before making a request. A typical Agent Card includes:

{
  "agent_id": "calculator-agent-001",
  "name": "Calculator Agent",
  "description": "An agent that performs basic arithmetic operations",
  "version": "1.0.0",
  "capabilities": [
    {
      "id": "add",
      "name": "Add Numbers",
      "description": "Add two numbers together",
      "parameters": {
        "a": {"type": "number", "description": "First number"},
        "b": {"type": "number", "description": "Second number"}
      }
    },
    {
      "id": "subtract",
      "name": "Subtract Numbers",
      "description": "Subtract one number from another",
      "parameters": {
        "a": {"type": "number", "description": "Number to subtract from"},
        "b": {"type": "number", "description": "Number to subtract"}
      }
    }
  ]
}

2. Task Management

Tasks in A2A follow a defined lifecycle:

  • Creation: A client agent submits a task request to a server agent
  • Execution: The server agent processes the request either immediately or asynchronously
  • Completion: The server agent returns results or error information
  • Retrieval: For long-running tasks, clients can poll for status updates

3. Collaboration Mechanism

The protocol defines structured ways for agents to:

  • Exchange messages with context
  • Pass artifacts (data objects) between agents
  • Negotiate content formats for different modalities

Implementation Example: A Calculator Agent in Python

To demonstrate how A2A works in practice, here's a simplified Python implementation of an A2A-compliant calculator agent:

# Python implementation of a simple A2A-compliant calculator agent

class A2AServerAgent:
    def __init__(self, agent_id, name, description, version="1.0.0"):
        self.agent_card = {
            "agent_id": agent_id,
            "name": name,
            "description": description,
            "version": version,
            "capabilities": []
        }
        self.tasks = {}
        
    def add_capability(self, capability_id, name, description, parameters=None):
        """Register a new capability that this agent can perform."""
        capability = {
            "id": capability_id,
            "name": name,
            "description": description,
            "parameters": parameters or {}
        }
        self.agent_card["capabilities"].append(capability)
        
    async def process_task(self, task_request):
        """Process an incoming task request."""
        capability_id = task_request["capability_id"]
        
        if capability_id == "add":
            a = float(task_request["input"].get("a", 0))
            b = float(task_request["input"].get("b", 0))
            result = a + b
            return {
                "task_id": task_request["task_id"],
                "status": "COMPLETED",
                "output": {"result": result}
            }
            
        elif capability_id == "subtract":
            a = float(task_request["input"].get("a", 0))
            b = float(task_request["input"].get("b", 0))
            result = a - b
            return {
                "task_id": task_request["task_id"],
                "status": "COMPLETED",
                "output": {"result": result}
            }
        
        return {
            "task_id": task_request["task_id"],
            "status": "FAILED",
            "error": f"Capability {capability_id} not supported"
        }

This server agent would expose three HTTP endpoints:

  • GET /a2a/card - Returns the agent's capabilities
  • POST /a2a/tasks - Accepts new task requests
  • GET /a2a/tasks/{task_id} - Retrieves task status and results

Client agents can discover and use the calculator:

async def use_calculator():
    # Discover the calculator agent
    response = await http_get("http://calculator-agent/a2a/card")
    agent_card = response.json()
    
    # Submit a task to add two numbers
    task_request = {
        "task_id": "task123",
        "capability_id": "add",
        "input": {"a": 5, "b": 3}
    }
    
    await http_post("http://calculator-agent/a2a/tasks", json=task_request)
    
    # Poll until the task completes
    while True:
        response = await http_get(f"http://calculator-agent/a2a/tasks/{task_request['task_id']}")
        task_status = response.json()
        
        if task_status["status"] in ["COMPLETED", "FAILED"]:
            break
            
        await asyncio.sleep(0.5)
    
    # Display the result
    print(f"Addition result: {task_status['output']['result']}")  # Output: 8

The full implementation in our example provides a working demonstration of both client and server A2A agents communicating via HTTP.

What's Next for A2A?

Google has made the protocol open source, with a specification draft available on GitHub. The company is aiming for a production-ready version later this year, suggesting organizations should begin evaluating how A2A might fit into their AI strategies now.

For developers and enterprises investing in AI agents, A2A represents an opportunity to future-proof their work. Rather than building agents that operate in isolation, they can now design systems that will seamlessly integrate into a broader ecosystem of collaborative AI.

The Bottom Line

A2A has the potential to do for AI agents what APIs did for software applications: create a robust ecosystem where specialized tools can be combined in powerful and unexpected ways. As enterprises continue to deploy AI throughout their operations, this interoperability will likely become not just an advantage but a necessity.

By establishing a common protocol for agent collaboration now, Google and its partners are laying groundwork for a future where AI systems become more than the sum of their parts - a future where the true potential of enterprise AI can finally be realized.

Sample Output

Running the included Python example (a2a_python_example.py) produces the following output:

2025-04-09 15:57:32,507 - a2a_demo - INFO - Starting A2A server agent Calculator Agent on http://localhost:8080
2025-04-09 15:57:33,495 - a2a_demo - INFO - Discovering agent at http://localhost:8080/a2a/card
2025-04-09 15:57:33,504 - aiohttp.access - INFO - ::1 [09/Apr/2025:14:57:33 +0000] "GET /a2a/card HTTP/1.1" 200 787 "-" "Python/3.12 aiohttp/3.11.12"
2025-04-09 15:57:33,505 - a2a_demo - INFO - Discovered calculator agent: Calculator Agent
2025-04-09 15:57:33,506 - a2a_demo - INFO - Capabilities: ['Add Numbers', 'Subtract Numbers']
2025-04-09 15:57:33,506 - a2a_demo - INFO - Creating task on http://localhost:8080/a2a/tasks
2025-04-09 15:57:33,511 - aiohttp.access - INFO - ::1 [09/Apr/2025:14:57:33 +0000] "POST /a2a/tasks HTTP/1.1" 200 232 "-" "Python/3.12 aiohttp/3.11.12"
2025-04-09 15:57:33,512 - a2a_demo - INFO - Created addition task: b0cbffd4-5032-4d48-b906-b2460b5be139
2025-04-09 15:57:33,515 - aiohttp.access - INFO - ::1 [09/Apr/2025:14:57:33 +0000] "GET /a2a/tasks/b0cbffd4-5032-4d48-b906-b2460b5be139 HTTP/1.1" 200 277 "-" "Python/3.12 aiohttp/3.11.12"
2025-04-09 15:57:33,516 - a2a_demo - INFO - Addition result: {'result': 8.0}
2025-04-09 15:57:33,516 - a2a_demo - INFO - Creating task on http://localhost:8080/a2a/tasks
2025-04-09 15:57:33,518 - aiohttp.access - INFO - ::1 [09/Apr/2025:14:57:33 +0000] "POST /a2a/tasks HTTP/1.1" 200 232 "-" "Python/3.12 aiohttp/3.11.12"
2025-04-09 15:57:33,519 - a2a_demo - INFO - Created subtraction task: 521cd11b-cb21-4af2-915b-73e86d06979e
2025-04-09 15:57:33,521 - aiohttp.access - INFO - ::1 [09/Apr/2025:14:57:33 +0000] "GET /a2a/tasks/521cd11b-cb21-4af2-915b-73e86d06979e HTTP/1.1" 200 277 "-" "Python/3.12 aiohttp/3.11.12"
2025-04-09 15:57:33,521 - a2a_demo - INFO - Subtraction result: {'result': 6.0}

This demonstrates the key workflow:

  1. Server agent starts up with declared capabilities
  2. Client agent discovers the server's capabilities
  3. Client sends an addition task (5 + 3)
  4. Client receives the result (8.0)
  5. Client sends a subtraction task (10 - 4)
  6. Client receives the result (6.0)

Disclaimer

This is a simplified implementation designed to demonstrate the core concepts of the A2A protocol. For production use, please refer to the official implementation and specification.


Interested in learning more about A2A? The full specification is available at GitHub, and the protocol website can be found at google.github.io/A2A. A full Python implementation example is included in the repository at samples/python.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages