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 |
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). Created by the A2A server. |
status |
The current status of a Task, including state and a message. |
artifacts[] |
A set of output artifacts for a Task. |
history[] |
protolint:disable REPEATED_FIELD_NAMES_PLURALIZED The history of interactions from a task. |
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 |
The current state of this task |
message |
A message associated with the status. |
timestamp |
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
The set of states a Task can be in.
| Enums | |
|---|---|
TASK_STATE_UNSPECIFIED |
|
TASK_STATE_SUBMITTED |
Represents the status that acknowledges a task is created |
TASK_STATE_WORKING |
Represents the status that a task is actively being processed |
TASK_STATE_COMPLETED |
Represents the status a task is finished. This is a terminal state |
TASK_STATE_FAILED |
Represents the status a task is done but failed. This is a terminal state |
TASK_STATE_CANCELLED |
Represents the status a task was cancelled before it finished. This is a terminal state. |
TASK_STATE_INPUT_REQUIRED |
Represents the status that the task requires information to complete. This is an interrupted state. |
TASK_STATE_REJECTED |
Represents the status 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 |
Represents the state that some authentication is needed from the upstream client. Authentication is expected to come out-of-band thus this is not an interrupted or terminal state. |
Message
Message is one unit of communication between client and server. It is associated with a context and optionally a task. Since the server is responsible for the context definition, it must always provide a contextId in its messages. The client can optionally provide the contextId if it knows the context to associate the message to. Similarly for taskId, except the server decides if a task is created and whether to include the taskId.
| JSON representation |
|---|
{ "messageId": string, "contextId": string, "taskId": string, "role": enum ( |
| Fields | |
|---|---|
messageId |
The unique identifier (e.g. UUID)of the message. This is required and created by the message creator. |
contextId |
The context id of the message. This is optional and if set, the message will be associated with the given context. |
taskId |
The task id of the message. This is optional and if set, the message will be associated with the given task. |
role |
A role for the message. |
content[] |
protolint:disable REPEATED_FIELD_NAMES_PLURALIZED Content is the container of the message content. |
metadata |
protolint:enable REPEATED_FIELD_NAMES_PLURALIZED Any optional metadata to provide along with the message. |
extensions[] |
The URIs of extensions that are present or contributed to this Message. |
Role
| Enums | |
|---|---|
ROLE_UNSPECIFIED |
|
ROLE_USER |
USER role refers to communication from the client to the server. |
ROLE_AGENT |
AGENT role refers to communication 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 }, // Union field |
| Fields | |
|---|---|
metadata |
Optional metadata associated with this part. |
Union field
|
|
text |
|
file |
|
data |
|
FilePart
FilePart represents the different ways files can be provided. If files are small, directly feeding the bytes is supported via fileWithBytes. If the file is large, the agent should read the content as appropriate directly from the fileWithUri source.
| JSON representation |
|---|
{ "mimeType": string, "name": string, // Union field |
| Fields | |
|---|---|
mimeType |
|
name |
|
Union field
|
|
fileWithUri |
|
fileWithBytes |
A base64-encoded string. |
DataPart
DataPart represents a structured blob. This is most commonly a JSON payload.
| JSON representation |
|---|
{ "data": { object } } |
| Fields | |
|---|---|
data |
|
Artifact
Artifacts are the container for task completed results. These are similar to Messages but are intended to be the product of a task, as opposed to point-to-point communication.
| JSON representation |
|---|
{
"artifactId": string,
"name": string,
"description": string,
"parts": [
{
object ( |
| Fields | |
|---|---|
artifactId |
Unique identifier (e.g. UUID) for the artifact. It must be at least unique within a task. |
name |
A human readable name for the artifact. |
description |
A human readable description of the artifact, optional. |
parts[] |
The content of the artifact. |
metadata |
Optional metadata included with the artifact. |
extensions[] |
The URIs of extensions that are present or contributed to this Artifact. |
Methods |
|
|---|---|
|
Cancel a task from the agent. |
|
Get the current state of a task from the agent. |
|
TaskSubscription is a streaming call that will return a stream of task update events. |