Choose Polling, Streaming, or Push Deliberately
A2A supports three mechanisms for delivering task updates, and the choice among them is an engineering decision, not a matter of taste. Polling is the simplest. Streaming is faster for interactive UX. Push fits very long server-to-server tasks. And whichever mechanism you choose must be declared in the Agent Card - the client has no right to assume what the agent didn't promise.
A comparison by cost and reliability helps you not to err.
Mechanism · When to take it · Cost · Reliability
- Get Task polling - Rare updates, a strict firewall; Extra requests and latency; Recovers simply
- Streaming/SSE - An interactive UI, frequent events; A long connection and reconnect logic; After a disconnect some messages may be lost
- Push webhook - Very long server-to-server work; A public receiver, retries, verification; Needs idempotency and a delivery policy
A multi-turn scenario - when the agent asked for input and continued after the answer - looks like this at the wire level.
1. SendMessage → Task(input_required)
2. Client shows status.message
3. Client sends a new Message
taskId = existing task
contextId = server-issued context
4. Agent resumes → working
5. Artifact update → completedAnd cancelling a task goes through an ownership check and doesn't undo already committed downstream effects.
client CancelTask(taskId)
server verifies task ownership
server rejects terminal/non-cancelable tasks
executor observes cancellation
server publishes canceled terminal state
already committed downstream effects require reconciliationTwo caveats here are especially costly. The first is about streaming.
Streaming messages are not a durable journal. The specification warns: after a disconnect the client may not receive all status messages. Keep a critical result in the Task status/history/artifacts and re-fetch it via Get Task, rather than relying on the stream.
The second is about push, which opens a new surface outward.
Push opens an SSRF surface. Check the callback URL, block private and link-local ranges, use HTTPS, sign callbacks, limit redirects, and re-resolve DNS by a safe policy.
The delivery is chosen. Now let's tie together what passes through all these mechanisms - security, tasks, and tenant ownership.