All chapters
  1. Start hereOne agent asks. Another answers. The rest is the contract between them
  2. Foundations · 1One model, one tool, two agents: who is who, and who is responsible
  3. Foundations · 2Message passing: sender, recipient, payload, address and correlation
  4. Foundations · 3Topologies: central orchestrator, peer-to-peer and hierarchy
  5. Mechanics · 4Request and reply, or a task: synchronous versus asynchronous exchange
  6. Mechanics · 5Contracts: messages, artifacts, typed schemas, errors and versions
  7. Mechanics · 6The task lifecycle: submitted, working, input-required, completed, failed, canceled
  8. Mechanics · 7Discovery: Agent Cards, skills and how an agent says what it can do
  9. Protocol · 8A2A: the Agent2Agent protocol, part by part
  10. Protocol · 9A2A versus MCP: delegating to an agent versus calling a tool
  11. Protocol · 10Handoff, delegation or shared state: three ways to work together
  12. Production · 11How updates arrive: streaming, push notifications, callbacks, polling and queues
  13. Production · 12Security: identity, delegated scopes, trust across domains, authorization
  14. Production · 13Reliability: retries, idempotency, order, timeouts and compensation
  15. Production · 14Observability: one trace across three agents
  16. Reference · 15Frameworks: A2A SDKs, LangGraph, AutoGen, CrewAI and plain code
  17. Reference · 16Advanced: consensus claims, coordination failure, cost and isolation
  18. ReferenceGlossary
  19. AboutAbout this site and its sources
Production · 11

How updates arrive: streaming, push notifications, callbacks, polling and queues

A task is running somewhere else. Five ways to learn what it is doing, what each costs in requests and delay, and what each loses when a connection drops.

What you will understand
Five ways to hear back
Polling, streaming, push notifications, callbacks and durable queues.
What each costs
Requests made, delay before the caller learns, and connections held open.
When the line drops
What each one loses, and how each recovers.

The underwriter cockpit shows a list of open quote requests with a status next to each. The first version refreshed the list by asking the coordinator about every open request every five seconds. On a quiet morning that was 40 open requests, eight requests per second, and almost every answer was "still working".

Then the broker team asked for something better: when the assessment agent finishes the evidence, the cockpit should show it at once, not up to five seconds later. And the operations team asked for something different: when the cockpit's server restarts, no update may be lost.

These three wishes, few requests, little delay, nothing lost, cannot all be maximized at once. Each way of delivering updates trades them differently. This page names the five ways and measures the trade on one model.

The problem: the work runs somewhere else#

From Sync and async we have a task: an id now, the result later. From Task lifecycle we have its states. What is missing is the transport of the news. The callee knows the task moved from working to completed. How does the caller find out?

There are two directions to answer from. Either the caller asks (pull), or the callee tells (push). Each direction has variants.

Polling is pull: the caller asks for the task's state again and again, at an interval. For example, "what is the state of task-a1?" every ten seconds. Simple, works through any firewall, and wasteful: most answers say nothing new, and an update waits on average half an interval before anyone sees it.

Streaming is a connection the caller opens once and the callee keeps open, sending each update as it happens. For example, the caller sends the request and keeps reading the response as updates arrive until the task ends. SSE, Server-Sent Events, is a common way to do this over HTTP: the server answers with a response of type text/event-stream and writes one event at a time into it.

A push notification is the callee calling the caller: when something happens, the callee sends an HTTP request to an address the caller registered in advance. That address is a webhook: a URL on the caller's side that accepts these notifications. For example, the cockpit registers https://cockpit.insurer.example/hooks/a2a, and the assessment agent posts to it when the task completes.

A callback is the general idea behind a push notification: the caller gives the callee a way to reach it later, and the callee uses it. A webhook is a callback over HTTP; a reply address on a message bus is a callback too. In the example every reply is delivered to the from address of the request, which is a callback by another name.

A durable queue stores messages until the receiver confirms it has processed them. For example, the callee writes each update to a queue; the caller reads from the queue when it can. If the caller is down, the messages wait. Nothing is lost; updates arrive late.

Plain English. Polling is phoning the repair shop every hour. Streaming is staying on the line while they work. A push notification is leaving your number so they call you. A durable queue is a mailbox: the letter waits until you open it.

Diagram: Who holds the news until it is read · five delivery mechanisms

Read left to right from pull to push. With polling the caller asks and the callee holds only the current state. A stream carries updates on an open connection and holds nothing. A push notification or callback is held by the sender until the receiver accepts it. A durable queue holds every message until it is acknowledged.

  1. Pull
    1. Polling: The caller asks for the task's state at an interval. Costs requests in proportion to time; misses intermediate states.
  2. Open connection
    1. Streaming: One request; the callee writes each update into the open response. Fastest; what is sent while the line is down is lost.
  3. Push
    1. Push notification: The callee posts to a URL the caller registered, and retries on failure. A retry can deliver a notification twice.
    2. Callback: The general form: the caller tells the callee how to reach it later. The example's replies go to the request's from address.
  4. Durable
    1. Durable queue: Every message waits in the queue until the caller confirms it. Nothing is lost; delivery can be late.

The smallest primitive: who keeps the news until it is read#

Every variant answers one question differently: who holds an update between the moment it happens and the moment the caller reads it? In polling, the callee holds the current state, and only the current state; intermediate states are overwritten. In streaming, nobody holds it: it is in flight on an open connection, and lost if the connection is not. In a push notification, the callee holds it until the webhook accepts it, as long as it retries. In a durable queue, the queue holds every message until it is acknowledged.

That one question predicts what each loses when something breaks, which the lab shows.

The delivery lab#

The lab is a model, not a run of the example: a task that sends a status update every 10 seconds, 20 ms per hop, and an optional connection outage of 20 seconds. Set the task length, the poll interval and the moment the connection drops, and compare the four mechanisms. The numbers are illustrative.

Mechanism (task 60 s, update every 10 s, poll every 15 s)Requests by the callerLearns of the endUpdates seenWith a 20 s outage at 25 s
Polling4at the poll after the end (here exactly at 60 s)5 of 6Polls during the outage fail; nothing is lost for good, because the next poll reads the current state
Streaming120 ms after the end6 of 62 updates sent during the outage are lost; the caller reconnects (2 requests) and reads the current state
Push notification1 (the registration)20 ms after the end6 of 6Posts during the outage fail and are retried later; a retried update can arrive twice
Durable queue1 (the subscription)20 ms after the end6 of 6Messages wait in the queue; nothing is lost; they arrive after the outage

Read the first row against the opening story: polling costs requests in proportion to time, not to news, and it misses intermediate updates entirely. Read the last column: the mechanisms that hold the news durably (queue, retried push) lose nothing, at the price of late or duplicate delivery; streaming is the fastest and the most fragile.

The insurance example#

In the example, every update is a message. When the assessment agent's task moves, Agent.update sends a task.status message to the caller's address, on the in-process message bus; the artifact arrives as a task.artifact message. That is push delivery through a callback address, with the bus as a reliable carrier inside one process. The example does not implement polling, streaming connections or queues; the lab models them. The agents here are scripted stand-ins, so these results show how the mechanism works, not how good any model is.

What the example does show is the problem every push design must solve: updates can arrive out of order. Case UW-411 delivers a working update after completed. The caller keeps completed because each update carries a sequence number, seq, and a terminal state never moves. That guard matters for every mechanism on this page: a stream after a reconnect, a retried push and a queue redelivery can all replay an old update.

/opt/homebrew/bin/python3 run_case.py --case UW-411 --dry-run
UW-411 · topology orchestrator · run run-4d11 · agents: scripted stand-ins (no model called)
  time ms  from                 to                 type          state           ids
       50  intake-agent       → coordinator        task.request  -               msg-0001 corr msg-0001 task -        try 1
       70  coordinator        → intake-agent       task.status   working         msg-0002 corr msg-0001 task task-c1  try 1
       70  coordinator        → assessment-agent   task.request  -               msg-0003 corr msg-0003 task -        try 1
       90  assessment-agent   → coordinator        task.status   working         msg-0004 corr msg-0003 task task-a1  try 1
       90  · held              assessment-agent → coordinator           msg-0004  fault: held back until the next message of this exchange has arrived
      660  assessment-agent   → coordinator        task.artifact completed       msg-0005 corr msg-0003 task task-a1  try 1
      680  coordinator        → underwriting-agent task.request  -               msg-0006 corr msg-0006 task -        try 1
      680  · stale_ignored     assessment-agent → coordinator           msg-0004  seq 1 is not higher than 2, the last update applied
      700  underwriting-agent → coordinator        task.status   working         msg-0007 corr msg-0006 task task-u1  try 1
      746  underwriting-agent → coordinator        task.artifact completed       msg-0008 corr msg-0006 task task-u1  try 1
      766  coordinator        → intake-agent       task.artifact completed       msg-0009 corr msg-0001 task task-c1  try 1
messages: 9 sent · 9 delivered · 0 duplicates dropped · 1 stale updates ignored · 0 deadlines fired
tasks (caller's view): workflow completed · evidence completed · recommendation completed
recommendation: approve · citations - · missing - · evidence complete · routed to the underwriter · stated_confidence 0.9
tool calls: get_roof_assessment 1 · search_guidance 1 · find_similar_decisions 1 · check_eligibility 1 · record_recommendation 1
rows stored: 1 · human_decision: none (no person has decided yet)
trace: 1 trace_id · 29 spans · last message at 786 ms · run ends at 786 ms (simulated)
expected vs actual: PASS (10 of 10 checks)

The working update with seq 1 is held back and delivered after the artifact with seq 2. The caller ignores it as stale. Run the same case with --no-seq and the caller ends believing the evidence task is still working; Reliability covers ordering in depth.

Failure modes#

Polling too fast, polling too slow. A short interval floods the callee with "still working"; a long one adds delay to every result. Teams usually discover the right interval by an incident. Backing off (poll often at first, then less) helps, but polling never sees intermediate states.

The silent stream. A streaming connection can die without an error: a proxy drops it after a minute of silence, a laptop sleeps. The caller waits for events that will never come. Every stream needs a heartbeat or an idle timeout, and a plan to reconnect and read the current state.

The unauthenticated webhook. A webhook is a public URL that changes the caller's state when called. If the caller does not check who posted, anyone can mark a task complete. And because push senders retry, the caller will see duplicates: it must process notifications idempotently.

The queue nobody drains. A durable queue never loses a message and never complains either. If the consumer is broken, messages pile up until someone looks. Durable delivery needs monitoring of the queue's age, not only its size.

Before AI. These are the familiar trade-offs of long polling versus WebSockets versus webhooks in a web backend, and of synchronous calls versus Kafka or a JMS queue between services. A Kafka consumer group is the durable-queue column of the table: the offset is the acknowledgement, and a consumer that restarts reads from where it left off. Nothing about agents changes the physics; agents only make tasks longer, so the choice matters more.

How the A2A protocol delivers updates#

The A2A documentation read today describes two mechanisms besides asking for a task. Streaming uses Server-Sent Events: the client calls SendStreamingMessage, the server answers with Content-Type: text/event-stream, and each event carries a task, a TaskStatusUpdateEvent or a TaskArtifactUpdateEvent; the server closes the stream when the task reaches a terminal or interrupted state, and a client whose connection broke while the task is active can reconnect with SubscribeToTask. An agent advertises support with capabilities.streaming in its Agent Card.

Push notifications are HTTP requests from the server to a webhook URL the client registered, either inside the send request or with CreateTaskPushNotificationConfig; the body is a StreamResponse. The server must authenticate itself to the webhook, and the receiver must verify notifications; the documentation suggests timestamps and single-use identifiers against replays. The specification says agents should retry failed deliveries with exponential backoff and may stop after a number of failures, and that clients should process notifications idempotently because duplicates may occur. It does not state a delivery guarantee such as at-least-once. After a notification the client typically fetches the task with GetTask. The full list of operations is on A2A.

The documentation's own advice on choosing matches the lab: streaming for real-time progress when the client can hold a connection open; push notifications for tasks of minutes to days, and for clients such as serverless functions that cannot hold one.

What this is not. This page compares how updates reach the caller. Running a message broker, its partitions, retention and consumer groups, is infrastructure outside this series; retries and backoff as a discipline belong to reliable.sammuthu.com. Proving afterwards which update was delivered when belongs to observe.sammuthu.com.

Checklist: choosing how updates arrive#

The same idea for a coding agent. A planning agent waiting for a forty-minute test run should not hold a stream open the whole time. It registers a callback, the CI system's status webhook or an A2A push configuration, and goes on with other work; when the notification arrives, it fetches the result. If the planning agent restarts in the meantime, the pull request's status in the code host is the durable record it reads on startup.

The usual production answer is two mechanismsA fast path that may lose, and a slow path that may not

Most robust designs combine a fast, lossy channel with a slow, reliable one. Stream or push for low delay; on any doubt (a reconnect, a gap in sequence numbers, a timeout), read the current state by polling once. The fast path makes the common case quick; the slow path makes the rare case correct. The A2A shape already invites this: push or stream for news, GetTask for truth.

The sequence number is what lets the caller notice a gap: if updates seq 3 and 5 arrive, 4 is missing, and the caller can read the state instead of trusting the stream. Without sequence numbers a lost update is invisible.

Back-pressure and chatty agentsWhen updates outnumber the work

An agent that streams every intermediate thought, token or tool call produces far more updates than state changes. Across many tasks the update traffic, not the work, sets the load on the caller. Streaming makes this cheap per update and expensive in aggregate: a slow consumer either buffers without bound or must make the producer wait, which is back-pressure.

Two disciplines help. Separate state changes (few, must arrive) from progress (many, may be dropped or sampled). And let the caller choose: subscribe to state changes only by default, to progress only when a person is watching. Advanced puts a cost on every extra message.

Securing a webhookA public URL that changes state

A webhook turns the caller into a server for the callee, and the trust direction flips: now the caller must authenticate the callee. The checks that matter: verify a credential on every notification (the A2A documentation's example uses a signed token with issuer, audience, expiry and a unique id), reject old notifications by timestamp, remember recent unique ids to drop replays, and treat the notification as a hint: fetch the task's state from the server you already trust before acting on anything important. Security covers identity and authorization between agents in general.

In one breath#

A running task's news reaches the caller in one of five ways: the caller polls, the callee streams on an open connection, the callee pushes to a webhook, the callee calls a callback address, or a durable queue holds the messages. Polling costs requests and delay, streaming is fast and loses what is sent while the line is down, push and queues hold the news until it is read and may deliver it late or twice. Whatever the mechanism, number the updates and let the caller read the current state when in doubt.

Next: every message so far was trusted. Security asks who this agent is, on whose behalf it acts, what it may do here, and why text from another agent is data, not instruction.