Applies to v1.3.18

Calling Agents Over A2A

Purpose

This page is for an orchestrator or another agent that delegates work to one of your agents over A2A (Agent2Agent 1.0). It covers the whole round trip: discovering the agent, sending it a message, waiting for the answer or following the task, answering a question the agent asks back, and being told when a task finishes. How agents, tasks and transports behave in detail is in the A2A chapter.

A2A reaches agents, not tools. A tool cannot be called over A2A; to call tools, use MCP, the tools API or an SDK. An agent decides for itself what to do with your message — a hosted agent reasons with a model and calls the tools its administrator gave it; a remote agent relays your message to a peer the platform governs.

Before You Start

You need, from your platform administrator:

  • the agent's address — https://{agent}-{tenant}.{agents root}, for example https://helpdesk-acme.agents.example.com (see Agent Addresses);
  • a credential: a bearer token or an API key of the agent's tenant (see Authentication);
  • access: the agent's access policies must allow your caller. A caller authorized for none of the agent's skills is refused outright, before any task is created.

The agent must also be published. An unpublished agent's address answers 404, exactly like one that does not exist.

AGENT=https://helpdesk-acme.agents.example.com
AUTH="Authorization: Bearer <access-token>"

1. Discover The Agent

The public Agent Card needs no credential. It names the agent, its transports, how to authenticate and every skill the agent has:

curl "$AGENT/.well-known/agent-card.json"

The public card says what the agent can do for somebody, not what you may do. Once authenticated, ask for the extended card, which lists only the skills your caller is authorized for:

curl "$AGENT/agent-card/extended" -H "$AUTH"

A spec-conforming client can get the same content by sending GetExtendedAgentCard to the agent's JSON-RPC endpoint. The card's supportedInterfaces lists the three transports — JSONRPC, HTTP+JSON and GRPC — all at the agent's address. See A2A Agent Card Discovery, including how to verify the card's signature.

2. Send A Message

A message is A2A's own: a role, one or more parts, and your own messageId. It names no skill — choosing what to do is the agent's job.

JSON-RPC (POST /):

curl -X POST "$AGENT/" -H "$AUTH" -H "Content-Type: application/json" \
  -H "X-Correlation-Id: ticket-8812" \
  -d '{
        "jsonrpc": "2.0",
        "id": 1,
        "method": "SendMessage",
        "params": {
          "message": {
            "role": "ROLE_USER",
            "messageId": "6d1f0c52-1b7e-4a53-9a51-0d6c2f0b9e10",
            "parts": [ { "text": "Which open orders does customer C-1001 have?" } ]
          },
          "configuration": { "returnImmediately": true }
        }
      }'

REST (POST /message:send) takes the same params object as its body:

curl -X POST "$AGENT/message:send" -H "$AUTH" -H "Content-Type: application/json" \
  -d '{
        "message": {
          "role": "ROLE_USER",
          "messageId": "6d1f0c52-1b7e-4a53-9a51-0d6c2f0b9e10",
          "parts": [ { "text": "Which open orders does customer C-1001 have?" } ]
        },
        "configuration": { "returnImmediately": true }
      }'

gRPC uses the service lf.a2a.v1.A2AService from the A2A specification's own a2a.proto, with the same methods. Pass the bearer token as the authorization call credential; gRPC needs HTTP/2 end to end.

The answer wraps a task. Over JSON-RPC the result is {"task": {…}}; over REST the body is the same object:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {
    "task": {
      "id": "<task-id>",
      "contextId": "<context-id>",
      "status": { "state": "TASK_STATE_SUBMITTED", "timestamp": "2026-10-31T09:15:02.0000000+00:00" }
    }
  }
}

Keep the task id: it is how you follow, continue or cancel the work. An optional A2A-Version header, when sent, must be 1.0.

Waiting or returning immediately

configuration.returnImmediately decides whether the call waits:

  • absent or false — the A2A default: the call returns only when the task finishes or pauses for you (TASK_STATE_COMPLETED, TASK_STATE_FAILED, TASK_STATE_INPUT_REQUIRED …), carrying that state and the result. A hosted agent can take up to its turn budget — five minutes by default — so every proxy between you and the platform must allow a connection to stay idle that long.
  • true — the call returns as soon as the task exists, in TASK_STATE_SUBMITTED, and you follow it as below.

Prefer true for anything that may take more than a few seconds, and for any caller behind infrastructure with short idle timeouts.

3. Follow The Task

Three ways, which can be combined:

Poll with GetTask. A finished task carries the agent's answer as its artifact; a paused or failed one carries the agent's words on status.message.

# JSON-RPC
curl -X POST "$AGENT/" -H "$AUTH" -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":2,"method":"GetTask","params":{"id":"<task-id>"}}'

# REST
curl "$AGENT/tasks/<task-id>" -H "$AUTH"

Stream with SubscribeToTask (JSON-RPC, or POST /tasks/{id}:subscribe), or send the message with SendStreamingMessage (POST /message:stream) in the first place. Both answer with Server-Sent Events: one frame per status the task reaches, each a whole task snapshot, and the stream closes when the task finishes or pauses for you. What streams is the task's status, not the model's tokens.

Be told with a push notification. Register a webhook inline, on the message that creates the task:

"configuration": {
  "returnImmediately": true,
  "taskPushNotificationConfig": {
    "url": "https://hooks.example.com/a2a/task-updates",
    "authentication": { "scheme": "Bearer", "credentials": "<token-your-endpoint-checks>" }
  }
}

The platform posts to your URL when the task finishes or pauses for you, presenting the credential you gave so your endpoint can recognize the delivery. The webhook host must be on the platform's outbound allowlist, which your operator maintains. A configuration can also be registered against an existing task with CreateTaskPushNotificationConfig. See Push notifications and A2A Push Notifications.

To see what an agent has been doing, ListTasks (GET /tasks) pages through its tasks, newest status change first, filtered by contextId, status or statusTimestampAfter.

4. Answer A Question From The Agent

A hosted agent that needs something only you can give pauses the task in TASK_STATE_INPUT_REQUIRED, with its question on status.message. Answer by sending a new message that names the task:

"message": {
  "role": "ROLE_USER",
  "messageId": "0b7a4c1e-58d2-4f0e-8f3b-7a2d9c6e1f44",
  "taskId": "<task-id>",
  "parts": [ { "text": "Only orders from this year, please." } ]
}

The agent continues that same task and conversation. You do not need to send the contextId; if you do, it must be the task's. A message naming a task that has already finished is refused — start a new task instead — and one naming a task the agent is still working on is refused until it pauses or finishes.

5. Cancel

curl -X POST "$AGENT/tasks/<task-id>:cancel" -H "$AUTH"

or CancelTask with {"id": "<task-id>"} over JSON-RPC. A task that has already finished cannot be cancelled and answers the A2A "task not cancelable" error.

What To Put In A Message

A message part is text ({"text": "…"}), structured data ({"data": {…}}) or a file ({"url": "…", "filename": "…", "mediaType": "…"}).

  • A remote agent receives your message as you sent it, every part included.
  • A hosted agent reads every text and data part, in order. Text parts reach its model as written; each data part arrives as a labelled JSON block, re-serialized so its content cannot break out of the block. A data part whose metadata has "untrusted": true is labelled as data from an external system, to act on rather than obey. A file part is listed by name and media type only: its content is never fetched.

Never put a credential in a message. A hosted agent reaches downstream systems with credentials its administrator configured, never with anything a caller supplies, and it never asks a caller for one.

As Whom The Work Runs

The task runs as you: the caller identified by your token or API key. The agent's access policies are evaluated against you, every tool the agent calls is authorized and audited as you, and a tool that acts on a downstream system on the user's behalf does so for your user — which requires a user token, not an application one. See User And Application Callers.

Starting A Hosted Agent Without A Conversation

To start a hosted agent from an event, on a timetable, or with a single request that does not need the A2A protocol, see Starting Agents From Webhooks, Scheduled Runs and On-Demand Agent Runs. Every A2A turn with a hosted agent is also recorded as an execution, visible with the others on the Agent Triggers page.

When Something Fails

JSON-RPC errors, REST problem details and failed tasks are described in Errors, Limits & Correlation. Two cases specific to A2A are worth knowing up front:

  • a hosted agent that runs out of time, or a message that arrives while the agent's work queue is full, produces a failed task with the reason on status.message, not an HTTP error;
  • re-sending a message whose connection dropped starts a second task. Follow the first one with GetTask instead, if you received its id.