CSE Roadmap

Common tier · about 6 hours · 10 parts

Part 5 of 10 · 4 min read

Finding out a long job finished

A pizza order you check by calling the shop every five minutes is the customer paying with calls. One where the shop texts you is the shop paying with an open line to your phone. Learning that a long A2A job finished costs somebody something. The three mechanisms spend it differently.

In plain words: polling spends the caller's requests, streaming spends an open connection for the job's whole length, and push spends a public receiver the server must be trusted to call correctly.

The venue agent has a "thorough search" that takes 20 virtual seconds. There are three ways to learn it is done, and each was measured.

AAAWgmp1bWIAAAAeanVtZGMycGEAEQAQgAAAqgA4m3EDYzJwYQAAABZcanVtYgAAAEdqdW1kYzJtYQARABCAAACqADibcQN1cm46YzJwYTplY2E0MWRhNS1jYjc1LTQwM2UtODE3ZC04ZDQ3OGM2NjhlMWIAAAADl2p1bWIAAAApanVtZGMyYXMAEQAQgAAAqgA4m3EDYzJwYS5hc3NlcnRpb25zAAAAALxqdW1iAAAARGp1bWRjYm9yABEAEIAAAKoAOJtxE2MycGEuaW5ncmVkaWVudC52MwAAAAAYYzJzaCFUNprf2BOhNvgfJfpgJWcAAABwY2JvcqNpZGM6Zm9ybWF0bWltYWdlL3N2Zyt4bWxqaW5zdGFuY2VJRHgseG1wOmlpZDozMGU0Nzc0Mi03NDIzLTQ4MjctYjJiZC1kY2NjMTVmZWIyYjdscmVsYXRpb25zaGlwaHBhcmVudE9mAAAB4mp1bWIAAABBanVtZGNib3IAEQAQgAAAqgA4m3ETYzJwYS5hY3Rpb25zLnYyAAAAABhjMnNonfeaFL1Za0mGWryRTC6cpwAAAZljYm9yomdhY3Rpb25zgqJmYWN0aW9ua2MycGEub3BlbmVkanBhcmFtZXRlcnOha2luZ3JlZGllbnRzgaJjdXJseC1zZWxmI2p1bWJmPWMycGEuYXNzZXJ0aW9ucy9jMnBhLmluZ3JlZGllbnQudjNkaGFzaFggZOF48KCPE2I3O8y+vWSxnZtCLGJcVbUOFVggkRUKmtekZmFjdGlvbngdY29tLmFudGhyb3BpYy5jbGF1ZGUucHJvdmlkZWRqcGFyYW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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPZYQLyX+jXBzXYOqcQ8mD5RHcbU9a2fA2MC3R0MmfOeUVfhKzIqtOpNcPC3n2JCfog1XJwEQmQ9VlEODStH4uCUgkc=Learning that a 20-second job finished: requests and bytes on the wirepoll every 1s77,964 B, 102 requests, 0 s latepoll every 7s13,415 B, 17 requests, 5 s latepoll every 30s5,031 B, 6 requests, 20 s latestream2,373 B, 1 request, 0 s latepush2,578 B, 1 request, 0 s lateVirtual time, one imitation server: the shape is the point, not the byte counts. Push needs a public receiver; streaming needs an open connection.
Requests and bytes for one 20-second job.
Mechanism Requests Bytes Learned it was done
Poll every 1 s 102 77,964 on time
Poll every 7 s 17 13,415 5 s late
Poll every 30 s 6 5,031 20 s late
Stream (server-sent events) 1 2,373 on time (6 events)
Push notification 1 (+5 webhook posts) 2,578 on time (5 events)

The trade-off is the usual one. Polling costs requests (or lateness). Streaming needs an open connection for the whole job. Push needs a public receiver and a way to trust what arrives. The server will make an HTTP request to an address the client gave it. That is a server-side request forgery (SSRF) opening the server must guard against:

# from code/mini-a2a/net.py
def guarded_fetch(net: Network, req: Request, allow_loopback: bool = False, max_hops: int = 3, pin: bool = True) -> Response:
    host = p.hostname
    ips = net.resolve(host)
    loop = all(ipaddress.ip_address(i).is_loopback for i in ips)
    if any(is_internal(i) for i in ips) and not (allow_loopback and loop):
        raise Blocked(f"{host} resolves to an internal address ({ips[0]})")
    if p.scheme == "http" and not (allow_loopback and loop):
        raise Blocked("plain http is only allowed to loopback during development")
    ip = ips[0] if pin else net.resolve(host)[0]               # connect to the address we just checked, not to a second lookup

Read it as: the name is resolved once and checked against private, loopback, link-local and reserved ranges before any connection is made. The comment on the last line is the point. The connection uses the address already checked, not a second lookup. So a name cannot change between the check and the use. Three honeypots (10.0.0.5, 169.254.169.254, 127.0.0.1) record any hit. The tests assert there are none. That includes when an agent's own executor tries to fetch a URL it found in a message.

Server-sent events, push notification

Server-sent events are a stream of updates sent over one open HTTP connection, which the client reads as they arrive. A push notification is the server calling back to an address the client registered, after the client has disconnected. Example: streaming costs one open connection for 20 seconds; push costs the server a trip to the client's own webhook, which is why that address must be checked for SSRF before it is ever called.

Streaming has two details that matter. The first event is the full task (a client that subscribes to a running task gets a snapshot of what exists, including artifacts so far, and then changes), and a dropped connection is repaired by subscribing again. The test cuts a stream after two events, resubscribes, and gets the final state and the artifacts.

Three more push details:

  • Credentials travel with the notification (a Bearer credential, and a token header). The choice: the specification's 1.0 text does not say where the extra token is sent; the example uses the 0.3 header X-A2A-Notification-Token. And configuration is redacted on reads: a client can list its configs and see the scheme, never the secret.
  • A race. Webhook events can arrive before the reply to the send call, so a receiver cannot be told "expect task X" up front. The example's receiver instead binds a credential to a task on first use and refuses the same credential for a different task. A receiver written the obvious way, which must already know the task id, got 15 delivery attempts, all answered 404.
  • Retries. A failing receiver gets retried three times and then dropped; an unreachable one must not fail the task. (One planted defect, no_push_retry, escapes the suite; see part 8.)