Terminal state
One of the four A2A task states a task can never leave: completed, failed, canceled or rejected. Follow-up work starts a new task.
A terminal state is a task state that ends an A2A task for good: TASK_STATE_COMPLETED, TASK_STATE_FAILED, TASK_STATE_CANCELED or TASK_STATE_REJECTED. The a2a.proto file marks exactly these four as terminal.
| State | Meaning |
|---|---|
TASK_STATE_COMPLETED |
Finished successfully |
TASK_STATE_FAILED |
Finished with an error |
TASK_STATE_CANCELED |
Canceled before completion |
TASK_STATE_REJECTED |
The agent decided not to perform the task, at creation or later |
What changes at a terminal state.
- Send Message and Send Streaming Message to the task fail with
UnsupportedOperationError(specification sections 3.1.1 and 3.1.2). - Cancel Task fails with
TaskNotCancelableError(section 3.1.5). - Subscribe to Task fails with
UnsupportedOperationError(section 3.1.6). - An open stream for the task must close, and a blocking Send Message call returns (sections 3.1.2 and 3.2.2).
Over JSON-RPC, UnsupportedOperationError maps to code -32004 (section 5.4). Illustrative response to a message sent to a finished task:
{
"jsonrpc": "2.0",
"id": 7,
"error": {"code": -32004, "message": "Task is in a terminal state and cannot accept messages"}
}
Follow-up work. A task in a terminal state cannot restart, which gives clients a stable record of its inputs, outputs and artifacts. To refine a result or continue, the client sends a new message in the same contextId, optionally listing the earlier task in referenceTaskIds, and the agent creates a new task (Life of a Task guide).
States that are not terminal. TASK_STATE_INPUT_REQUIRED and TASK_STATE_AUTH_REQUIRED are interrupted states. The task is paused, still accepts messages, and can resume. TASK_STATE_SUBMITTED and TASK_STATE_WORKING mean the agent is still processing.
Sources
- A2A protocol definition (a2a.proto): TaskState (accessed )
- A2A Protocol Specification, section 3.1: Core Operations (accessed )
- A2A Protocol Specification, section 3.2.2: SendMessageConfiguration (execution mode) (accessed )
- A2A Protocol Specification, section 5.4: Error Code Mappings (accessed )
- A2A documentation: Life of a Task (task immutability) (accessed )