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
- Start. SUBMITTED, then WORKING.
- Pause. INPUT_REQUIRED and AUTH_REQUIRED. The client goes on with a new message and the same
taskId. An agent can ask for sign-in in the middle of a task (§7.6). - End. COMPLETED, FAILED, CANCELED, REJECTED. A finished task takes no more messages.
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.
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
- Stream. For live talk. In version 1.0 there is no
finalflag: the stream just closes when the task ends. After a broken line,SubscribeToTasksends the current task first, so nothing is lost (§3.5.2). - Push. For long work between servers. The agent posts the same events to a webhook, at least once. So the receiver must answer 2xx, check the sender and handle repeats (§4.3.3).
- Asking. The simplest: call
GetTaskagain and again.
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.
Not tested yet: pauses, cancel, reconnect, and the gRPC and REST transports.
The task has a clear life. Its birth certificate is still unsigned.