A2A Protocol

2025 Complete Guide: Agent2Agent (A2A) Protocol - The New Standard for AI Agent Collaboration

MILO
Share
2025 Complete Guide: Agent2Agent (A2A) Protocol - The New Standard for AI Agent Collaboration

🎯 Key Points (TL;DR)

  • A2A Protocol: The first open standard designed specifically for communication between AI agents, solving collaboration challenges of AI agents developed by different organizations
  • Core Value: Through standardized communication protocols, enables specialized AI agents to seamlessly collaborate on complex tasks
  • Technical Foundation: Based on JSON-RPC 2.0 and HTTP(S), supporting enterprise-grade features like streaming, push notifications
  • Complementary to MCP: A2A focuses on agent-to-agent collaboration, MCP focuses on tool integration, together building a complete agent ecosystem

Table of Contents

  1. What is A2A Protocol?
  2. A2A Protocol Core Concepts
  3. A2A vs MCP Protocol Comparison
  4. Agent Discovery Mechanisms
  5. Real-world Application Scenarios
  6. Technical Implementation Guide
  7. Frequently Asked Questions
  8. Summary and Action Recommendations
  9. Quick Start Examples
  10. Python Implementation Examples
  11. JavaScript/TypeScript Examples
  12. Java Implementation Examples
  13. Framework Integration Examples
  14. Protocol Integration Examples
  15. Development Tools and SDKs
  16. Technical Specifications and Best Practices
  17. Ecosystem and Resources
  18. Protocol Comparison and Analysis

What is A2A Protocol?

Agent2Agent (A2A) Protocol is an open standard specifically designed to solve the core challenge in AI agent ecosystems: How to enable effective communication and collaboration between AI agents developed by different teams, using different technologies, and belonging to different organizations?

Core Problems Solved

Imagine a user asking their primary AI assistant to plan an international trip. This single request might require coordinating the capabilities of multiple specialized agents:

  1. Flight Booking Agent - Handles flight search and booking
  2. Hotel Booking Agent - Manages accommodation arrangements
  3. Local Tourism Agent - Provides attraction recommendations and bookings
  4. Financial Services Agent - Handles currency conversion and travel advice

💡 Core Insight

Without a universal communication protocol, integrating these diverse agents requires extensive custom point-to-point solutions, making systems difficult to scale, maintain, and extend.

Five Pillars of A2A Solution

Feature Description Technical Implementation
Unified Transport Format JSON-RPC 2.0 over HTTP(S) Standardized message structure and transport
Agent Discovery Agent Cards mechanism Agent capability advertising and discovery
Task Management Workflow Support for long-running tasks Multi-turn interactions and state management
Multi-modal Data Support Text, files, structured data Rich media content exchange
Enterprise-grade Security Async processing, authentication & authorization Production-ready

A2A Protocol Core Concepts

Core Participants

graph LR
    A[User] --> B[A2A Client<br/>Client Agent]
    B --> C[A2A Server<br/>Remote Agent]
    C --> D[Task Execution Results]
    D --> B
    B --> A
  • User: The end user or automated service initiating requests
  • A2A Client: Application or agent that makes requests to remote agents on behalf of users
  • A2A Server: AI agent or agent system implementing A2A protocol HTTP endpoints

Basic Communication Elements

1. Agent Card

📋 Definition

JSON metadata document, typically discoverable at a well-known URL (like /.well-known/agent.json), describing complete information about an A2A server.

Agent Card Contains:

  • Agent identity (name, description)
  • Server endpoint URLs and versions
  • Supported A2A capabilities (streaming, push notifications)
  • Specific skill listings
  • Authentication requirements

2. Task

graph TD
    A[submitted] --> B[working]
    B --> C[input-required]
    C --> B
    B --> D[completed]
    B --> E[failed]
  • Each task has a unique ID defined by the agent
  • Tasks are stateful and can involve multiple message exchanges
  • Support for long-running complex operations

3. Message

  • Role Distinction: "user" (sent by client) or "agent" (sent by server)
  • Content Carrier: Contains one or more Part objects
  • Unique Identifier: Each message has a messageId set by the sender

4. Part (Content Parts)

Part Type Purpose Examples
TextPart Plain text content Instructions, questions, answers
FilePart File transfer Documents, images, data files
DataPart Structured data JSON forms, parameters, machine-readable information

5. Artifact

Best Practice

Agents should use Artifact objects to return generated output results to clients when tasks reach completion status.

Interaction Mechanism Comparison

Mechanism Use Cases Technical Implementation Pros/Cons
Request/Response Simple queries, quick tasks HTTP requests + polling Simple but less efficient
Streaming Real-time updates, incremental results Server-Sent Events Good real-time performance, requires persistent connection
Push Notifications Long-term tasks, async processing Webhook callbacks Suitable for long-term tasks, complex implementation

A2A vs MCP Protocol Comparison

Protocol Positioning Differences

🎯 Core Difference

MCP focuses on tool connections, A2A focuses on agent collaboration - They are complementary, not competitive.

Comparison Dimension A2A Protocol MCP Protocol
Primary Purpose Peer-to-peer AI agent collaboration AI model to tool/resource connections
Interaction Characteristics Stateful, multi-turn dialogue, negotiative Stateless, single calls, transactional
Application Scenarios Agent delegation, collaborative project management Function calls, API queries, data retrieval
Complexity Supports complex, dynamic interactions Structured, predictable input/output

Real-world Example: Auto Repair Shop

graph TB
    A[Customer] -->|A2A Protocol| B[Manager Agent]
    B -->|A2A Protocol| C[Mechanic Agent]
    C -->|MCP Protocol| D[Vehicle Diagnostic Scanner]
    C -->|MCP Protocol| E[Repair Manual Database]
    C -->|MCP Protocol| F[Lift Platform]
    C -->|A2A Protocol| G[Parts Supplier Agent]

Scenario Analysis:

  1. Customer Interaction (A2A): Customer engages in multi-turn dialogue with manager agent to diagnose issues
  2. Internal Tool Usage (MCP): Mechanic agent uses MCP to call specialized tools
  3. Supplier Collaboration (A2A): Mechanic agent negotiates parts procurement with supplier agent

Agent Discovery Mechanisms

1. Standard URI Discovery

📍 Recommended Path

https://{agent-server-domain}/.well-known/agent.json

Implementation Steps:

  1. Client agent learns of potential A2A server domain
  2. Sends HTTP GET request to standard path
  3. Server returns Agent Card JSON response

Advantages: Simple, standardized, supports automated discovery

2. Curated Registry (Directory-style Discovery)

graph TD
    A[Agent Registration] --> B[Central Registry]
    C[Client Query] --> B
    B --> D[Matching Agent Cards]
    D --> C

Use Cases:

  • Enterprise environments
  • Professional markets
  • Specific ecosystems

Advantages:

  • Centralized management and governance
  • Capability-based discovery
  • Access control and trust mechanisms

3. Direct Configuration/Private Discovery

Applicable Situations:

  • Tightly coupled systems
  • Private agents
  • Development/testing environments

Real-world Application Scenarios

Scenario 1: International Travel Planning

sequenceDiagram
    participant U as User
    participant PA as Primary Assistant
    participant FA as Flight Agent
    participant HA as Hotel Agent
    participant TA as Tourism Agent
    
    U->>PA: Plan 5-day Tokyo trip
    PA->>FA: Query flight options
    FA-->>PA: Return flight proposals
    PA->>HA: Book hotel
    HA-->>PA: Confirm accommodation
    PA->>TA: Arrange local activities
    TA-->>PA: Recommend itinerary
    PA-->>U: Complete travel plan

Scenario 2: Enterprise Customer Service Collaboration

Multi-agent Collaboration Flow:

  1. Front-line Customer Service Agent - Handles common issues
  2. Technical Specialist Agent - Solves technical problems
  3. Billing Processing Agent - Handles finance-related issues
  4. Escalation Management Agent - Handles complaints and special situations

⚠️ Important Notes

Agent collaboration requires maintaining complete user context to ensure service continuity and consistency.

Technical Implementation Guide

Agent Card Example Structure

{
  "name": "Smart Travel Assistant",
  "description": "Professional travel planning and booking service",
  "provider": "TravelTech Inc.",
  "url": "https://api.travelagent.com/a2a",
  "version": "1.0.0",
  "capabilities": ["streaming", "pushNotifications"],
  "authentication": {
    "schemes": ["Bearer"]
  },
  "skills": [
    {
      "id": "flight-booking",
      "name": "Flight Booking",
      "description": "Search and book international flights",
      "inputModes": ["text", "data"],
      "outputModes": ["text", "data"]
    }
  ]
}

Security Best Practices

Security Layer Implementation Recommendations Technical Solutions
Authentication Use standard web authentication OAuth 2.0, API keys
Authorization Role-based access control JWT tokens, permission matrices
Transport Security Enforce HTTPS TLS 1.2+, certificate validation
Network Isolation Limit access scope VPC, IP whitelisting

Development Integration Steps

  1. Design Agent Card - Define agent capabilities and interfaces
  2. Implement A2A Endpoints - Based on JSON-RPC 2.0 specification
  3. Configure Discovery Mechanism - Choose appropriate discovery strategy
  4. Integrate Authentication System - Implement secure access control
  5. Test Interoperability - Verify collaboration with other agents

🤔 Frequently Asked Questions

Q: What's the fundamental difference between A2A protocol and existing APIs?

A: A2A is specifically designed for peer-to-peer collaboration between agents, supporting stateful, multi-turn interactions and complex task management, while traditional APIs are mainly for simple function calls. A2A agents can perform reasoning, planning, and negotiation, which ordinary APIs cannot provide.

Q: How to choose between A2A and MCP protocols?

A:

  • Choose A2A: For scenarios requiring agent collaboration, multi-turn dialogue, state management
  • Choose MCP: For scenarios requiring tool calls, database queries, specific function execution
  • Combine Both: Most complex applications need both protocols simultaneously

Q: How is A2A protocol performance? Does it support large-scale deployment?

A: A2A is based on mature HTTP and JSON-RPC standards with good scalability. Through streaming and push notification mechanisms, it can effectively handle long-running tasks. Enterprise features like authentication, monitoring, and tracing have standardized support.

Q: How to ensure security in agent collaboration?

A: A2A adopts standard web security practices:

  • HTTP(S) encrypted transmission
  • Standard authentication schemes (OAuth 2.0, Bearer Token)
  • Agent Card access control
  • Network layer isolation and monitoring

Q: Does A2A protocol support offline or disconnected scenarios?

A: A2A natively supports asynchronous operations and can handle scenarios where agents or users are not continuously online through push notification mechanisms. Long-running tasks can continue execution after network recovery.

Summary and Action Recommendations

Core Value Summary

The A2A protocol represents an important milestone in AI agent ecosystem development, solving the standardization problem of agent collaboration and laying the foundation for building more powerful and flexible AI applications.

Immediate Action Recommendations

  1. Evaluate Existing Systems - Identify business processes that can be improved through agent collaboration
  2. Choose Pilot Scenarios - Start implementation with simple agent collaboration
  3. Technical Preparation - Learn JSON-RPC 2.0 and related web standards
  4. Community Participation - Follow A2A protocol community development and best practice sharing

🚀 Future Outlook

As AI agent capabilities continue to strengthen, the A2A protocol will become key infrastructure for building collaborative AI ecosystems, driving AI applications toward more complex and intelligent directions.

Related Resources


This guide is based on A2A protocol official documentation and is continuously updated to reflect the latest protocol developments and best practices.

🚀 Quick Start Examples

Basic Examples

  • A2A Samples: Hello World Agent (May 28, 2025)
    • Complete guide to building Hello World agent using A2A Python SDK
    • Includes detailed environment setup and testing instructions

Currency Conversion Agent

🐍 Python Implementation Examples

GitHub Integration

  • A2A Python Sample: Github Agent (June 16, 2025)
    • Create and connect GitHub agents using a2a-python
    • Implement code repository information query functionality

Travel Planning Assistant

File Chat Workflow

Python Tutorial Series

🟨 JavaScript/TypeScript Examples

Movie Information Agent

JavaScript SDK Tutorials

Java Implementation Examples

  • A2A Java Sample (June 5, 2025)
    • Maven multi-module architecture
    • Spring Boot server SDK implementation
    • AI translation service example

🔧 Framework Integration Examples

ADK Integration

Expense Reimbursement Agent

  • A2A ADK Expense Reimbursement Agent (July 10, 2025)
    • Intelligent expense reimbursement agent based on Google ADK and A2A protocol
    • Automatic form completion information generation

CrewAI Integration

LangGraph Integration

🔗 Protocol Integration Examples

MCP Protocol Integration

  • A2A MCP AG2 Intelligent Agent Example (July 2, 2025)

    • A2A protocol intelligent agent built using AG2 framework
    • Integration with MCP protocol and YouTube subtitle processing functionality
  • A2A MCP Integration (June 4, 2025)

    • Step-by-step guide for A2A and MCP integration
    • Build AI agents using Python SDK and OpenRouter

🛠️ Development Tools and SDKs

.NET SDK

Debugging Tools

📚 Technical Specifications and Best Practices

Protocol Specifications

  • A2A Protocol Specification (Python) (July 16, 2025)
    • Comprehensive guide to Python implementation specifications
    • Covers core functionality including agent cards, messaging, task management

Examples and Methods

Protocol Understanding

🌟 Ecosystem and Resources

Implementation Collections

  • A2A Implementations (May 2, 2025)
    • Explore various open-source implementations of A2A protocol
    • Includes Java, TypeScript, Go, Rust, Python, etc.

Resource Directory

  • Awesome A2A Directory (April 19, 2025)
    • Explore the complete ecosystem of Google A2A protocol
    • Contains official documentation, community implementations, example projects and integration guides

📊 Protocol Comparison and Analysis

Protocol Comparisons