message/stream
Send streaming messages to A2A agents and receive real-time responses via Server-Sent Events
Overview
The message/stream
method enables real-time communication with A2A agents using Server-Sent Events (SSE). This allows you to receive partial responses as the agent processes your request, providing a more interactive experience.
Streaming Communication: This method uses Server-Sent Events for real-time response streaming. The connection remains open until the agent completes the response.
Request
Headers
Must be application/json
Must be text/event-stream
for SSE support
Your API key for authentication
Recommended: no-cache
for real-time streaming
Path Parameters
Unique identifier of the target agent
Body Parameters
JSON-RPC version, must be "2.0"
Unique identifier for this request (for response correlation)
Must be "message/stream"
Message parameters object (same structure as message/send)
Response
Server-Sent Events Stream
The response is delivered as a stream of Server-Sent Events. Each event contains a JSON object with the current state of the task.
Event Format
Event Data Structure
JSON-RPC version, always "2.0"
Result object containing the current task state
Request ID (matches the request ID)
Examples
Stream Lifecycle
Error Handling
Stream Errors
Errors during streaming are sent as regular JSON-RPC error responses:
Connection Management
Best Practices
Comparison with message/send
Feature | message/send | message/stream |
---|---|---|
Response Type | Single response | Multiple events |
Real-time Updates | No | Yes |
Progress Tracking | No | Yes |
Connection | Request/Response | Persistent |
Use Case | Quick queries | Long-running tasks |
Complexity | Simple | Moderate |