A2A SDK — Agent-to-Agent Protocol
You are an expert in the A2A (Agent-to-Agent) Protocol, Google's open standard for inter-agent communication. You help developers build agents that discover, communicate, and delegate tasks to other agents across organizations and platforms — with agent cards for capability discovery, task lifecycle management, streaming updates, and push notifications, enabling a web of interoperable AI agents.
Best use case
A2A SDK — Agent-to-Agent Protocol is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
You are an expert in the A2A (Agent-to-Agent) Protocol, Google's open standard for inter-agent communication. You help developers build agents that discover, communicate, and delegate tasks to other agents across organizations and platforms — with agent cards for capability discovery, task lifecycle management, streaming updates, and push notifications, enabling a web of interoperable AI agents.
Teams using A2A SDK — Agent-to-Agent Protocol should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/a2a-sdk/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How A2A SDK — Agent-to-Agent Protocol Compares
| Feature / Agent | A2A SDK — Agent-to-Agent Protocol | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
You are an expert in the A2A (Agent-to-Agent) Protocol, Google's open standard for inter-agent communication. You help developers build agents that discover, communicate, and delegate tasks to other agents across organizations and platforms — with agent cards for capability discovery, task lifecycle management, streaming updates, and push notifications, enabling a web of interoperable AI agents.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# A2A SDK — Agent-to-Agent Protocol
You are an expert in the A2A (Agent-to-Agent) Protocol, Google's open standard for inter-agent communication. You help developers build agents that discover, communicate, and delegate tasks to other agents across organizations and platforms — with agent cards for capability discovery, task lifecycle management, streaming updates, and push notifications, enabling a web of interoperable AI agents.
## Core Capabilities
### Agent Card (Discovery)
```json
// .well-known/agent.json — Describes agent capabilities
{
"name": "Invoice Processing Agent",
"description": "Processes invoices, extracts data, and routes to accounting systems",
"url": "https://invoices.example.com/a2a",
"version": "1.0.0",
"capabilities": {
"streaming": true,
"pushNotifications": true,
"stateTransitionHistory": true
},
"skills": [
{
"id": "extract-invoice",
"name": "Extract Invoice Data",
"description": "Extract structured data from PDF/image invoices",
"tags": ["ocr", "extraction", "accounting"],
"examples": ["Process this invoice and extract the total, vendor, and line items"]
},
{
"id": "validate-invoice",
"name": "Validate Invoice",
"description": "Validate invoice data against PO and contracts",
"tags": ["validation", "compliance"]
}
],
"authentication": {
"schemes": ["bearer"]
}
}
```
### A2A Server (Python)
```python
# server.py — A2A-compatible agent server
from a2a.server import A2AServer, TaskHandler
from a2a.types import Task, TaskState, Message, TextPart, DataPart
class InvoiceAgent(TaskHandler):
async def on_message(self, task: Task, message: Message) -> Task:
"""Handle incoming task messages."""
user_text = next(
(p.text for p in message.parts if isinstance(p, TextPart)), ""
)
if "extract" in user_text.lower():
# Process invoice
task.state = TaskState.WORKING
# Get attached file
file_data = next(
(p for p in message.parts if isinstance(p, DataPart)), None
)
if file_data:
extracted = await self.extract_invoice(file_data.data)
task.add_message(Message(
role="agent",
parts=[
TextPart(text=f"Extracted invoice data from {extracted['vendor']}"),
DataPart(
data=extracted,
mimeType="application/json",
),
],
))
task.state = TaskState.COMPLETED
else:
task.add_message(Message(
role="agent",
parts=[TextPart(text="Please attach an invoice file (PDF or image).")],
))
task.state = TaskState.INPUT_REQUIRED
return task
async def extract_invoice(self, file_data: bytes) -> dict:
"""OCR + LLM extraction pipeline."""
text = await ocr_extract(file_data)
structured = await llm_extract(text)
return structured
server = A2AServer(handler=InvoiceAgent())
server.run(port=8080)
```
### A2A Client (Calling Other Agents)
```python
# client.py — Discover and call external agents
from a2a.client import A2AClient
# Discover agent capabilities
client = A2AClient("https://invoices.example.com")
agent_card = await client.get_agent_card()
print(f"Agent: {agent_card.name}")
print(f"Skills: {[s.name for s in agent_card.skills]}")
# Send task
task = await client.send_task(
message=Message(
role="user",
parts=[
TextPart(text="Extract data from this invoice"),
DataPart(data=invoice_bytes, mimeType="application/pdf"),
],
),
)
# Poll for completion (or use streaming)
while task.state not in (TaskState.COMPLETED, TaskState.FAILED):
task = await client.get_task(task.id)
await asyncio.sleep(1)
# Get results
for msg in task.messages:
for part in msg.parts:
if isinstance(part, DataPart):
print(f"Extracted data: {part.data}")
# Streaming
async for event in client.send_task_streaming(message=message):
if event.type == "message":
print(event.message.parts[0].text)
elif event.type == "state_change":
print(f"State: {event.state}")
```
### Multi-Agent Orchestration
```python
# orchestrator.py — Coordinate multiple A2A agents
async def process_invoice_pipeline(invoice_bytes: bytes):
# Agent 1: Extract invoice data
extractor = A2AClient("https://invoices.example.com")
extraction_task = await extractor.send_task(
message=Message(role="user", parts=[
TextPart(text="Extract all data from this invoice"),
DataPart(data=invoice_bytes, mimeType="application/pdf"),
]),
)
extracted_data = await wait_for_completion(extraction_task)
# Agent 2: Validate against PO
validator = A2AClient("https://validation.example.com")
validation_task = await validator.send_task(
message=Message(role="user", parts=[
TextPart(text="Validate this invoice against purchase orders"),
DataPart(data=extracted_data, mimeType="application/json"),
]),
)
validation_result = await wait_for_completion(validation_task)
# Agent 3: Route to accounting
if validation_result["valid"]:
accounting = A2AClient("https://accounting.example.com")
await accounting.send_task(
message=Message(role="user", parts=[
TextPart(text="Book this validated invoice"),
DataPart(data=extracted_data, mimeType="application/json"),
]),
)
```
## Installation
```bash
pip install a2a-sdk
# Or build from Google's spec: https://github.com/google/a2a-protocol
```
## Best Practices
1. **Agent cards** — Publish `/.well-known/agent.json` with clear skill descriptions; enables automatic discovery
2. **Task lifecycle** — Use proper states: SUBMITTED → WORKING → COMPLETED/FAILED/INPUT_REQUIRED
3. **Streaming** — Enable streaming for long tasks; clients get real-time progress updates
4. **Multi-part messages** — Use TextPart for instructions, DataPart for structured data/files; separate concerns
5. **Authentication** — Support bearer tokens; agents calling your agent need proper credentials
6. **Idempotent tasks** — Tasks have unique IDs; handle duplicate submissions gracefully
7. **Push notifications** — Configure push for async tasks; agent notifies client when complete
8. **Composable pipelines** — Chain agents: extraction → validation → booking; each agent is independent and reusableRelated Skills
agent-protocol
Inter-agent communication protocol for C-suite agent teams. Defines invocation syntax, loop prevention, isolation rules, and response formats. Use when C-suite agents need to query each other, coordinate cross-functional analysis, or run board meetings with multiple agent roles.
protocol-reverse-engineering
Master network protocol reverse engineering including packet analysis, protocol dissection, and custom protocol documentation. Use when analyzing network traffic, understanding proprietary protocols, or debugging network communication.
defi-protocol-templates
Implement DeFi protocols with production-ready templates for staking, AMMs, governance, and lending systems. Use when building decentralized finance applications or smart contract protocols.
data-structure-protocol
Give agents persistent structural memory of a codebase — navigate dependencies, track public APIs, and understand why connections exist without re-reading the whole repo.
harness-model-protocol
Analyze the protocol layer between agent harness and LLM model. Use when (1) understanding message wire formats and API contracts, (2) examining tool call encoding/decoding mechanisms, (3) evaluating streaming protocols and partial response handling, (4) identifying agentic chat primitives (system prompts, scratchpads, interrupts), (5) comparing multi-provider abstraction strategies, or (6) understanding how frameworks translate between native LLM APIs and internal representations.
verification-protocol
Independent verification of task completion - eliminates self-attestation
git-protocol
Git protocol implementation patterns using gitoxide for Guts repository operations
swift-protocol-di-testing
Protocol-based dependency injection for testable Swift code — mock file system, network, and external APIs using focused protocols and Swift Testing.
Protocol Buffers — Efficient Binary Serialization
You are an expert in Protocol Buffers (protobuf), Google's language-neutral binary serialization format. You help developers define data schemas with `.proto` files, generate typed code for multiple languages, build efficient APIs with gRPC, and handle schema evolution with backward/forward compatibility — achieving 3-10x smaller payloads and 20-100x faster serialization than JSON.
MCP SDK — Model Context Protocol for AI Tools
You are an expert in MCP (Model Context Protocol), the open standard by Anthropic for connecting AI models to external tools and data sources. You help developers build MCP servers that expose tools, resources, and prompts to any MCP-compatible client (Claude Desktop, Cursor, Windsurf, Cline, Continue) — creating a universal plugin system for AI assistants.
AG-UI — Agent-User Interaction Protocol
You are an expert in AG-UI (Agent-User Interaction Protocol), the open standard by CopilotKit for connecting AI agents to frontend UIs. You help developers stream agent actions, tool calls, state updates, and text generation to React components in real-time — enabling rich agent UIs where users see what the agent is thinking, doing, and can intervene at any step.
A2A Protocol
## Overview