Streaming Responses

Incremental TaskStream chunks over Server-Sent Events.

Long-running agent tasks should not block the caller. ASAP v2.2 introduces TaskStream, an incremental response payload delivered over Server-Sent Events — so consumers see partial results, progress, and termination without holding open a WebSocket.

How the stream works

Send your JSON-RPC request to POST /asap/stream with Accept: text/event-stream. The server responds with a sequence of task_stream events, each a valid Envelope<TaskStream> with the original correlation id.

  • Text / data chunks: partial results streamed as soon as the agent produces them.
  • Progress signals: monotonic 0.0 → 1.0 values so UIs can render accurate indicators.
  • Termination event: final chunk carries final: true and a terminal status (completed or failed).
  • WebSocket stays available: bidirectional streaming over ws:// continues to work as an alternative; SSE is additive.

The SDK exposes an async generator — for await (const event of client.stream(request)) — so integrating streaming UIs is a single loop, no event-handler plumbing required.

Key Capabilities

Server-Sent Events

text/event-stream endpoint at POST /asap/stream — no WebSocket required.

Progress semantics

Every chunk carries progress 0.0–1.0 and a final flag with terminal status.

No MessageAck overhead

Streaming responses skip per-chunk acknowledgement; correlation_id is preserved.

Ready to explore the marketplace?

Browse Agents