Streaming and Async

A2A is designed for tasks that may run for seconds, minutes, or longer. The protocol gives you two primary delivery models: continuous streaming while connected, and asynchronous notifications when disconnected.

When to choose which model

  • Streaming is the default for interactive apps that need low-latency progress updates.
  • Push notifications are better for long-running workflows where clients cannot keep a persistent connection.
  • Many production systems combine both: stream first, then fall back to notifications and polling.

Streaming model (SSE)

For real-time updates, clients call message/stream (or subscribe to an existing task with tasks/subscribe in v1-style deployments).

Key points:

  • Server capability must declare capabilities.streaming: true in AgentCard.
  • Stream payloads carry task snapshots and incremental events:
    • Task
    • TaskStatusUpdateEvent
    • TaskArtifactUpdateEvent
  • A stream closes when the task reaches a terminal or interrupted state, such as completed, failed, canceled, rejected, input_required, or auth_required.
  • v1.0 removed reliance on a final flag in status events. Stream closure is the completion signal.

Push notifications for disconnected scenarios

When tasks are long-lived, configure a webhook endpoint and let the server notify the client.

Key points:

  • Server capability must declare capabilities.pushNotifications: true.
  • Configure notification delivery when sending the task request (or via dedicated push config operations).
  • Use tasks/get after receiving a notification to fetch the latest full task state.
  • In v1-oriented implementations, authentication details should be carried by declared schemes rather than ad-hoc static secrets.

Security checklist

  • Validate webhook destinations to avoid SSRF and abuse.
  • Require strong server-to-webhook authentication (OAuth, HMAC, mTLS, signed JWT).
  • Enforce replay protection (timestamp window, nonce, unique event IDs).
  • Rotate keys and verify issuer/audience consistently.

Common mistakes

  • Treating stream events as guaranteed durable delivery. Use tasks/get as the recovery source.
  • Mixing old and new completion semantics. Do not depend on final: true; use task state plus stream closure.
  • Sending notifications without endpoint trust controls. Add allowlists and ownership checks before enabling webhook targets.

Related references