A2A Protocol v1.0.1 with Python SDK 1.3.1: Build Agent-to-Agent Workflows (2026 Guide)
Two AI agents can each work perfectly and still fail to collaborate. One lives inside your support platform, another belongs to a billing provider, and a third runs in a partner's cloud. A normal function call assumes you control the function. An MCP connection gives an agent tools and data. Neither automatically gives two independent agents a shared way to discover capabilities, hand off long-running work, exchange progress, and resume a conversation.
That is the problem the Agent2Agent (A2A) Protocol is designed to address. A2A gives independently built agents a common task-oriented communication layer. In this guide, you will build a small Python agent, publish its Agent Card, call it from a separate client, and understand the production decisions hidden behind the first successful request.
Version snapshot — November 30, 2026: the latest released A2A protocol specification is v1.0.1 (released May 26, 2026; GitHub release published May 28). The official Python SDK's latest release is 1.3.1 (released November 16 and published November 17). These are different version numbers: the SDK package is 1.3.1, while the protocol version negotiated on the wire is 1.0. The specification uses the major/minor value in the A2A-Version header; patch releases do not change protocol compatibility.
Who should read this?
- Python developers connecting agents owned by different teams, vendors, or services.
- Backend engineers building task delegation, specialist-agent networks, or asynchronous AI services.
- Teams deciding where A2A fits beside MCP, LangGraph, queues, and ordinary APIs.
- Platform engineers who need Agent Card discovery, streaming, task state, authentication, and version compatibility.
What you will build
The walkthrough creates a small support-ticket triage agent. It accepts a text request, creates an A2A task, emits progress, and returns a structured result as an artifact. The example uses deterministic Python logic so you can run the protocol flow without a model API key. You can replace that business function with an LLM call or an existing agent framework without changing the A2A transport layer.
Separate client
|
| fetch Agent Card
| SendMessage / SendStreamingMessage
v
A2A server
|
+-- Agent Card and protocol routes
|
+-- RequestHandler
|
+-- TaskStore
|
+-- AgentExecutor
|
+-- your existing agent / LLM / tools
|
+-- TaskUpdater
|
+-- status events
+-- result artifacts
Prerequisites
- Python 3.10 or newer; the official tutorial currently verifies its pinned walkthrough with Python 3.12.
- A terminal, a virtual environment, and basic async Python knowledge.
uvorpipfor installing packages.- Two terminal windows so the server and client can run separately.
- No paid model account is required for this deterministic example.
A2A vs MCP vs a normal function call
These technologies solve different integration problems. A2A is not a replacement for MCP, and MCP is not a requirement for every A2A agent.
| Approach | What it connects | Use it when | What it does not provide by itself |
|---|---|---|---|
| Function call / REST API | Your application to a known function or service | You control both sides and need a narrow request/response contract | Agent discovery, shared task lifecycle, agent capability negotiation |
| MCP | An AI application or agent to tools, data, and resources | An agent needs database access, search, files, APIs, or reusable tools | A general peer-to-peer agent delegation model |
| A2A | One independent agent to another independent agent | Agents need to discover one another, delegate tasks, exchange artifacts, and track progress | Model selection, tool execution policy, durable business workflows, or authorization policy |
A useful mental model is that MCP adds depth to an agent by connecting it to its tools, while A2A adds reach by connecting it to other agents. A support agent might use MCP to query its own ticket database, then use A2A to delegate a billing investigation to a separate billing agent. See the official A2A and MCP comparison and our broader MCP guide.
Understand the A2A building blocks first
Agent Card
An A2A server publishes an Agent Card, normally at /.well-known/agent-card.json. It describes the agent's identity, skills, supported interfaces, input and output modes, capabilities, and security requirements. Clients should discover the endpoint from the card rather than hard-code an RPC URL.
Message, Task, Context, and Artifact
- Message: a unit of communication between the client and agent.
- Task: a tracked unit of work that can move through submitted, working, interrupted, and terminal states.
- contextId: groups related messages and tasks into a wider conversation or business interaction.
- taskId: identifies one particular unit of work.
- Artifact: the output produced by a task, such as text, JSON, or a file reference.
A short exchange may return a Message. Work that needs progress tracking, clarification, authorization, or an output artifact should use a Task. Once a task reaches a terminal state, it is not restarted; a follow-up should create a new task in the same context when appropriate. Do not confuse a status message such as “working” with the actual result artifact.
Protocol version is not the SDK version
Keep three numbers separate in your project:
- Protocol: the selected Agent Interface declares
protocolVersion: "1.0"; requests useA2A-Version: 1.0. - Python SDK: the installed package in this walkthrough is
a2a-sdk==1.3.1. - Your agent: the Agent Card's
versionis your application's release number, such as0.1.0.
The v1.0 protocol moved interface details into the ordered supportedInterfaces array. A v0.3 Agent Card with a top-level URL and protocol version is not the same shape. The official SDK supports v1.0 and a compatibility mode for v0.3 across its listed transports, but compatibility should be tested rather than assumed.
Step 1: Create the Python environment
Make a project directory and create a virtual environment:
mkdir a2a-ticket-agent
cd a2a-ticket-agent
python -m venv .venv
# macOS / Linux
source .venv/bin/activate
# Windows PowerShell
# .\.venv\Scripts\Activate.ps1
Install the A2A SDK with its HTTP server extra, plus the ASGI server and HTTP client used by the examples:
python -m pip install "a2a-sdk[http-server]==1.3.1" uvicorn httpx
For a repeatable deployment, commit a lockfile and pin all direct dependencies after resolving them in your own environment. The official SDK provides optional integrations for FastAPI/Starlette, gRPC, OpenTelemetry, and SQL database drivers. Install only the extras you actually need.
Step 2: Define the agent's skill and public Agent Card
The skill is the discoverable description of what this service can do. Keep it accurate: a client may use the card to decide whether to send a task to your agent.
# server.py
import uvicorn
from starlette.applications import Starlette
from a2a.server.request_handlers import DefaultRequestHandler
from a2a.server.routes import (
create_agent_card_routes,
create_jsonrpc_routes,
)
from a2a.server.tasks import InMemoryTaskStore
from a2a.types import (
AgentCapabilities,
AgentCard,
AgentInterface,
AgentSkill,
)
from executor import TicketTriageExecutor
skill = AgentSkill(
id="ticket_triage",
name="Support Ticket Triage",
description="Classifies a support ticket and suggests its next queue.",
tags=["support", "triage", "classification"],
examples=[
"A customer cannot sign in after resetting a password",
"A refund is missing from the customer's statement",
],
input_modes=["text/plain"],
output_modes=["text/plain"],
)
public_card = AgentCard(
name="Support Triage Agent",
description="Classifies support requests and returns a triage recommendation.",
version="0.1.0",
default_input_modes=["text/plain"],
default_output_modes=["text/plain"],
capabilities=AgentCapabilities(streaming=True),
supported_interfaces=[
AgentInterface(
protocol_binding="JSONRPC",
url="http://127.0.0.1:9999",
protocol_version="1.0",
)
],
skills=[skill],
)
handler = DefaultRequestHandler(
agent_executor=TicketTriageExecutor(),
task_store=InMemoryTaskStore(),
agent_card=public_card,
)
routes = [
*create_agent_card_routes(public_card),
*create_jsonrpc_routes(handler, "/"),
]
app = Starlette(routes=routes)
if __name__ == "__main__":
uvicorn.run(app, host="127.0.0.1", port=9999)
The interface URL is the address a client will use for JSON-RPC. The example binds to loopback, so it is intentionally local-only. When deploying behind a proxy or ingress, publish the externally reachable HTTPS URL in the card and configure the proxy to forward the A2A routes correctly.
Step 3: Implement the AgentExecutor
The SDK's AgentExecutor is the bridge between protocol requests and your business logic. The request handler manages protocol operations; the executor performs the actual task and emits events through a TaskUpdater.
# executor.py
import logging
from a2a.helpers import (
get_message_text,
new_task_from_user_message,
new_text_message,
new_text_part,
)
from a2a.server.agent_execution import AgentExecutor, RequestContext
from a2a.server.events import EventQueue
from a2a.server.tasks import TaskUpdater
from a2a.types import TaskState
logger = logging.getLogger(__name__)
def triage_ticket(text: str) -> str:
"""Small deterministic example; replace with your agent implementation."""
value = text.lower()
if any(word in value for word in ("refund", "invoice", "payment", "charged")):
queue = "billing"
elif any(word in value for word in ("login", "password", "sign in", "account")):
queue = "account-support"
else:
queue = "general-support"
priority = "high" if any(
word in value for word in ("blocked", "urgent", "outage", "cannot access")
) else "normal"
return (
f"Suggested queue: {queue}\n"
f"Suggested priority: {priority}\n"
"Next step: verify the customer record before taking action."
)
class TicketTriageExecutor(AgentExecutor):
async def execute(
self,
context: RequestContext,
event_queue: EventQueue,
) -> None:
# Continue the existing task when this is a follow-up message.
task = context.current_task
if task is None:
task = new_task_from_user_message(context.message)
await event_queue.enqueue_event(task)
updater = TaskUpdater(
event_queue=event_queue,
task_id=task.id,
context_id=task.context_id,
)
await updater.update_status(
state=TaskState.TASK_STATE_WORKING,
message=new_text_message("Classifying the support request..."),
)
try:
query = get_message_text(context.message)
if not query.strip():
raise ValueError("A non-empty text request is required.")
# Replace this call with your existing LLM or agent framework.
result = triage_ticket(query)
await updater.add_artifact(
parts=[new_text_part(text=result, media_type="text/plain")]
)
await updater.update_status(
state=TaskState.TASK_STATE_COMPLETED,
message=new_text_message("Triage completed."),
)
except Exception:
logger.exception("Ticket triage task failed")
await updater.update_status(
state=TaskState.TASK_STATE_FAILED,
message=new_text_message(
"The request could not be completed. Check the service logs."
),
)
async def cancel(
self,
context: RequestContext,
event_queue: EventQueue,
) -> None:
# This demo has no cancellable background operation.
raise NotImplementedError("Cancellation is not implemented in this demo.")
Notice the important lifecycle decisions:
- When a task already exists, the executor reuses it rather than creating a disconnected task.
- The task is marked working before business logic runs.
- The useful result is added as an artifact.
- Success and failure end in different terminal states.
- The cancellation method explicitly says it is unsupported. A production implementation should cancel the underlying model request, queue job, or external operation rather than merely changing the visible status.
The deterministic classifier is deliberately not presented as an LLM. To integrate a model, replace triage_ticket() with an async call to your chosen provider or framework, validate the returned fields, and preserve the same task and artifact lifecycle. A2A does not prescribe which model runs behind the agent.
Step 4: Start the server and inspect discovery
Run:
python server.py
In another terminal, fetch the public card:
curl http://127.0.0.1:9999/.well-known/agent-card.json
Check that the response describes the expected name, skill, input/output modes, capability, and supportedInterfaces entry. A successful card fetch proves discovery works; it does not yet prove the RPC endpoint can execute a task.
Step 5: Build a client that discovers before calling
The official Python client provides A2ACardResolver to fetch the card and create_client to construct a client from the discovered capabilities.
# client.py
import asyncio
import httpx
from a2a.client import A2ACardResolver, ClientConfig, create_client
from a2a.helpers import new_text_message
from a2a.types import Role, SendMessageRequest
async def main() -> None:
async with httpx.AsyncClient() as httpx_client:
resolver = A2ACardResolver(
httpx_client=httpx_client,
base_url="http://127.0.0.1:9999",
)
card = await resolver.get_agent_card()
client = await create_client(
agent=card,
client_config=ClientConfig(streaming=False),
)
try:
message = new_text_message(
"Customer is blocked and cannot sign in after a password reset.",
role=Role.ROLE_USER,
)
request = SendMessageRequest(message=message)
async for response in client.send_message(request):
print(response)
finally:
await client.close()
if __name__ == "__main__":
asyncio.run(main())
Run the client:
python client.py
Inspect the returned object rather than treating an HTTP 200 as proof of success. For a Task response, check its state and read the artifact parts. The status message “Triage completed” is progress metadata; the suggested queue and priority are the actual result.
Step 6: Turn on streaming for longer work
For a long-running agent, progress can be more useful than waiting for one final response. A2A supports streaming updates when the agent advertises streaming and the selected interface supports it.
streaming_client = await create_client(
agent=card,
client_config=ClientConfig(streaming=True),
)
try:
async for event in streaming_client.send_message(request):
print(event)
finally:
await streaming_client.close()
Streaming can deliver the initial task, status updates, artifact updates, and the final state as they happen. A disconnected client should not assume it received every event. For recovery, keep the task identifier and use the task retrieval or subscription operations supported by the agent. For clients that cannot keep a stream open, A2A also defines push-notification configuration for webhook delivery.
Step 7: Design follow-ups and long-running tasks correctly
Use contextId to group related work and taskId to refer to one execution. A follow-up can use the same context and reference an earlier task or artifact. If the earlier task is already completed, create a new task rather than trying to restart the terminal one.
For a production research workflow, a sensible sequence might be:
- The coordinator agent discovers a research agent from its Agent Card.
- The coordinator sends a task and stores the returned task and context IDs.
- The research agent reports working status and streams intermediate artifacts.
- The coordinator subscribes again after a network interruption or retrieves the task state.
- The coordinator creates a new follow-up task in the same context when it needs revisions.
- The final result is validated and accepted by the coordinator before it is shown or used.
A2A provides the communication and task model, not your complete workflow engine. If the process must survive worker loss, coordinate timers, enforce retries, or run for hours or days, use a durable workflow system behind the agent. Our Temporal vs Celery guide explains that separate orchestration decision.
Step 8: Choose a transport and deployment model
The Python SDK lists support for JSON-RPC, HTTP+JSON/REST, and gRPC. The Agent Card's supportedInterfaces array is ordered; clients select a compatible interface and use its URL and declared protocol version.
| Binding | Practical fit | Trade-off |
|---|---|---|
| JSON-RPC over HTTP | Simple agent-to-agent calls and streaming with SSE | Requires JSON-RPC-aware clients and careful proxy handling |
| HTTP+JSON / REST | Teams that prefer resource-oriented HTTP routes and standard HTTP tooling | Confirm the exact endpoint mapping and media types in the selected SDK version |
| gRPC | Typed service contracts and environments already standardized on gRPC | Requires gRPC-aware infrastructure, clients, and operational tooling |
For a single-process demo, InMemoryTaskStore is convenient. It is not a production persistence strategy: process restarts discard its state, and multiple replicas do not share it. Move to a supported persistent store or a deliberately designed shared task backend before running multiple instances. Add health checks, request limits, structured logs, tracing, and an explicit retention policy for task history and artifacts.
Where A2A fits with agent frameworks
A2A does not compete directly with LangGraph, PydanticAI, the OpenAI Agents SDK, or Google ADK. Those frameworks help you build the agent's internal reasoning, tools, and control flow. A2A gives that agent a standard external interface so another system can discover and delegate to it.
- Use an agent framework inside the executor to implement planning and tool use.
- Use MCP inside the agent when it needs tools, files, or data services.
- Expose an A2A server when another independent agent should delegate work to it.
- Use a workflow engine when the overall business process needs durable orchestration beyond the A2A task lifecycle.
For internal approval logic, compare the A2A task states with the interrupt/resume design in our LangGraph human-in-the-loop deep dive. A protocol-level task state is not a substitute for your application's own approval record.
Security and privacy checklist
- Use HTTPS or TLS: the A2A specification requires encrypted communication in production. Verify server certificates and do not disable TLS checks to work around certificate errors.
- Authenticate every request: declare supported security schemes in the Agent Card and enforce them on the server. A public Agent Card is a discovery document, not an authorization grant.
- Authorize by identity and action: decide which authenticated principal can invoke each skill, access each tenant, or perform each business operation. Do not trust a client-supplied tenant string as proof of identity.
- Handle in-task authorization carefully:
TASK_STATE_AUTH_REQUIREDsignals that more authorization is needed. The protocol does not define the scope, validity, or revocation semantics of the credential. A state transition alone must never authorize a payment, deletion, or privileged tool call. - Keep credentials out of messages: obtain secrets through a secure out-of-band flow where possible. Passing credentials through a chain of agents can expose them to every agent in that chain.
- Validate Agent Cards: use trusted discovery sources, allowlist expected domains, validate signatures if your deployment relies on signed cards, and prevent untrusted URLs from becoming arbitrary outbound requests.
- Protect webhooks: authenticate push-notification delivery, validate sender and task identity, limit retries, and defend webhook registration against server-side request forgery.
- Treat remote output as untrusted: an agent's artifact may contain prompt injection, malicious links, or misleading instructions. Validate outputs before passing them to another agent or executing them.
- Minimize retained data: avoid storing raw credentials or unnecessary personal data in task history, logs, traces, and artifacts. Apply tenant scoping and retention rules to the task store.
Common problems and fixes
| Symptom | Likely cause | What to check |
|---|---|---|
| Agent Card returns 404 | Wrong base URL, reverse-proxy path, or card route | Fetch /.well-known/agent-card.json directly and compare the public URL with the card configuration |
| Card loads but message call fails | The advertised interface URL or binding does not match the server routes | Check supportedInterfaces, JSON-RPC route prefix, and the selected protocol version |
| Version-not-supported error | Client sends a protocol version the selected interface does not implement | Read protocolVersion from the chosen interface and send the matching A2A-Version value |
| Streaming produces no events | Streaming is not advertised, proxy buffering is enabled, or the client is configured for non-streaming | Check card capabilities, ClientConfig(streaming=True), SSE proxy settings, and server logs |
| Task disappears after restart | The example uses InMemoryTaskStore | Use a persistent task store and test recovery after a process restart |
| Task remains working forever | Executor failed before emitting a terminal state or a worker died | Log task IDs, handle exceptions, implement cancellation/recovery, and define stale-task reconciliation |
| Duplicate external action after retry | The client resubmitted after a timeout without checking the first request | Use message IDs, application idempotency keys, task lookup, and idempotent downstream operations |
| Client cannot use a skill | Input/output modes or skill description do not match the actual implementation | Keep Agent Card declarations synchronized with supported payload types and behavior |
Trade-offs and limitations
- Interoperability is not automatic: both sides still need compatible protocol versions, bindings, authentication, and payload handling.
- A2A does not standardize the agent's reasoning: two agents may interpret the same request differently. Use explicit skill descriptions, examples, and output validation.
- Durability is an implementation concern: task identifiers and states do not guarantee that your worker, model call, or external side effect survives a crash.
- Discovery adds operational work: Agent Cards need versioning, caching, endpoint lifecycle management, and trust decisions.
- More agents mean more boundaries: each handoff adds latency, cost, failure modes, and a new authorization decision. Do not split one simple function into a network of agents without a reason.
Frequently asked questions
Is A2A a replacement for MCP?
No. MCP connects agents to tools and resources. A2A connects independent agents to one another. A system can use both: an A2A specialist agent can use MCP internally to access its own approved tools.
Does an A2A agent have to use an LLM?
No. A2A defines communication, discovery, and task interaction. The example in this article uses deterministic Python logic. A server can wrap an LLM, a rules engine, a human-operated service, or another application.
What is the latest A2A protocol version?
As of November 30, 2026, the latest released specification listed by the official project is v1.0.1. Clients negotiate the major/minor protocol version, so the interface and request header use 1.0.
Why is the Python SDK version 1.3.1 if the protocol is 1.0.1?
They version different things. The protocol version describes the wire contract. The Python SDK version describes the implementation package and its API. Your own agent's version is a third, independent value in the Agent Card.
Can I use A2A with LangGraph or another agent framework?
Yes. Implement an A2A AgentExecutor that calls your framework, translates its progress and results into task events and artifacts, and exposes the server through an A2A binding. The protocol does not require a particular framework.
Does A2A guarantee exactly-once execution?
No. The specification says send operations may be idempotent and an agent may use messageId to detect duplicates. Your application still needs idempotency keys, durable records, and reconciliation for side effects such as payments or bookings.
Should every agent expose a public Agent Card?
Every A2A server must make an Agent Card available to its intended clients, but discovery can be private. Use authenticated endpoints, private registries, network controls, and signed cards where appropriate. Do not publish internal capabilities to the public internet by default.
When should I use a queue or workflow engine instead?
Use a queue or workflow engine when your main problem is internal job execution, durable retries, timers, or long-running business orchestration. Use A2A when another independent agent needs a standard way to discover and interact with that capability. They can be used together.
Primary sources and further reading
- A2A Protocol v1.0.1 release notes — protocol specification fixes and release history.
- A2A v1.0 protocol specification — operations, task states, versioning, Agent Cards, bindings, and security requirements.
- What's new in A2A v1.0 — breaking changes from the earlier protocol format.
- Official Python SDK v1.3.1 release — release date, httpx2 support, cluster context, and fixes.
- Official A2A Python SDK repository — supported transports, compatibility, installation extras, and samples.
- Official Python Hello World sample — Agent Card, executor, server, and client implementation reference.
- Official A2A and MCP comparison — when to use each protocol and how they complement one another.
- A2A task lifecycle guide — messages, tasks, contexts, follow-ups, and terminal states.
Final recommendation
Start with one A2A server and one client, publish a truthful Agent Card, and prove the complete task lifecycle before introducing a multi-agent network. Keep the model and tools behind the executor, make task persistence explicit, and enforce authorization at the server boundary. A2A is most useful when two independently operated agents genuinely need to collaborate—not when a normal function call would be simpler.
