How A2A works
The A2A (Agent-to-Agent) protocol lets AI agents discover, understand, and invoke each other’s capabilities through a standard Agent Card and JSON-RPC transport.
Runtype A2A Surfaces speak the A2A Protocol v1.0 wire format. Use the v1.0 PascalCase method names, ProtoJSON enum values, and member-presence message parts shown below.
Discovery phase
External agents discover your capabilities by fetching the Agent Card:
The Agent Card describes your product’s identity, skills, supported interfaces, and authentication schemes. It is publicly accessible so agents can discover the surface before they send an authenticated invocation.
Invocation phase
Once discovered, external agents invoke capabilities by sending JSON-RPC requests to the A2A endpoint:
The canonical v1.0 methods are:
SendMessage— execute a task synchronously.SendStreamingMessage— execute a task with SSE streaming.GetTask— fetch a task by ID.ListTasks— list tasks with cursor pagination.CancelTask— cancel a running task.SubscribeToTask— resume an SSE stream for a task.
Runtype is tolerant of legacy slash-string method aliases from older A2A clients, but new clients should use the v1.0 method names above.
Authentication uses either header:
Authorization: Bearer a2a_xxxX-API-Key: a2a_xxx
Orchestrated routing
When an A2A Surface uses Managed orchestration, the external agent does not need to choose a specific skill. Instead:
- The external agent sends a natural-language request.
- Runtype analyzes the request against the Product’s capabilities.
- Runtype routes to the right Flow or Agent.
- The A2A task response is returned to the requesting agent.
Use Delegate mode when each capability should be exposed as a distinct skill and the caller should choose the skill itself. Use Managed mode when you want one product-level entry point.
Protocol standards
Runtype’s exposed A2A Surface follows the A2A Protocol v1.0.
Key wire-format details:
- JSON-RPC 2.0 transport for every method.
- Message parts use member presence:
{ "text": "..." },{ "data": { ... } },{ "url": "https://..." }, or{ "raw": "base64..." }. Do not add akinddiscriminator for new v1.0 clients. - Roles use
ROLE_USERandROLE_AGENT. - Task states use
TASK_STATE_*enum values. - Unary
SendMessagereturns aSendMessageResponseobject with ataskmember. - Streaming methods emit JSON-RPC response envelopes whose
resultcontains astatusUpdateorartifactUpdatemember. There is nofinalflag; the terminal state and stream close indicate completion. - Errors use JSON-RPC
errorwithgoogle.rpc.Status-styledataentries.
Request and response examples
All requests are JSON-RPC 2.0 envelopes sent to the A2A endpoint. In Delegate mode, pass the skill name in params.metadata.skill. In Managed mode, omit it and let Runtype route the request.
SendMessage
Execute a task synchronously and wait for the result:
A completed task is returned inside result.task:
To continue a multi-turn conversation, include contextId inside params.message. To receive asynchronous webhook updates, add params.configuration.pushNotificationConfig with a webhook url.
SendStreamingMessage
Execute a task and receive incremental updates over Server-Sent Events. Each SSE data: line is a JSON-RPC response envelope with a v1.0 StreamResponse oneof.
A task/error event is emitted instead if execution fails. The event name is useful for debugging; A2A clients should parse the JSON-RPC payload in data.
GetTask
Retrieve the current state of a task. Pass the task id, and optionally historyLength to include message history:
ListTasks
List tasks for the surface. Use pageSize and pageToken for pagination:
The result includes tasks, nextPageToken, pageSize, and totalSize.
CancelTask
Cancel a running task by its id:
SubscribeToTask
Resume streaming updates for an existing task:
Task lifecycle and errors
Every task moves through v1.0 task states:
Errors are returned as a JSON-RPC error object with a numeric code, message, and optional data array. Runtype includes a google.rpc.ErrorInfo entry with a stable reason and the A2A error domain:
Standard JSON-RPC codes:
A2A-specific codes:
Security considerations
A2A Surfaces support authentication and rate limiting:
- API key authentication — Keys use the
a2a_prefix. - Rate limits — Configurable per key.
- Capability scoping — Control which capabilities are exposed as skills.
- Execution logs — Track which agents are calling your capabilities.
Use cases
Multi-agent systems
Build complex workflows by composing multiple specialized agents across different platforms.
Cross-platform collaboration
Platforms like LangChain, CrewAI, or Vercel AI SDK can discover and call your capabilities as part of larger workflows.
Cross-organization collaboration
Partner organizations can integrate their agents with yours without custom integration work.
Next steps
- Connecting external agents for integration details.
- Setting up an A2A Surface.
- Surface orchestration modes.