---
title: "POST /v1/projects/{projectsId}/locations/{locationsId}/apps/{appsId}/sessions/{sessionsId}:runSession"
method: POST
path: "/v1/projects/{projectsId}/locations/{locationsId}/apps/{appsId}/sessions/{sessionsId}:runSession"
tags: ["projects"]
---

# POST /v1/projects/{projectsId}/locations/{locationsId}/apps/{appsId}/sessions/{sessionsId}:runSession

`POST /v1/projects/{projectsId}/locations/{locationsId}/apps/{appsId}/sessions/{sessionsId}:runSession`

## Request

- Base URL: `https://ces.googleapis.com`
- URL: `https://ces.googleapis.com/v1/projects/{projectsId}/locations/{locationsId}/apps/{appsId}/sessions/{sessionsId}:runSession`
- Auth: one of:
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/ces`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/ces`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/cloud-platform`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`

Initiates a single-turn interaction with the CES agent within a session.

## Path parameters

- `projectsId` string, required
- `locationsId` string, required
- `appsId` string, required
- `sessionsId` string, required

## Query parameters

- `$.xgafv` '1' | '2'
- `access_token` string
- `alt` 'json' | 'media' | 'proto'
- `callback` string
- `fields` string
- `key` string
- `oauth_token` string
- `prettyPrint` boolean
- `quotaUser` string
- `uploadType` string
- `upload_protocol` string

## Request body

- RunSessionRequest: Request message for SessionService.RunSession.
  - `config` SessionConfig: The configuration for the session.
    - `deployment` string: Optional. The deployment of the app to use for the session. Format: `projects/{project}/locations/{location}/apps/{app}/deployments/{deployment}`
    - `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 StreamRunSession or BidiRunSession.
    - `entryAgent` string: Optional. The entry agent to handle the session. If not specified, the session will be handled by the root agent of the app. Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}`
    - `excludeDiagnosticInfo` boolean: Optional. Whether to exclude diagnostic info from the session output.
    - `historicalContexts` 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.
      - `chunks` Chunk[]: Optional. Content of the message as a series of chunks.
        - `agentTransfer` AgentTransfer: Represents an event indicating the transfer of a conversation to a different agent.
          - `displayName` string: Output only. Display name of the agent.
          - `targetAgent` string: Required. The agent to which the conversation is being transferred. The agent will handle the conversation from this point forward. Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}`
        - `blob` Blob: Represents a blob input or output in the conversation.
          - `data` string, byte: Required. Raw bytes of the blob.
          - `mimeType` string: Required. The IANA standard MIME type of the source data.
        - `defaultVariables` object: A struct represents default variables at the start of the conversation, keyed by variable names.
        - `image` Image: Represents an image input or output in the conversation.
          - `altText` string: Optional. The alternative text for the image.
          - `data` string, byte: Required. Raw bytes of the image.
          - `mimeType` string: Required. The IANA standard MIME type of the source data. Supported image types includes: * image/png * image/jpeg * image/webp
        - `payload` object: Optional. Custom payload data.
        - `text` string: Optional. Text data.
        - `toolCall` ToolCall: Request for the client or the agent to execute the specified tool.
          - `agentName` string: Output only. Human-readable name of the agent that issued this call, e.g. "Contract Architect". Empty when the root agent issued it.
          - `args` object: Optional. The input parameters and values for the tool in JSON object format.
          - `displayName` string: Output only. Display name of the tool.
          - `id` string: Optional. The unique identifier of the tool call. If populated, the client should return the execution result with the matching ID in ToolResponse.
          - `parentToolCallId` string: Output only. The id of the tool call that caused this one, when it was issued by a sub-agent working on behalf of a parent call. Empty for top-level calls. Lets a client group a sub-agent's work under the call that started it instead of rendering every step as a sibling.
          - `targetApp` string: Output only. The app this call targets, derived by the assistant from the call's resource arguments: an app resource name, `PROJECT` for location-scoped tools, or empty for session-local tools. Set only in project-scoped assistant sessions.
          - `tool` string: Optional. The name of the tool to execute. Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`
          - `toolsetTool` ToolsetTool: A tool that is created from a toolset.
            - `toolId` string: Optional. The tool ID to filter the tools to retrieve the schema for.
            - `toolset` string: Required. The resource name of the Toolset from which this tool is derived. Format: `projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}`
        - `toolResponse` ToolResponse: The execution result of a specific tool from the client or the agent.
          - `agentName` string: Output only. Human-readable name of the agent that issued this call, e.g. "Contract Architect". Empty when the root agent issued it.
          - `displayName` string: Output only. Display name of the tool.
          - `id` string: Optional. The matching ID of the tool call the response is for.
          - `parentToolCallId` string: Output only. The id of the tool call that caused this one, when it was issued by a sub-agent working on behalf of a parent call. Empty for top-level calls. Lets a client group a sub-agent's work under the call that started it instead of rendering every step as a sibling.
          - `response` object: Required. The tool execution result in JSON object format. Use "output" key to specify tool response and "error" key to specify error details (if any). If "output" and "error" keys are not specified, then whole "response" is treated as tool execution result.
          - `targetApp` string: Output only. The app the executed tool targeted; mirrors ToolCall.target_app.
          - `tool` string: Optional. The name of the tool to execute. Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`
          - `toolsetTool` ToolsetTool: A tool that is created from a toolset.
            - `toolId` string: Optional. The tool ID to filter the tools to retrieve the schema for.
            - `toolset` string: Required. The resource name of the Toolset from which this tool is derived. Format: `projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}`
        - `transcript` string: Optional. Transcript associated with the audio.
        - `updatedVariables` object: A struct represents variables that were updated in the conversation, keyed by variable names.
      - `eventTime` string, google-datetime: Optional. Timestamp when the message was sent or received. Should not be used if the message is part of an example.
      - `role` string: Optional. The role within the conversation, e.g., user, agent.
    - `includeLlmThoughtSummary` boolean: Optional. Whether to include LLM thought summaries in the session outputs.
    - `includeProgressUpdate` boolean: Optional. Whether to include intermediate processing update to the client. If enabled, the update will be sent back in SessionOutput.progress.
    - `inputAudioConfig` InputAudioConfig: InputAudioConfig configures how the CES agent should interpret the incoming audio data.
      - `audioEncoding` 'AUDIO_ENCODING_UNSPECIFIED' | 'LINEAR16' | 'MULAW' | 'ALAW': Required. The encoding of the input audio data.
      - `noiseSuppressionLevel` string: Optional. Whether to enable noise suppression on the input audio. Available values are "low", "moderate", "high", "very_high".
      - `sampleRateHertz` integer: Required. The sample rate (in Hertz) of the input audio data.
    - `outputAudioConfig` OutputAudioConfig: OutputAudioConfig configures how the CES agent should synthesize outgoing audio responses.
      - `audioEncoding` 'AUDIO_ENCODING_UNSPECIFIED' | 'LINEAR16' | 'MULAW' | 'ALAW': Required. The encoding of the output audio data.
      - `sampleRateHertz` integer: Required. The sample rate (in Hertz) of the output audio data.
    - `remoteDialogflowQueryParameters` SessionConfigRemoteDialogflowQueryParameters: [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.
      - `endUserMetadata` object: Optional. The end user metadata to be sent in [QueryParameters](https://cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3#queryparameters).
      - `payload` object: Optional. The payload to be sent in [QueryParameters](https://cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3#queryparameters).
      - `webhookHeaders` object: Optional. The HTTP headers to be sent as webhook_headers in [QueryParameters](https://cloud.google.com/dialogflow/cx/docs/reference/rpc/google.cloud.dialogflow.cx.v3#queryparameters).
    - `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".
    - `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.
  - `inputs` SessionInput[]: Required. Inputs for the session.
    - `audio` string, byte: Optional. Audio data from the end user.
    - `blob` Blob: Represents a blob input or output in the conversation.
      - `data` string, byte: Required. Raw bytes of the blob.
      - `mimeType` string: Required. The IANA standard MIME type of the source data.
    - `dtmf` string: Optional. DTMF digits from the end user.
    - `event` Event: Event input.
      - `event` string: Required. The name of the event.
      - `variables` object: Optional. Additional variables associated with the event.
    - `image` Image: Represents an image input or output in the conversation.
      - `altText` string: Optional. The alternative text for the image.
      - `data` string, byte: Required. Raw bytes of the image.
      - `mimeType` string: Required. The IANA standard MIME type of the source data. Supported image types includes: * image/png * image/jpeg * image/webp
    - `recordingControl` 'RECORDING_CONTROL_UNSPECIFIED' | 'RECORDING_ENABLED' | 'RECORDING_DISABLED': Optional. Whether the conversation may be recorded and logged from here on. Use this when the app, rather than the agent, decides what may be kept: for example when the end user has to consent to being recorded before anything about the call can be stored. The value stays in effect until the client sends a different one, so it only needs to be sent when the answer changes. Whatever is in effect when a turn completes decides that turn, both whether its audio reaches the recording bucket and whether its transcript reaches conversation history, BigQuery and Cloud Logging. It covers the agent's side of the turn as well as the end user's. Turns that complete before the client first sends this are recorded according to the app's logging settings, as though the field did not exist. If more than one input in the same request sets it, the last one wins.
    - `text` string: Optional. Text data from the end user.
    - `toolResponses` ToolResponses: Execution results for the requested tool calls from the client.
      - `toolResponses` ToolResponse[]: Optional. The list of tool execution results.
        - `agentName` string: Output only. Human-readable name of the agent that issued this call, e.g. "Contract Architect". Empty when the root agent issued it.
        - `displayName` string: Output only. Display name of the tool.
        - `id` string: Optional. The matching ID of the tool call the response is for.
        - `parentToolCallId` string: Output only. The id of the tool call that caused this one, when it was issued by a sub-agent working on behalf of a parent call. Empty for top-level calls. Lets a client group a sub-agent's work under the call that started it instead of rendering every step as a sibling.
        - `response` object: Required. The tool execution result in JSON object format. Use "output" key to specify tool response and "error" key to specify error details (if any). If "output" and "error" keys are not specified, then whole "response" is treated as tool execution result.
        - `targetApp` string: Output only. The app the executed tool targeted; mirrors ToolCall.target_app.
        - `tool` string: Optional. The name of the tool to execute. Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`
        - `toolsetTool` ToolsetTool: A tool that is created from a toolset.
          - `toolId` string: Optional. The tool ID to filter the tools to retrieve the schema for.
          - `toolset` string: Required. The resource name of the Toolset from which this tool is derived. Format: `projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}`
    - `variables` object: Optional. Contextual variables for the session, keyed by name. Only variables declared in the app will be used by the CES agent. Unrecognized variables will still be sent to the Dialogflow agent as additional session parameters.
    - `willContinue` boolean: Optional. A flag to indicate if the current message is a fragment of a larger input in the bidi streaming session. When set to `true`, the agent defers processing until it receives a subsequent message where `will_continue` is `false`, or until the system detects an endpoint in the audio input. NOTE: This field does not apply to audio and DTMF inputs, as they are always processed automatically based on the endpointing signal.

## Response `200`

Successful response

- RunSessionResponse: Response message for SessionService.RunSession.
  - `outputs` SessionOutput[]: Outputs for the session.
    - `audio` string, byte: Output audio from the CES agent.
    - `citations` Citations: Citations associated with the agent response.
      - `citedChunks` CitationsCitedChunk[]: List of cited pieces of information.
        - `requiresAttribution` boolean: Whether this citation requires attribution to be shown to the end users.
        - `text` string: Text used for citation.
        - `title` string: Title of the cited document.
        - `uri` string: URI used for citation.
      - `inlineCitations` CitationsInlineCitation[]: Optional. List of inline citations in the agent response.
        - `citedChunkIndices` integer[]: The indices of the cited chunks that back this text segment. Indices refer to the elements in `cited_chunks`.
        - `endIndex` integer: The ending index (in bytes) of the text segment in the agent response.
        - `startIndex` integer: The starting index (in bytes) of the text segment in the agent response.
    - `diagnosticInfo` SessionOutputDiagnosticInfo: Contains execution details during the processing.
      - `messages` Message[]: List of the messages that happened during the processing.
        - `chunks` Chunk[]: Optional. Content of the message as a series of chunks.
          - `agentTransfer` AgentTransfer: Represents an event indicating the transfer of a conversation to a different agent.
            - `displayName` string: Output only. Display name of the agent.
            - `targetAgent` string: Required. The agent to which the conversation is being transferred. The agent will handle the conversation from this point forward. Format: `projects/{project}/locations/{location}/apps/{app}/agents/{agent}`
          - `blob` Blob: Represents a blob input or output in the conversation.
            - `data` string, byte: Required. Raw bytes of the blob.
            - `mimeType` string: Required. The IANA standard MIME type of the source data.
          - `defaultVariables` object: A struct represents default variables at the start of the conversation, keyed by variable names.
          - `image` Image: Represents an image input or output in the conversation.
            - `altText` string: Optional. The alternative text for the image.
            - `data` string, byte: Required. Raw bytes of the image.
            - `mimeType` string: Required. The IANA standard MIME type of the source data. Supported image types includes: * image/png * image/jpeg * image/webp
          - `payload` object: Optional. Custom payload data.
          - `text` string: Optional. Text data.
          - `toolCall` ToolCall: Request for the client or the agent to execute the specified tool.
            - `agentName` string: Output only. Human-readable name of the agent that issued this call, e.g. "Contract Architect". Empty when the root agent issued it.
            - `args` object: Optional. The input parameters and values for the tool in JSON object format.
            - `displayName` string: Output only. Display name of the tool.
            - `id` string: Optional. The unique identifier of the tool call. If populated, the client should return the execution result with the matching ID in ToolResponse.
            - `parentToolCallId` string: Output only. The id of the tool call that caused this one, when it was issued by a sub-agent working on behalf of a parent call. Empty for top-level calls. Lets a client group a sub-agent's work under the call that started it instead of rendering every step as a sibling.
            - `targetApp` string: Output only. The app this call targets, derived by the assistant from the call's resource arguments: an app resource name, `PROJECT` for location-scoped tools, or empty for session-local tools. Set only in project-scoped assistant sessions.
            - `tool` string: Optional. The name of the tool to execute. Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`
            - `toolsetTool` ToolsetTool: A tool that is created from a toolset.
              - …
          - `toolResponse` ToolResponse: The execution result of a specific tool from the client or the agent.
            - `agentName` string: Output only. Human-readable name of the agent that issued this call, e.g. "Contract Architect". Empty when the root agent issued it.
            - `displayName` string: Output only. Display name of the tool.
            - `id` string: Optional. The matching ID of the tool call the response is for.
            - `parentToolCallId` string: Output only. The id of the tool call that caused this one, when it was issued by a sub-agent working on behalf of a parent call. Empty for top-level calls. Lets a client group a sub-agent's work under the call that started it instead of rendering every step as a sibling.
            - `response` object: Required. The tool execution result in JSON object format. Use "output" key to specify tool response and "error" key to specify error details (if any). If "output" and "error" keys are not specified, then whole "response" is treated as tool execution result.
            - `targetApp` string: Output only. The app the executed tool targeted; mirrors ToolCall.target_app.
            - `tool` string: Optional. The name of the tool to execute. Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`
            - `toolsetTool` ToolsetTool: A tool that is created from a toolset.
              - …
          - `transcript` string: Optional. Transcript associated with the audio.
          - `updatedVariables` object: A struct represents variables that were updated in the conversation, keyed by variable names.
        - `eventTime` string, google-datetime: Optional. Timestamp when the message was sent or received. Should not be used if the message is part of an example.
        - `role` string: Optional. The role within the conversation, e.g., user, agent.
      - `rootSpan` Span: A span is a unit of work or a single operation during the request processing.
        - `attributes` object: Output only. Key-value attributes associated with the span.
        - `childSpans` Span[]: Output only. The child spans that are nested under this span.
        - `duration` string, google-duration: Output only. The duration of the span.
        - `endTime` string, google-datetime: Output only. The end time of the span.
        - `name` string: Output only. The name of the span.
        - `startTime` string, google-datetime: Output only. The start time of the span.
    - `endSession` 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.
      - `metadata` object: Optional. Provides additional information about the end session signal, such as the reason for ending the session.
    - `googleSearchSuggestions` GoogleSearchSuggestions: Search suggestions from Google Search Tool.
      - `htmls` string[]: Compliant HTML and CSS styling for search suggestions. The provided HTML and CSS automatically adapts to your device settings, displaying in either light or dark mode indicated by `@media(prefers-color-scheme)`.
      - `webSearchQueries` WebSearchQuery[]: List of queries used to perform the google search along with the search result URIs forming the search suggestions.
        - `query` string: The search query text.
        - `uri` string: The URI to the Google Search results page for the query.
    - `image` Image: Represents an image input or output in the conversation.
      - `altText` string: Optional. The alternative text for the image.
      - `data` string, byte: Required. Raw bytes of the image.
      - `mimeType` string: Required. The IANA standard MIME type of the source data. Supported image types includes: * image/png * image/jpeg * image/webp
    - `payload` object: Custom payload with structured output from the CES agent.
    - `progress` string: Intermediate progress update from the CES agent.
    - `text` string: Output text from the CES agent.
    - `toolCalls` ToolCalls: Request for the client to execute the tools and return the execution results before continuing the session.
      - `toolCalls` ToolCall[]: Optional. The list of tool calls to execute.
        - `agentName` string: Output only. Human-readable name of the agent that issued this call, e.g. "Contract Architect". Empty when the root agent issued it.
        - `args` object: Optional. The input parameters and values for the tool in JSON object format.
        - `displayName` string: Output only. Display name of the tool.
        - `id` string: Optional. The unique identifier of the tool call. If populated, the client should return the execution result with the matching ID in ToolResponse.
        - `parentToolCallId` string: Output only. The id of the tool call that caused this one, when it was issued by a sub-agent working on behalf of a parent call. Empty for top-level calls. Lets a client group a sub-agent's work under the call that started it instead of rendering every step as a sibling.
        - `targetApp` string: Output only. The app this call targets, derived by the assistant from the call's resource arguments: an app resource name, `PROJECT` for location-scoped tools, or empty for session-local tools. Set only in project-scoped assistant sessions.
        - `tool` string: Optional. The name of the tool to execute. Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`
        - `toolsetTool` ToolsetTool: A tool that is created from a toolset.
          - `toolId` string: Optional. The tool ID to filter the tools to retrieve the schema for.
          - `toolset` string: Required. The resource name of the Toolset from which this tool is derived. Format: `projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}`
    - `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.
    - `turnIndex` integer: Indicates the sequential order of conversation turn to which this output belongs to, starting from 1.

## Changes

- **2026-11-17** `455f2f484021`: 4 info
  - the security scope `https://www.googleapis.com/auth/ces` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/ces` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2c`
- **2026-11-11** `d1599b011b2e`: 4 info
  - the security scope `https://www.googleapis.com/auth/ces` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/ces` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was removed from the endpoint's security scheme `Oauth2c`

[Operation history](https://skmtc.dev/google/apis/ces/changes/v1/projects/:projectsId/locations/:locationsId/apps/:appsId/sessions/:sessionsId:runSession/post.md)

---

[API](https://skmtc.dev/google/apis/ces.md) - [All operations](https://skmtc.dev/google/apis/ces/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/ces/revisions/455f2f484021?raw)
