- [JSON representation](https://docs.cloud.google.com/gemini/data-agents/reference/rest/Shared.Types/StreamResponse.md.txt#SCHEMA_REPRESENTATION)
- [TaskStatusUpdateEvent](https://docs.cloud.google.com/gemini/data-agents/reference/rest/Shared.Types/StreamResponse.md.txt#TaskStatusUpdateEvent)
  - [JSON representation](https://docs.cloud.google.com/gemini/data-agents/reference/rest/Shared.Types/StreamResponse.md.txt#TaskStatusUpdateEvent.SCHEMA_REPRESENTATION)
- [TaskArtifactUpdateEvent](https://docs.cloud.google.com/gemini/data-agents/reference/rest/Shared.Types/StreamResponse.md.txt#TaskArtifactUpdateEvent)
  - [JSON representation](https://docs.cloud.google.com/gemini/data-agents/reference/rest/Shared.Types/StreamResponse.md.txt#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 |
|---|
| ``` { // Union field `payload` can be only one of the following: "task": { object (`Task`) }, "message": { object (`Message`) }, "statusUpdate": { object (`TaskStatusUpdateEvent`) }, "artifactUpdate": { object (`TaskArtifactUpdateEvent`) } // End of list of possible types for union field `payload`. } ``` |

| Fields ||
|---|---|
| Union field `payload`. `payload` can be only one of the following: ||
| `task` | ``object (`Task`)`` |
| `message` | ``object (`Message`)`` |
| `statusUpdate` | ``object (`TaskStatusUpdateEvent`)`` |
| `artifactUpdate` | ``object (`TaskArtifactUpdateEvent`)`` |

## TaskStatusUpdateEvent

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

| JSON representation |
|---|
| ``` { "taskId": string, "contextId": string, "status": { object (`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 (`TaskStatus`)`` The new status of the task. |
| `final` | `boolean` Whether this is the last status update expected for this task. |
| `metadata` | ``object (`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 (`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 (`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 (`Struct` format)`` Optional metadata associated with the artifact update. |