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.

BeginnerIntermediateExpert · 13 min read · Last updated:

In short

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.

Beginner The idea and the cast

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.

DiscoverRead the Agent Card
AskSend a message
FollowTask changes state
ReceiveArtifacts with results

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

ObjectPlain meaning
ClientThe program or agent that asks for work, usually for a user
Server (remote agent)The agent that receives requests and does the work
Agent CardA published description: identity, address, features, skills and security needs
MessageOne turn of communication, from the user side or the agent side
PartA piece of content inside a message or artifact: text, file bytes, a file address or structured data
TaskA tracked unit of work with an id, state and history
ArtifactAn output the task produces, such as a report
ContextAn 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 fieldWhat it tells the client
name, description, provider, versionWho this is and which release
supportedInterfacesAddresses, with the protocol binding and version for each
capabilitiesOptional features, such as streaming, push notifications or an extended card
skillsNamed abilities with descriptions, tags and examples
defaultInputModes, defaultOutputModesMedia types accepted and produced
securitySchemes, securityRequirementsHow to authenticate
signaturesOptional signatures that let a client verify the card's origin

Discovery and capability advertising

MethodHow it worksFits
Well-known addressFetch the card from a known domainYou already know the partner
Registry or catalogSearch a managed list of approved agentsOrganizations with many agents
Direct configurationProvide the card or address in settingsFixed, 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.

A card is a claim

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.

Intermediate Messages, tasks and results

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

SubmittedAccepted and waiting to start
WorkingIn progress
PausedInput required or authorization required
CompletedFinished successfully
Ended otherwiseFailed, canceled or rejected
A paused task resumes when the client supplies what is needed. An ended task does not restart.
StateKindClient action
TASK_STATE_SUBMITTEDActiveWait
TASK_STATE_WORKINGActiveWait; show progress
TASK_STATE_INPUT_REQUIREDInterruptedSend the requested information with the same task id
TASK_STATE_AUTH_REQUIREDInterruptedComplete authorization
TASK_STATE_COMPLETEDTerminalRead artifacts
TASK_STATE_FAILEDTerminalRead the reason; decide whether to start again
TASK_STATE_CANCELEDTerminalStop; check for partial effects
TASK_STATE_REJECTEDTerminalDo 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

MethodHowBest for
PollingGetTask at sensible intervalsSimple clients, short tasks
StreamingSendStreamingMessage, or SubscribeToTask to rejoinLive progress in an interface
Push notificationThe server calls a webhook you registeredLong 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.

Webhooks need care on both sides

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.

Expert Bindings, design and operations

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.

OperationMethod nameHTTP+JSON route
Send a messageSendMessagePOST /message:send
Send and streamSendStreamingMessagePOST /message:stream
Get one taskGetTaskGET /tasks/{id}
List tasksListTasksGET /tasks
CancelCancelTaskPOST /tasks/{id}:cancel
Rejoin a streamSubscribeToTaskGET /tasks/{id}:subscribe
Fuller cardGetExtendedAgentCardGET /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.

ErrorCodeSensible response
Task not found-32001Check the id and that you are allowed to see it
Task not cancelable-32002Read its current state; it may have ended
Push notifications not supported-32003Poll or stream instead
Unsupported operation-32004Check the card's capabilities
Content type not supported-32005Convert, or choose another agent
Version not supported-32009Send 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

  1. Fetch the card and confirm which bindings and protocol versions it lists.
  2. Confirm authentication works with a test identity of limited rights.
  3. Send a request that should finish immediately, and one that should create a task.
  4. Force an input-required pause and resume it.
  5. Cancel a running task and check what actually stopped.
  6. Send an unsupported file type and an unknown task id, and read the errors.
  7. 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

PracticeWhy
Offer a few clearly described skillsClients can choose correctly
Ask for input with a precise questionThe client can answer or pass it to a person
Make failures explain themselvesThe client knows whether to retry
Deduplicate by message id where you actNetwork retries do not repeat actions
Set and publish time and size limitsClients can plan
Keep a trace per context and taskDisputes 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.

Expert tip

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

TermReference
contextIdGroups related tasks and messages
taskIdIdentifies one unit of work
referenceTaskIdsPoints a new message at earlier tasks
returnImmediatelyAsks the server to answer without waiting for the work to finish
historyLengthLimits how much message history is returned
acceptedOutputModesMedia types the client can handle
application/a2a+jsonThe 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

Next steps