Resource: Task
Task is the core unit of action for A2A. It has a current status and when results are created for the task they are stored in the artifact. If there are multiple turns for a task, these are stored in history.
| JSON representation |
|---|
{ "id": string, "contextId": string, "status": { object ( |
| Fields | |
|---|---|
id |
Required. Unique identifier (e.g. UUID) for the task, generated by the server for a new task. |
contextId |
Unique identifier (e.g. UUID) for the contextual collection of interactions (tasks and messages). |
status |
Required. The current status of a |
artifacts[] |
A set of output artifacts for a |
history[] |
protolint:disable REPEATED_FIELD_NAMES_PLURALIZED The history of interactions from a |
metadata |
protolint:enable REPEATED_FIELD_NAMES_PLURALIZED A key/value object to store custom metadata about a task. |
TaskStatus
A container for the status of a task
| JSON representation |
|---|
{ "state": enum ( |
| Fields | |
|---|---|
state |
Required. The current state of this task. |
message |
A message associated with the status. |
timestamp |
ISO 8601 Timestamp when the status was recorded. Example: "2023-10-27T10:00:00Z" Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
TaskState
Defines the possible lifecycle states of a Task.
| Enums | |
|---|---|
TASK_STATE_UNSPECIFIED |
The task is in an unknown or indeterminate state. |
TASK_STATE_SUBMITTED |
Indicates that a task has been successfully submitted and acknowledged. |
TASK_STATE_WORKING |
Indicates that a task is actively being processed by the agent. |
TASK_STATE_COMPLETED |
Indicates that a task has finished successfully. This is a terminal state. |
TASK_STATE_FAILED |
Indicates that a task has finished with an error. This is a terminal state. |
TASK_STATE_CANCELED |
Indicates that a task was canceled before completion. This is a terminal state. |
TASK_STATE_INPUT_REQUIRED |
Indicates that the agent requires additional user input to proceed. This is an interrupted state. |
TASK_STATE_REJECTED |
Indicates that the agent has decided to not perform the task. This may be done during initial task creation or later once an agent has determined it can't or won't proceed. This is a terminal state. |
TASK_STATE_AUTH_REQUIRED |
Indicates that authentication is required to proceed. This is an interrupted state. |
Message
Message is one unit of communication between client and server. It can be associated with a context and/or a task. For server messages, contextId must be provided, and taskId only if a task was created. For client messages, both fields are optional, with the caveat that if both are provided, they have to match (the contextId has to be the one that is set on the task). If only taskId is provided, the server will infer contextId from it.
| JSON representation |
|---|
{ "messageId": string, "contextId": string, "taskId": string, "role": enum ( |
| Fields | |
|---|---|
messageId |
Required. The unique identifier (e.g. UUID) of the message. This is created by the message creator. |
contextId |
Optional. The context id of the message. If set, the message will be associated with the given context. |
taskId |
Optional. The task id of the message. If set, the message will be associated with the given task. |
role |
Required. Identifies the sender of the message. |
parts[] |
Required. Parts is the container of the message content. |
metadata |
Optional. Any metadata to provide along with the message. |
extensions[] |
The URIs of extensions that are present or contributed to this Message. |
referenceTaskIds[] |
A list of task IDs that this message references for additional context. |
Role
Defines the sender of a message in A2A protocol communication.
| Enums | |
|---|---|
ROLE_UNSPECIFIED |
The role is unspecified. |
ROLE_USER |
The message is from the client to the server. |
ROLE_AGENT |
The message is from the server to the client. |
Part
Part represents a container for a section of communication content. Parts can be purely textual, some sort of file (image, video, etc) or a structured data blob (i.e. JSON).
| JSON representation |
|---|
{ "metadata": { object }, "filename": string, "mediaType": string, // Union field |
| Fields | |
|---|---|
metadata |
Optional. metadata associated with this part. |
filename |
An optional |
mediaType |
The |
Union field
|
|
text |
The string content of the |
raw |
The A base64-encoded string. |
url |
A |
data |
Arbitrary structured |
Artifact
Artifacts represent task outputs.
| JSON representation |
|---|
{
"artifactId": string,
"name": string,
"description": string,
"parts": [
{
object ( |
| Fields | |
|---|---|
artifactId |
Required. Unique identifier (e.g. UUID) for the artifact. It must be unique within a task. |
name |
A human readable name for the artifact. |
description |
Optional. A human readable description of the artifact. |
parts[] |
Required. The content of the artifact. Must contain at least one part. |
metadata |
Optional. Metadata included with the artifact. |
extensions[] |
The URIs of extensions that are present or contributed to this Artifact. |
Methods |
|
|---|---|
|
Cancels a task in progress. |
|
Gets the latest state of a task. |
|
Lists tasks that match the specified filter. |
|
Subscribes to task updates for tasks not in a terminal state. |