- [HTTP request](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/projects.locations.apps.sessions/streamRunSession#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/projects.locations.apps.sessions/streamRunSession#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/projects.locations.apps.sessions/streamRunSession#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/projects.locations.apps.sessions/streamRunSession#body.request_body.SCHEMA_REPRESENTATION)
    - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/projects.locations.apps.sessions/streamRunSession#body.request_body.SCHEMA_REPRESENTATION.config.SCHEMA_REPRESENTATION)
    - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/projects.locations.apps.sessions/streamRunSession#body.request_body.SCHEMA_REPRESENTATION.config.SCHEMA_REPRESENTATION_1)
    - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/projects.locations.apps.sessions/streamRunSession#body.request_body.SCHEMA_REPRESENTATION.config.SCHEMA_REPRESENTATION_2)
    - [JSON representation](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/projects.locations.apps.sessions/streamRunSession#body.request_body.SCHEMA_REPRESENTATION.config.SCHEMA_REPRESENTATION_3)
- [Response body](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/projects.locations.apps.sessions/streamRunSession#body.response_body)
- [Authorization scopes](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/projects.locations.apps.sessions/streamRunSession#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/projects.locations.apps.sessions/streamRunSession#body.aspect_1)

Initiates a single-turn interaction with the CES agent. Uses server-side streaming to deliver incremental results and partial responses as they are generated.

By default, complete responses (e.g., messages from callbacks or full LLM responses) are sent to the client as soon as they are available. To enable streaming individual text chunks directly from the model, set `https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/SessionConfig#FIELDS.enable_text_streaming` to true.

### HTTP request

`POST https://ces.googleapis.com/v1/{config.session=projects/*/locations/*/apps/*/sessions/*}:streamRunSession`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `config.session` | `string` Required. The unique identifier of the session. Format: `projects/{project}/locations/{location}/apps/{app}/sessions/{session}` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "config": { "session": string, "inputAudioConfig": { "audioEncoding": enum (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/SessionConfig#AudioEncoding`), "sampleRateHertz": integer, "noiseSuppressionLevel": string }, "outputAudioConfig": { "audioEncoding": enum (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/SessionConfig#AudioEncoding`), "sampleRateHertz": integer }, "historicalContexts": [ { "role": string, "chunks": [ { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/Message#Chunk`) } ], "eventTime": string } ], "entryAgent": string, "deployment": string, "timeZone": string, "useToolFakes": boolean, "remoteDialogflowQueryParameters": { "webhookHeaders": { string: string, ... }, "payload": { object }, "endUserMetadata": { object } }, "enableTextStreaming": boolean, "includeLlmThoughtSummary": boolean, "excludeDiagnosticInfo": boolean, "includeProgressUpdate": boolean }, "inputs": [ { object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/SessionInput`) } ] } ``` |

| Fields ||
|---|---|
| `config.inputAudioConfig` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/SessionConfig#InputAudioConfig`)`` Optional. Configuration for processing the input audio. |
| `config.outputAudioConfig` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/SessionConfig#OutputAudioConfig`)`` Optional. Configuration for generating the output audio. |
| `config.historicalContexts[]` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/Message`)`` Optional. The historical context of the session, including user inputs, agent responses, and other messages. Typically, CES agent would manage session automatically so client doesn't need to explicitly populate this field. However, client can optionally override the historical contexts to force the session start from certain state. |
| `config.entryAgent` | `string` Optional. The entry agent to handle the session. If not specified, the session will be handled by the `https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/projects.locations.apps#App.FIELDS.root_agent` of the app. Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}` |
| `config.deployment` | `string` Optional. The deployment of the app to use for the session. Format: `projects/{project}/locations/{location}/apps/{app}/deployments/{deployment}` |
| `config.timeZone` | `string` Optional. The time zone of the user. If provided, the agent will use the time zone for date and time related variables. Otherwise, the agent will use the time zone specified in the App.time_zone_settings. The format is the IANA Time Zone Database time zone, e.g. "America/Los_Angeles". |
| `config.useToolFakes` | `boolean` Optional. Whether to use tool fakes for the session. If this field is set, the agent will attempt use tool fakes instead of calling the real tools. |
| `config.remoteDialogflowQueryParameters` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/SessionConfig#SessionConfig.RemoteDialogflowQueryParameters`)`` Optional. [QueryParameters](https://cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3#queryparameters) to send to the remote [Dialogflow](https://cloud.google.com/dialogflow/cx/docs/concept/console-conversational-agents) agent when the session control is transferred to the remote agent. |
| `config.enableTextStreaming` | `boolean` Optional. Whether to stream text output from the model to the client incrementally as it is generated. Defaults to `false`. - When disabled, the model's text output is buffered, and each text output sent to the client is a complete sentence. Clients can render each text output on a new line. - When enabled, each text output may contain only part of a sentence. Clients should concatenate consecutive text outputs to render the complete response. NOTE: This is only supported for text (non-voice) sessions using `https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/projects.locations.apps.sessions/streamRunSession#google.cloud.ces.v1.SessionService.StreamRunSession` or `BidiRunSession`. |
| `config.includeLlmThoughtSummary` | `boolean` Optional. Whether to include LLM thought summaries in the session outputs. |
| `config.excludeDiagnosticInfo` | `boolean` Optional. Whether to exclude diagnostic info from the session output. |
| `config.includeProgressUpdate` | `boolean` Optional. Whether to include intermediate processing update to the client. If enabled, the update will be sent back in `https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/RunSessionResponse#SessionOutput.FIELDS.progress`. |
| `inputs[]` | ``object (`https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/SessionInput`)`` Required. Inputs for the session. |

### Response body

If successful, the response body contains a stream of `https://docs.cloud.google.com/gemini-enterprise-cx/cx-agent-studio/reference/rest/v1/RunSessionResponse` instances.

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-platform`
- `
  https://www.googleapis.com/auth/ces`

For more information, see the [Authentication Overview](https://docs.cloud.google.com/docs/authentication#authorization-gcp).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `session` resource:

- `ces.sessions.runSession`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).