Transport Layers

A2A defines three transport bindings, JSON-RPC 2.0, REST (HTTP+JSON) and gRPC (grpc feature flag). a2a-rust adds a fourth, WebSocket (websocket feature flag), as a custom binding under spec §12; a fifth, SLIMRPC, is a separate crate. All four are first-class citizens in a2a-rust — the server can serve multiple transports simultaneously, and ClientBuilder::from_card selects an interface from the agent card (build() constructs JSON-RPC or REST; gRPC needs build_grpc, and WebSocket a transport passed to with_custom_transport).

Every binding carries the same eleven operations and the same data model; they differ in how a request is framed, how a stream is delivered, and where the per-request metadata (credentials, tenant, A2A-Version, traceparent) travels. This page compares them; each binding's wire details have a page of their own. Setting a binding up is covered elsewhere: the server side in Dispatchers, the client side in Building a Client.

You wantRead
The JSON-RPC envelope, method names, batches and notificationsJSON-RPC 2.0
The REST route table, tenant paths and content negotiationHTTP+JSON (REST)
WebSocket framing, connection-level headers and the client transport's limitsWebSocket
gRPC targets, client TLS and serving TLSgRPC
The SLIM fabricSLIMRPC

Bindings at a glance

BindingStreamsPer-request metadataResume a dropped stream
JSON-RPC 2.0SSE on the POST responseHTTP headers, per requestLast-Event-ID
HTTP+JSON (REST)SSE on POST or GETHTTP headers, per requestLast-Event-ID
gRPCgRPC server streaming over HTTP/2gRPC metadata, per callNo event ids on the stream; resubscribe
WebSocketText frames, then stream_completeUpgrade headers, once per connectionNone; resubscribe
SLIMRPCSLIMRPC response streamSession metadata, per callNo event ids on the stream; resubscribe

The metadata column is the one that changes behaviour. JSON-RPC, REST, gRPC and SLIMRPC carry headers on every call, so a token can rotate between calls and each call's traceparent makes its server span a child of the caller's. A WebSocket frame has no header channel. The upgrade request's HTTP headers reach the handler for every request on the connection, so authentication and tenant resolution work exactly as over HTTP, but credentials are fixed at connect time, and a per-call header an interceptor adds is not sent. W3C trace context cannot be fixed at connect time, because every request needs its own parent id, so it is not propagated at all: each call's server span links to the trace of the upgrade request instead. If a call must be traced end to end, send it over another binding.

Choosing a Transport

FactorJSON-RPCRESTWebSocketgRPC
Batch operationsSupportedNot supportedNot supportedNot supported
CachingLimited (POST-only)HTTP cache-friendly (GET)Not applicableNot applicable
ToolingNeeds JSON-RPC clientStandard HTTP tools workWebSocket client neededgRPC client needed
URL structureSingle endpointResource-orientedSingle connectionSingle connection
StreamingSSE via POSTSSE via POST/GETNative text framesNative server streaming
Connection reuseHTTP keep-aliveHTTP keep-alivePersistent connectionHTTP/2 multiplexing

JSON-RPC and REST use SSE for streaming. WebSocket uses native text frames. gRPC uses native server streaming over HTTP/2. The choice is mostly about ecosystem fit — JSON-RPC for agent-to-agent communication, REST for standard HTTP tooling, WebSocket for persistent low-latency connections, gRPC for service mesh and cross-language interop.

Running several transports

The server can serve several bindings at once: each dispatcher on its own port, or JSON-RPC and REST on one port with CombinedDispatcher. All dispatchers share the same RequestHandler, which means they share the same task store, push config store, and executor. The setup is in Serving and combining.

Next Steps