Production-ready SDK for Google's Agent-to-Agent (A2A) protocol β build interoperable AI agents in minutes.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β A2A-Kit β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
β β
β ββββββββββββ ββββββββββββββββ βββββββββββββββββββββ β
β β Agent βββββΆβ Task βββββΆβ Streaming / β β
β β Card β β Lifecycle β β Push Notify β β
β ββββββββββββ ββββββββββββββββ βββββββββββββββββββββ β
β β β β β
β βΌ βΌ βΌ β
β ββββββββββββ ββββββββββββββββ βββββββββββββββββββββ β
β β Discoveryβ β Executor β β Transport β β
β β Registry β β Framework β β HTTP / SSE β β
β ββββββββββββ ββββββββββββββββ βββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Problem | A2A-Kit Solution |
|---|---|
| Agents can't discover each other | Agent Cards with capability declarations |
| No standard task handoff protocol | Task lifecycle (submitted β working β done) |
| Long tasks timeout in sync mode | SSE streaming with progress updates |
| No way to validate implementations | Conformance test suite included |
| Boilerplate for every new agent | Decorators β 5 lines to register a skill |
from a2akit import AgentServer, skill, AgentCard
# Declare your agent
card = AgentCard(
name="Weather Agent",
description="Provides weather forecasts for any location",
skills=["weather_forecast", "weather_alerts"],
)
server = AgentServer(card=card)
@server.skill("weather_forecast")
async def forecast(task):
city = task.message
# Your logic here...
return f"Weather in {city}: Sunny, 24Β°C"
# Start serving A2A protocol
server.run(port=8080)# Discover the agent
curl http://localhost:8080/.well-known/agent.json
# Send a task
curl -X POST http://localhost:8080/tasks \
-H "Content-Type: application/json" \
-d '{"message": "Weather in Berlin"}'from a2akit import AgentCard, Skill, AgentCapabilities
card = AgentCard(
name="Order Analyst",
description="Analyzes maintenance orders",
url="https://my-agent.example.com",
capabilities=AgentCapabilities(
streaming=True,
push_notifications=False,
),
skills=[
Skill(id="search_orders", description="Search maintenance orders by filters"),
Skill(id="get_costs", description="Get cost breakdown for an order"),
],
)from a2akit import TaskStatus
# Tasks flow through states:
# SUBMITTED β WORKING β COMPLETED
# β FAILED
# β INPUT_REQUIRED β WORKING β ...
@server.skill("complex_analysis")
async def analyze(task):
task.status = TaskStatus.WORKING
yield "Analyzing order data..." # streaming update
task.status = TaskStatus.WORKING
yield "Computing risk scores..." # streaming update
return {"risk_score": 0.73, "recommendation": "Review before TECO"}@server.skill("long_report")
async def report(task):
"""Long-running task with streaming progress."""
for i in range(10):
yield f"Processing batch {i+1}/10..."
await asyncio.sleep(1)
return "Full report: ..."from a2akit import AgentRegistry
registry = AgentRegistry()
registry.register("http://localhost:8080")
registry.register("http://localhost:9090")
# Find agents by capability
agents = registry.discover(skill="weather_forecast")
# β [AgentCard(name="Weather Agent", ...)]# Validate your agent implements A2A correctly
python -m a2akit.conformance http://localhost:8080
# Output:
# β Agent card served at /.well-known/agent.json
# β Card has required fields (name, description, skills)
# β POST /tasks returns valid task object
# β Task status transitions are valid
# β Streaming endpoint sends valid SSE events
# β Error responses follow A2A error schema
# PASSED: 6/6 checkspip install a2akitgraph LR
subgraph "Agent A"
CA[Client]
end
subgraph "A2A Protocol"
D[Discovery<br>GET /.well-known/agent.json]
T[Tasks<br>POST /tasks]
S[Stream<br>GET /tasks/id/stream]
end
subgraph "Agent B"
SV[Server]
SK[Skills]
end
CA -->|discover| D
CA -->|send task| T
CA -->|subscribe| S
D --> SV
T --> SV
S --> SV
SV --> SK
| Class | Purpose |
|---|---|
AgentServer |
HTTP server implementing A2A protocol |
AgentClient |
Client for calling other A2A agents |
AgentCard |
Agent capability declaration |
AgentRegistry |
Multi-agent discovery registry |
Task |
Task object with lifecycle management |
Skill |
Skill declaration with metadata |
conformance |
Test suite for protocol compliance |
Implements the full A2A specification:
- Agent Card discovery (
/.well-known/agent.json) - Task submission (
POST /tasks) - Task status polling (
GET /tasks/{id}) - Server-Sent Events streaming
- Multi-part responses (TextPart, DataPart, FilePart)
- Error schema with codes
- Input-required state for HITL flows
MIT