- [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#SCHEMA_REPRESENTATION)
- [SessionOutput](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#SessionOutput)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#SessionOutput.SCHEMA_REPRESENTATION)
- [ToolCalls](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#ToolCalls)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#ToolCalls.SCHEMA_REPRESENTATION)
- [EndSession](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#EndSession)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#EndSession.SCHEMA_REPRESENTATION)
- [SessionOutput.DiagnosticInfo](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#SessionOutput.DiagnosticInfo)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#SessionOutput.DiagnosticInfo.SCHEMA_REPRESENTATION)

Response message for `https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/projects.locations.apps.sessions/runSession#google.cloud.ces.v1beta.SessionService.RunSession`.

| JSON representation |
|---|
| ``` { "outputs": [ { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#SessionOutput`) } ] } ``` |

| Fields ||
|---|---|
| `outputs[]` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#SessionOutput`)`` Outputs for the session. |

## SessionOutput

Output for the session.

| JSON representation |
|---|
| ``` { "turnIndex": integer, "turnCompleted": boolean, "diagnosticInfo": { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#SessionOutput.DiagnosticInfo`) }, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "text": string, "audio": string, "toolCalls": { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#ToolCalls`) }, "citations": { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/Citations`) }, "googleSearchSuggestions": { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/GoogleSearchSuggestions`) }, "endSession": { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#EndSession`) }, "payload": { object }, "image": { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/Image`) }, "progress": string // End of mutually exclusive fields. } ``` |

| Fields ||
|---|---|
| `turnIndex` | `integer` Indicates the sequential order of conversation turn to which this output belongs to, starting from 1. |
| `turnCompleted` | `boolean` If true, the CES agent has detected the end of the current conversation turn and will provide no further output for this turn. |
| `diagnosticInfo` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#SessionOutput.DiagnosticInfo`)`` Optional. Diagnostic information contains execution details during the processing of the input. Only populated in the last SessionOutput (with `turnCompleted=true`) for each turn. |
| The type of the output. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `text` | `string` Output text from the CES agent. |
| `audio` | `string (https://developers.google.com/discovery/v1/type-format format)` Output audio from the CES agent. A base64-encoded string. |
| `toolCalls` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#ToolCalls`)`` Request for the client to execute the tools. |
| `citations` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/Citations`)`` Citations that provide the source information for the agent's generated text. |
| `googleSearchSuggestions` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/GoogleSearchSuggestions`)`` The suggestions returned from Google Search as a result of invoking the `https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/projects.locations.apps.tools#Tool.GoogleSearchTool`. |
| `endSession` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/RunSessionResponse#EndSession`)`` Indicates the session has ended. |
| `payload` | ``object (`https://protobuf.dev/reference/protobuf/google.protobuf#struct` format)`` Custom payload with structured output from the CES agent. |
| `image` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/Image`)`` Output image from the CES agent. |
| `progress` | `string` Intermediate progress update from the CES agent. |
| End of mutually exclusive fields. ||

## ToolCalls

Request for the client to execute the tools and return the execution results before continuing the session.

| JSON representation |
|---|
| ``` { "toolCalls": [ { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/ToolCall`) } ] } ``` |

| Fields ||
|---|---|
| `toolCalls[]` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/ToolCall`)`` Optional. The list of tool calls to execute. |

## EndSession

Indicates the session has terminated, due to either successful completion (e.g. user says "Good bye!" ) or an agent escalation.

The agent will not process any further inputs after session is terminated and the client should half-close and disconnect after receiving all remaining responses from the agent.

| JSON representation |
|---|
| ``` { "metadata": { object } } ``` |

| Fields ||
|---|---|
| `metadata` | ``object (`https://protobuf.dev/reference/protobuf/google.protobuf#struct` format)`` Optional. Provides additional information about the end session signal, such as the reason for ending the session. |

## SessionOutput.DiagnosticInfo

Contains execution details during the processing.

| JSON representation |
|---|
| ``` { "messages": [ { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/Message`) } ], "rootSpan": { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/Span`) } } ``` |

| Fields ||
|---|---|
| `messages[]` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/Message`)`` List of the messages that happened during the processing. |
| `rootSpan` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1beta/Span`)`` A trace of the entire request processing, represented as a root span. This span can contain nested child spans for specific operations. |