Multi-Agent Orchestration with A2A Protocol
Multi-agent orchestration using the Agent2Agent (A2A) protocol connects remote agents across organizational and network boundaries by providing a standardized, vendor-neutral communication layer. You define agents, their capabilities, and how they discover each other, then A2A handles the secure exchange of tasks, results, and context over HTTP. This article explains the protocol’s architecture, how to implement it, common pitfalls, and how it compares to alternatives like MCP.
Background: Why A2A Exists
Before A2A, connecting agents from different vendors or teams meant writing custom adapters for every pair of systems. A2A, launched by Google in April 2025 and later contributed to the Linux Foundation, solves this by creating a common “language” for agent-to-agent communication. It focuses on the collaboration layer—how agents hand off work and share results—rather than the tool invocation layer that protocols like MCP (Model Context Protocol) address. This distinction is crucial: A2A is about agents talking to agents, not about an agent calling a function.
How A2A Works: Core Concepts
A2A defines three primary building blocks:
- Agent Card: A JSON file (usually at
/.well-known/agent.json) that describes the agent’s identity, skills, endpoints, and authentication requirements. This is how other agents discover what you can do. - Task: A unit of work exchanged between agents. Tasks have states (submitted, working, completed, failed) and can be long-running, with progress updates via streaming or polling.
- Message: The content exchanged within a task, including text, files, or structured data. Messages can be parts of a conversation or final results.
The flow is straightforward: a client agent fetches the server agent’s card, sends a task/send request, and then either polls for status or receives streaming updates. For long tasks, the server can send push notifications to a webhook URL the client provides. This design mirrors RESTful APIs, making it easy to implement on top of existing web infrastructure.
Connecting Remote Agents Across Boundaries
The phrase “across boundaries” means more than just different servers. It includes:
- Organizational boundaries: Your company’s agent talking to a partner’s agent, each behind different firewalls.
- Network boundaries: Agents on different cloud providers, on-premises data centers, or edge devices.
- Protocol boundaries: Agents built with different frameworks (LangChain, AutoGen, Semantic Kernel) can interoperate if they implement A2A.
To achieve this, A2A relies on standard HTTP and JSON. It does not mandate a specific transport like WebSocket or gRPC, though it supports streaming via Server-Sent Events (SSE). Authentication is pluggable—you can use OAuth2, API keys, or mutual TLS. For cross-organization scenarios, you typically expose an agent endpoint via a reverse proxy, and the Agent Card tells clients which auth scheme to use.
Implementing an A2A Server
Here is a practical outline for turning your existing agent into an A2A server:
- Create an Agent Card: List your agent’s skills (e.g., “code_review”, “data_analysis”), a description, and the URL of your A2A endpoint.
- Set up the endpoint: Implement a POST handler for
/(or a custom path) that accepts JSON-RPC requests liketasks/sendandtasks/get. - Map tasks to your agent logic: When a
tasks/sendarrives, extract the input message, run it through your agent, and return a task ID and initial state. - Handle long-running tasks: If your agent takes more than a few seconds, return
workingstatus and either poll or push updates. Implementtasks/cancelfor cleanup. - Expose the card: Place
agent.jsonat a well-known URL so clients can find it. Use a framework like FastAPI (Python) or Express (Node.js) to reduce boilerplate.
Google provides SDKs for Python and JavaScript, but you can implement A2A with any language that handles HTTP and JSON. The protocol spec is open and detailed enough to build a client from scratch if needed.
Common Problems and Misconceptions
Developers new to A2A often stumble on these points:
- Confusing A2A with MCP: MCP is for connecting an LLM to tools (e.g., a calculator, a database). A2A is for connecting two agents. They are complementary: you might use MCP inside an agent to call tools, and A2A between agents to delegate work.
- Assuming synchronous responses: A2A is designed for asynchronous tasks. If your agent takes 30 seconds to answer, you must implement the task lifecycle properly, not just block on the HTTP request.
- Ignoring authentication: For remote agents, security is non-negotiable. A2A supports but does not enforce auth. You must configure it on both sides; otherwise, you expose your agent to anyone who finds your card.
- Misunderstanding streaming: A2A supports streaming via SSE for partial messages, but not all implementations support it. Check your client and server capabilities.
Choosing Between A2A and MCP
When should you use which? Here is a decision guide:
- Use MCP when you need to give a single agent access to tools (e.g., a file system, web search, a database). MCP is mature and widely supported by LLM platforms.
- Use A2A when you have two or more independent agents that need to collaborate—for example, a travel agent that books flights and a hotel agent that reserves rooms, each with its own data and logic.
- Use both in a complex system: each agent uses MCP for its own tools, and A2A for inter-agent communication.
There is also the newer Agent Communication Protocol (ACP) from Cisco, but A2A has broader industry backing and is already in production at several large enterprises.
Security, Costs, and Operational Considerations
Running A2A across boundaries introduces real-world concerns:
- Security: Always use HTTPS in production. Implement OAuth2 with scopes that limit what a remote agent can do. Validate all incoming messages against a schema to prevent prompt injection or malicious payloads.
- Costs: Each A2A call consumes compute and network bandwidth. If your agents call LLMs, the cost multiplies with every hop. Design your task graph to minimize round-trips and cache results where possible.
- Observability: Use distributed tracing (e.g., OpenTelemetry) to track task IDs across agents. Without it, debugging a multi-hop failure is nearly impossible.
- Rate limiting: Protect your agent from being overwhelmed by remote clients. Implement quotas per client ID or IP address.
Frequently Asked Questions
Can A2A work between agents on different cloud providers?
Yes. As long as both agents expose an HTTP endpoint and can reach each other over the internet or a private network, A2A works. You may need to configure firewall rules and authentication, but the protocol itself is cloud-agnostic.
Is A2A production-ready?
As of 2025, A2A has been adopted by over 50 companies including Salesforce, SAP, and Cohere. The specification is stable enough for production use, though it is still evolving—expect minor version updates as edge cases are found.
Do I need a special framework to use A2A?
No. You can implement A2A with any HTTP library. However, using the official SDKs (Python or JavaScript) speeds up development and handles edge cases like streaming and retries.
How does A2A handle agent discovery?
Discovery is done via the Agent Card, typically hosted at a well-known URL. There is no centralized registry yet; you either know the agent’s URL or use a directory service that indexes Agent Cards.
What is the difference between A2A and a simple REST API?
A REST API is a general-purpose interface; A2A is a specific protocol with defined task states, message formats, and lifecycle management. It standardizes how agents hand off work, so you do not have to design your own task abstraction.
Can A2A connect to legacy systems that are not agents?
Yes, by writing a thin adapter that exposes the legacy system as an A2A agent. The adapter translates between A2A messages and the legacy API calls.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.