Glossary · Protocols and standards

Server-Sent Events (SSE)

Server-Sent Events is a web standard for streaming text events from server to client over one HTTP response. A2A uses it for streaming task updates.

Server-Sent Events (SSE) is a web standard, defined in the WHATWG HTML Living Standard, that lets a server push a stream of text events to a client over one long-lived HTTP response with the media type text/event-stream.

How it works. The stream is UTF-8 text. Each event is a block of field: value lines ended by a blank line. The data field carries the payload, and several data lines join with newlines. event sets an event type, id sets the last event ID, and retry sets the reconnection delay in milliseconds. A line that starts with a colon is a comment. The standard suggests sending one about every 15 seconds so that legacy proxies do not drop an idle connection. Browsers read SSE through the EventSource interface, which reconnects on its own and sends a Last-Event-ID header when it does.

In A2A. The JSON-RPC and HTTP+JSON bindings stream over SSE, and the gRPC binding uses server-streaming RPCs instead. SendStreamingMessage and SubscribeToTask answer with HTTP 200 and Content-Type: text/event-stream. In the JSON-RPC binding, each data line holds a complete JSON-RPC response whose result is a StreamResponse: a task, a message, a status update or an artifact update. A stream opens with the task (or a single message), then sends updates until the task reaches a terminal or interrupted state.

data: {"jsonrpc": "2.0", "id": 1, "result": {"task": {"id": "task-123", "contextId": "ctx-1", "status": {"state": "TASK_STATE_WORKING"}}}}

data: {"jsonrpc": "2.0", "id": 1, "result": {"statusUpdate": {"taskId": "task-123", "contextId": "ctx-1", "status": {"state": "TASK_STATE_COMPLETED"}}}}

The agent must deliver events in the order it generated them. It may serve several streams for one task, and each stream gets the same events in the same order. Closing a stream does not end the task, so a client that loses its connection can open a new one with SubscribeToTask. Streaming requires capabilities.streaming: true in the Agent Card.

Practical note. EventSource cannot send a request body, and A2A streams start with a POST. An A2A client therefore reads the POST response stream directly, for example with fetch and a stream reader.

Neighbouring terms. Push notifications suit clients that cannot hold a connection open, and polling with GetTask is the simplest fallback.

Sources

  1. WHATWG HTML Living Standard, section 9.2: Server-sent events (accessed )
  2. A2A Protocol Specification, section 3.5: Task Update Delivery Mechanisms (accessed )
  3. A2A Protocol Specification, section 9.4.2: SendStreamingMessage (accessed )