- [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/StreamResponse#SCHEMA_REPRESENTATION)
- [TaskStatusUpdateEvent](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/StreamResponse#TaskStatusUpdateEvent)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/StreamResponse#TaskStatusUpdateEvent.SCHEMA_REPRESENTATION)
- [TaskArtifactUpdateEvent](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/StreamResponse#TaskArtifactUpdateEvent)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/StreamResponse#TaskArtifactUpdateEvent.SCHEMA_REPRESENTATION)

The stream response for a message. The stream should be one of the following sequences: If the response is a message, the stream should contain one, and only one, message and then close If the response is a task lifecycle, the first response should be a Task object followed by zero or more TaskStatusUpdateEvents and TaskArtifactUpdateEvents. The stream should complete when the Task if in an interrupted or terminal state. A stream that ends before these conditions are met are

| JSON representation |
|---|
| ``` { // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "task": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/projects.locations.collections.engines.assistants.agents.a2a.v1.tasks#Task`) }, "message": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/projects.locations.collections.engines.assistants.agents.a2a.v1.tasks#Message`) }, "statusUpdate": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/StreamResponse#TaskStatusUpdateEvent`) }, "artifactUpdate": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/StreamResponse#TaskArtifactUpdateEvent`) } // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `task` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/projects.locations.collections.engines.assistants.agents.a2a.v1.tasks#Task`)`` |
| `message` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/projects.locations.collections.engines.assistants.agents.a2a.v1.tasks#Message`)`` |
| `statusUpdate` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/StreamResponse#TaskStatusUpdateEvent`)`` |
| `artifactUpdate` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/StreamResponse#TaskArtifactUpdateEvent`)`` |
| End of mutually exclusive fields. ||

## TaskStatusUpdateEvent

TaskStatusUpdateEvent is a delta even on a task indicating that a task has changed.

| JSON representation |
|---|
| ``` { "taskId": string, "contextId": string, "status": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/projects.locations.collections.engines.assistants.agents.a2a.v1.tasks#TaskStatus`) }, "final": boolean, "metadata": { object } } ``` |

| Fields ||
|---|---|
| `taskId` | `string` The ID of the task that is changed |
| `contextId` | `string` The ID of the context that the task belongs to |
| `status` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/projects.locations.collections.engines.assistants.agents.a2a.v1.tasks#TaskStatus`)`` The new status of the task. |
| `final` | `boolean` Whether this is the last status update expected for this task. |
| `metadata` | ``object (`https://protobuf.dev/reference/protobuf/google.protobuf#struct` format)`` Optional metadata to associate with the task update. |

## TaskArtifactUpdateEvent

TaskArtifactUpdateEvent represents a task delta where an artifact has been generated.

| JSON representation |
|---|
| ``` { "taskId": string, "contextId": string, "artifact": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/projects.locations.collections.engines.assistants.agents.a2a.v1.tasks#Artifact`) }, "append": boolean, "lastChunk": boolean, "metadata": { object } } ``` |

| Fields ||
|---|---|
| `taskId` | `string` The ID of the task for this artifact |
| `contextId` | `string` The ID of the context that this task belongs too |
| `artifact` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1/projects.locations.collections.engines.assistants.agents.a2a.v1.tasks#Artifact`)`` The artifact itself |
| `append` | `boolean` Whether this should be appended to a prior one produced |
| `lastChunk` | `boolean` Whether this represents the last part of an artifact |
| `metadata` | ``object (`https://protobuf.dev/reference/protobuf/google.protobuf#struct` format)`` Optional metadata associated with the artifact update. |