< Khinevics lab Document no. 009

The life of a task

We sent one message to an A2A agent and watched the task live from start to end. It went from SUBMITTED to COMPLETED, the answer came in three pieces, and a webhook heard every step.

In document 008 we tested the a2a command-line tool. This time we used the Python SDK, a2a-python 1.3.0, and checked it against the specification, version 1.0.1. One server, one client, one laptop, transport JSON-RPC.

Eight states

The specification has no table of transitions. It only describes each state. Who may move a task from where to where, the reader has to guess.

The eight states of an A2A task. SUBMITTED goes to WORKING. WORKING can pause in INPUT_REQUIRED or AUTH_REQUIRED and come back. Four end states: COMPLETED, FAILED, CANCELED, REJECTED. Our run went SUBMITTED, WORKING, COMPLETED. pause: same taskId INPUT_REQUIRED AUTH_REQUIRED SUBMITTED WORKING COMPLETED FAILED CANCELED REJECTED end: no more messages our run The arrows are our reading: the specification has no table of transitions.
Fig. 20 — Eight states of a task. Red: the path of our run.

What we saw

The server takes the task, says it is working, sends one artifact in three chunks and finishes. Each chunk carries two flags: append says "add to the same artifact", last_chunk says "this is the end".

Task id=a9bc8569 ctx=f636bc27 state=TASK_STATE_SUBMITTED
StatusUpdate TASK_STATE_WORKING Writing the answer in pieces...
ArtifactUpdate id=answer append=False last_chunk=False chunk='Agent '
ArtifactUpdate id=answer append=True last_chunk=False chunk='replies '
ArtifactUpdate id=answer append=True last_chunk=True chunk="to: 'hello, A2A'"
StatusUpdate TASK_STATE_COMPLETED
Assembled artifact: Agent replies to: 'hello, A2A'

At the same time the webhook got six POST calls: the task, WORKING, three artifact pieces, COMPLETED.

Three ways to hear back

Three ways for a client to hear back from an agent. Stream: events flow on an open line until the task ends. Push: the agent posts events to a webhook. Asking: the client calls GetTask again and again. AGENT CLIENT 1 · STREAM closes when the task ends 2 · PUSH WEBHOOK POST · at least once 3 · ASKING GetTask task live talk again and again
Fig. 21 — Three ways to hear back: stream, push, asking.

Where it is thin

The webhook token travels in a header called X-A2A-Notification-Token. The SDK invented it. The specification only names Authorization. Again the same question as in document 006: a message arrives, and who sent it is a matter of trust.

Push in our run. The agent sent six POST calls to the webhook: the task, WORKING, three artifact pieces, COMPLETED. The token travels in the header X-A2A-Notification-Token, which comes from the SDK. The specification only names Authorization. AGENT WEBHOOK 6 POST calls task WORKING piece 1 piece 2 piece 3 COMPLETED HEADER X-A2A-Notification-Token SDK only Authorization in the specification
Fig. 22 — Six calls to the webhook, and a header the specification does not name.

Not tested yet: pauses, cancel, reconnect, and the gRPC and REST transports.

The task has a clear life. Its birth certificate is still unsigned.