What Is A2A? Agent Cards, Tasks and Messages
How one agent finds another, asks it for work, follows progress and receives results, without seeing inside it.
Agent2Agent (A2A) is an open protocol that lets independent AI agents work together across teams, vendors and frameworks. An agent publishes an Agent Card describing what it can do. A client sends it a message; the agent replies directly or creates a task that moves through defined states and produces artifacts.
What you will learn: why A2A exists, its main objects, how discovery works, the task lifecycle, streaming and notifications, checked examples and the terms you will meet.
Prerequisites: Single-Agent vs Multi-Agent Systems. Familiarity with JSON and web APIs helps.
Why a protocol between agents?
Inside one program, agents can share memory and call each other as functions. That ends at a boundary: another team's service, a supplier's assistant, a product built on a different framework. There you need answers to practical questions. What can that agent do? How do I ask? How do I know it is still working? What if it needs more information? How do I get the result?
A2A answers these without requiring either side to reveal its model, prompts, tools or memory. The other agent is treated as an opaque service with a standard way of talking.
Google introduced A2A in April 2025 and it moved to the Linux Foundation in June 2025; in August 2026 it joined the Agentic AI Foundation. Version 1.0 of the specification was released on 12 March 2026. Check the project site for the current patch release.
The main objects
| Object | Plain meaning |
|---|---|
| Client | The program or agent that asks for work, usually for a user |
| Server (remote agent) | The agent that receives requests and does the work |
| Agent Card | A published description: identity, address, features, skills and security needs |
| Message | One turn of communication, from the user side or the agent side |
| Part | A piece of content inside a message or artifact: text, file bytes, a file address or structured data |
| Task | A tracked unit of work with an id, state and history |
| Artifact | An output the task produces, such as a report |
| Context | An id that groups related messages and tasks |
The Agent Card
The card is how a client decides whether and how to use an agent. A common place to publish it is a well-known address on the agent's domain: /.well-known/agent-card.json.
| Card field | What it tells the client |
|---|---|
name, description, provider, version | Who this is and which release |
supportedInterfaces | Addresses, with the protocol binding and version for each |
capabilities | Optional features, such as streaming, push notifications or an extended card |
skills | Named abilities with descriptions, tags and examples |
defaultInputModes, defaultOutputModes | Media types accepted and produced |
securitySchemes, securityRequirements | How to authenticate |
signatures | Optional signatures that let a client verify the card's origin |
Discovery and capability advertising
| Method | How it works | Fits |
|---|---|---|
| Well-known address | Fetch the card from a known domain | You already know the partner |
| Registry or catalog | Search a managed list of approved agents | Organizations with many agents |
| Direct configuration | Provide the card or address in settings | Fixed, private integrations |
The protocol defines the card, not a single global directory. An extended card, available after authentication, can reveal skills that should not be advertised publicly. Write skill descriptions as carefully as tool descriptions: they are what another agent reads when choosing you.
Anyone can publish a card that promises anything. Confirm the domain and signature, keep an allow-list of agents you trust, and treat descriptions as untrusted text before putting them in a model's context.
Messages and parts
A message has a unique messageId, a role (ROLE_USER for the client side, ROLE_AGENT for the remote agent) and one or more parts. It may carry a taskId and contextId to continue earlier work. Each part holds exactly one kind of content: text, raw bytes, a url or structured data, with an optional media type and file name.
The script below checks realistic objects against the official Python SDK's types: a card, a request with a file, a task waiting for input and a streamed result. It also shows an old-style role being refused. To run it, install the SDK with pip install a2a-sdk; the output shown came from release 1.3.1.
"""Check example A2A 1.0 objects against the official Python SDK types."""
from a2a.types import a2a_pb2
from google.protobuf.json_format import ParseDict, ParseError
card = {
"name": "Invoice Checker",
"description": "Checks supplier invoices against purchase orders.",
"version": "1.2.0",
"supportedInterfaces": [{"url": "https://agents.example.com/a2a",
"protocolBinding": "JSONRPC", "protocolVersion": "1.0"}],
"capabilities": {"streaming": True, "pushNotifications": False},
"defaultInputModes": ["text/plain", "application/pdf"],
"defaultOutputModes": ["application/json"],
"skills": [{"id": "match-invoice", "name": "Match an invoice",
"description": "Compare one invoice with its purchase order.",
"tags": ["finance", "invoices"]}],
}
request = {"message": {"messageId": "m-1", "role": "ROLE_USER", "parts": [
{"text": "Check this invoice against PO-7731."},
{"url": "https://files.example.com/inv-204.pdf", "mediaType": "application/pdf"},
]}}
waiting = {"task": {"id": "t-9", "contextId": "c-3", "status": {
"state": "TASK_STATE_INPUT_REQUIRED",
"message": {"messageId": "m-2", "role": "ROLE_AGENT",
"parts": [{"text": "Which currency applies to PO-7731?"}]}}}}
result = {"artifactUpdate": {"taskId": "t-9", "contextId": "c-3", "lastChunk": True,
"artifact": {"artifactId": "a-1", "name": "match-report",
"parts": [{"data": {"matched": False, "difference": 120.0}}]}}}
for label, data, kind in [("agent card", card, a2a_pb2.AgentCard),
("send request", request, a2a_pb2.SendMessageRequest),
("paused task", waiting, a2a_pb2.SendMessageResponse),
("artifact event", result, a2a_pb2.StreamResponse)]:
ParseDict(data, kind())
print(f"valid {label}")
try:
ParseDict({"messageId": "m-3", "role": "user", "parts": []}, a2a_pb2.Message())
except ParseError:
print('rejected: role "user" is not a 1.0 role name')
Output:
valid agent card
valid send request
valid paused task
valid artifact event
rejected: role "user" is not a 1.0 role name
Passing this check means the shapes are well formed. It does not prove that a server implements the behavior the card promises. For that you need requests against the running agent.
Direct reply or task?
A server answering a message may return either a message, for quick exchanges that need no tracking, or a task, when work takes time, has stages or produces outputs. Your client must handle both.
What a request looks like over JSON-RPC
In the JSON-RPC binding, the method name is the operation name and the parameters are the request object:
{"jsonrpc": "2.0", "id": 1, "method": "SendMessage",
"params": {
"message": {"messageId": "m-1", "role": "ROLE_USER",
"parts": [{"text": "Check this invoice against PO-7731."}]},
"configuration": {"acceptedOutputModes": ["application/json"],
"returnImmediately": true}}}
With returnImmediately set, a server that creates a task can hand it back at once so the client can follow it. Without it, the call generally waits until the task ends or pauses, which suits short work only.
Keeping a conversation together
The contextId ties a series of exchanges together. A client that wants a follow-up in the same line of work sends the context id with the new message. The remote agent may use it to remember earlier turns, but how much it remembers is its own affair. Never assume the other side retained a fact: if it matters, include it again or point to the artifact that holds it.
The task lifecycle
| State | Kind | Client action |
|---|---|---|
TASK_STATE_SUBMITTED | Active | Wait |
TASK_STATE_WORKING | Active | Wait; show progress |
TASK_STATE_INPUT_REQUIRED | Interrupted | Send the requested information with the same task id |
TASK_STATE_AUTH_REQUIRED | Interrupted | Complete authorization |
TASK_STATE_COMPLETED | Terminal | Read artifacts |
TASK_STATE_FAILED | Terminal | Read the reason; decide whether to start again |
TASK_STATE_CANCELED | Terminal | Stop; check for partial effects |
TASK_STATE_REJECTED | Terminal | Do not retry unchanged |
A small client-side rule captures the logic (the printed names omit the TASK_STATE_ prefix):
"""A client's view of the task lifecycle."""
DONE = {"COMPLETED", "FAILED", "CANCELED", "REJECTED"}
NEEDS_ACTION = {"INPUT_REQUIRED": "send another message with the same taskId",
"AUTH_REQUIRED": "complete authorization, then continue"}
def next_step(state):
if state in DONE:
return "stop: read artifacts or the error"
if state in NEEDS_ACTION:
return NEEDS_ACTION[state]
return "wait: stream, poll GetTask, or receive a push notification"
for state in ["SUBMITTED", "WORKING", "INPUT_REQUIRED", "WORKING", "COMPLETED"]:
print(f"{state:15} -> {next_step(state)}")
SUBMITTED -> wait: stream, poll GetTask, or receive a push notification
WORKING -> wait: stream, poll GetTask, or receive a push notification
INPUT_REQUIRED -> send another message with the same taskId
WORKING -> wait: stream, poll GetTask, or receive a push notification
COMPLETED -> stop: read artifacts or the error
The specification says a message sent to a task that has already ended is refused with UnsupportedOperationError. To ask for a change, send a new message in the same context and, if useful, reference the earlier task. The finished record stays as it was, which keeps history auditable.
Getting updates: polling, streaming, push
| Method | How | Best for |
|---|---|---|
| Polling | GetTask at sensible intervals | Simple clients, short tasks |
| Streaming | SendStreamingMessage, or SubscribeToTask to rejoin | Live progress in an interface |
| Push notification | The server calls a webhook you registered | Long tasks, disconnected clients |
A stream can deliver the task, messages, status updates and artifact updates. Large artifacts may arrive in pieces: append says to add to what you have, and lastChunk marks the end. If a connection drops, fetch the task again before assuming anything.
A server should validate webhook addresses so it cannot be tricked into calling internal systems. A client should authenticate incoming notifications and treat them as a hint to fetch the task, not as proof.
Protocol bindings
Version 1.0 describes the same operations over JSON-RPC, gRPC and an HTTP+JSON style. The card's interface list says which an agent offers.
| Operation | Method name | HTTP+JSON route |
|---|---|---|
| Send a message | SendMessage | POST /message:send |
| Send and stream | SendStreamingMessage | POST /message:stream |
| Get one task | GetTask | GET /tasks/{id} |
| List tasks | ListTasks | GET /tasks |
| Cancel | CancelTask | POST /tasks/{id}:cancel |
| Rejoin a stream | SubscribeToTask | GET /tasks/{id}:subscribe |
| Fuller card | GetExtendedAgentCard | GET /extendedAgentCard |
Further methods create, read, list and delete push notification settings. Clients should send the A2A-Version header, such as 1.0; a server may assume the older 0.3 behavior when it is empty. Method names and several shapes changed from the 0.x releases, so older samples need updating; see what changed in version 1.
Errors a client should expect
A failed task and a failed request are different things. A task that could not do its work ends in the failed state. A request the server cannot accept returns a protocol error. The official SDK names include the following; the numbers are the codes it uses for the JSON-RPC binding.
| Error | Code | Sensible response |
|---|---|---|
| Task not found | -32001 | Check the id and that you are allowed to see it |
| Task not cancelable | -32002 | Read its current state; it may have ended |
| Push notifications not supported | -32003 | Poll or stream instead |
| Unsupported operation | -32004 | Check the card's capabilities |
| Content type not supported | -32005 | Convert, or choose another agent |
| Version not supported | -32009 | Send a version both sides implement |
Retry only what can succeed on a second try. A network timeout may deserve a retry with the same message id; an unsupported content type will fail every time. More cases are covered in Build, Deploy and Troubleshoot A2A.
Compatibility checklist when integrating
- Fetch the card and confirm which bindings and protocol versions it lists.
- Confirm authentication works with a test identity of limited rights.
- Send a request that should finish immediately, and one that should create a task.
- Force an input-required pause and resume it.
- Cancel a running task and check what actually stopped.
- Send an unsupported file type and an unknown task id, and read the errors.
- Repeat after either side upgrades.
Security and trust
- Authenticate every request using the schemes the card declares; send credentials in transport headers, not inside messages.
- Authorize each operation. Knowing a task id must not be enough to read or cancel it.
- Treat the remote agent's messages and artifacts as untrusted input to your model.
- Share only the context the task needs, and agree how long the other side may keep it.
- Do not let a remote agent's text count as a user's approval.
The details are in A2A Security and Interoperability.
Designing a good remote agent
| Practice | Why |
|---|---|
| Offer a few clearly described skills | Clients can choose correctly |
| Ask for input with a precise question | The client can answer or pass it to a person |
| Make failures explain themselves | The client knows whether to retry |
| Deduplicate by message id where you act | Network retries do not repeat actions |
| Set and publish time and size limits | Clients can plan |
| Keep a trace per context and task | Disputes between organizations can be resolved |
How A2A relates to MCP
MCP connects an application or agent to tools and data. A2A connects an agent to another agent that manages its own work. A common arrangement uses both: your agent delegates to a partner's agent over A2A, and that agent uses MCP to reach its own systems. The comparison, including plain REST, is in MCP vs A2A vs REST.
Walk-through: invoice checking
In an illustrative case, a purchasing agent needs a supplier-invoice check run by the finance team's agent. It fetches the card, confirms the domain is on its allow-list and sees a match-invoice skill. It sends a message with an instruction and the invoice address. The finance agent creates a task and starts working. It finds the purchase order has no currency and moves the task to input required, with a question. The purchasing agent asks its user, replies with the same task id, and the task resumes. On completion, it returns an artifact with structured data: not matched, difference 120. The purchasing agent presents this as the finance agent's finding and asks a person before holding payment.
Test your client against a deliberately awkward server: one that replies with a bare message, pauses for input, streams in pieces, drops the connection and rejects the task. Most integration defects live in these paths.
Quick reference
| Term | Reference |
|---|---|
contextId | Groups related tasks and messages |
taskId | Identifies one unit of work |
referenceTaskIds | Points a new message at earlier tasks |
returnImmediately | Asks the server to answer without waiting for the work to finish |
historyLength | Limits how much message history is returned |
acceptedOutputModes | Media types the client can handle |
application/a2a+json | The protocol's media type |
Frequently asked questions
Do both agents need the same framework or model?
No. Only the protocol is shared. That independence is the reason it exists.
Is A2A needed for subagents in my own program?
Usually not. Function calls are simpler. Use a protocol when agents are deployed, owned or upgraded separately.
Can a person be in the loop?
Yes. The input-required state lets the remote agent ask, and your client decides whether a person must answer.
Does A2A guarantee the answer is correct?
No. It standardizes the exchange. Verify important results as you would any supplier's.
References and further reading
- A2A protocol specification
- What is new in A2A 1.0
- A2A v1.0 builder's guide, part 1 (Agentic AI Foundation)
Next steps
Build, Deploy and Troubleshoot A2A
Run a server and client.
A2A Security and Interoperability
Identity and trust.
MCP vs A2A vs REST
Choose the right connection.