- [HTTP request](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#body.StreamAssistResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#body.aspect_1)
- [AgentsSpec](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#AgentsSpec)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#AgentsSpec.SCHEMA_REPRESENTATION)
- [AgentSpec](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#AgentSpec)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#AgentSpec.SCHEMA_REPRESENTATION)
- [MentionMode](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#MentionMode)
- [ToolsSpec](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#ToolsSpec)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#ToolsSpec.SCHEMA_REPRESENTATION)
- [VertexAiSearchSpec](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#VertexAiSearchSpec)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#VertexAiSearchSpec.SCHEMA_REPRESENTATION)
- [WebGroundingSpec](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#WebGroundingSpec)
- [ImageGenerationSpec](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#ImageGenerationSpec)
- [VideoGenerationSpec](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#VideoGenerationSpec)
- [GenerationSpec](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#GenerationSpec)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#GenerationSpec.SCHEMA_REPRESENTATION)
- [SessionInfo](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#SessionInfo)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#SessionInfo.SCHEMA_REPRESENTATION)
- [InvokedSkill](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#InvokedSkill)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#InvokedSkill.SCHEMA_REPRESENTATION)
- [ConnectorAuthError](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#ConnectorAuthError)
  - [JSON representation](https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#ConnectorAuthError.SCHEMA_REPRESENTATION)

Assists the user with a query in a streaming fashion.

### HTTP request

Choose an endpoint:
global us   
`POST https://discoveryengine.googleapis.com/v1beta/{name=projects/*/locations/*/collections/*/engines/*/assistants/*}:streamAssist`

<br />

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

### Path parameters

| Parameters ||
|---|---|
| `name` | `string` Required. The resource name of the `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants#Assistant`. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/assistants/{assistant}` |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "query": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/Query`) }, "session": string, "userMetadata": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/AssistUserMetadata`) }, "agentsSpec": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#AgentsSpec`) }, "toolsSpec": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#ToolsSpec`) }, "generationSpec": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#GenerationSpec`) } } ``` |

| Fields ||
|---|---|
| `query` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/Query`)`` Optional. Current user query. Empty query is only supported if `fileIds` are provided. In this case, the answer will be generated based on those context files. |
| `session` | `string` Optional. The session to use for the request. If specified, the assistant has access to the session history, and the query and the answer are stored there. If `-` is specified as the session ID, or it is left empty, then a new session is created with an automatically generated ID. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}` |
| `userMetadata` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/AssistUserMetadata`)`` Optional. Information about the user initiating the query. |
| `agentsSpec` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#AgentsSpec`)`` Optional. Specification of agents that are used to serve the request. |
| `toolsSpec` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#ToolsSpec`)`` Optional. Specification of tools that are used to serve the request. |
| `generationSpec` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#GenerationSpec`)`` Optional. Specification of the generation configuration for the request. |

### Response body

Response for the `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#google.cloud.discoveryengine.v1beta.AssistantService.StreamAssist` method.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "answer": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.sessions.assistAnswers#AssistAnswer`) }, "sessionInfo": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#SessionInfo`) }, "assistToken": string, "invocationTools": [ string ], "invokedSkills": [ { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#InvokedSkill`) } ], "connectorAuthErrors": [ { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#ConnectorAuthError`) } ] } ``` |

| Fields ||
|---|---|
| `answer` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.sessions.assistAnswers#AssistAnswer`)`` assistants.assist answer resource object containing parts of the assistant's final answer for the user's query. Not present if the current response doesn't add anything to previously sent `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.sessions.assistAnswers#AssistAnswer.FIELDS.replies`. Observe `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.sessions.assistAnswers#AssistAnswer.FIELDS.state` to see if more parts are to be expected. While the state is `IN_PROGRESS`, the `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.sessions.assistAnswers#AssistAnswer.FIELDS.replies` field in each response will contain replies (reply fragments) to be appended to the ones received in previous responses. `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.sessions.assistAnswers#AssistAnswer.FIELDS.name` won't be filled. If the state is `SUCCEEDED`, `FAILED` or `SKIPPED`, the response is the last response and `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.sessions.assistAnswers#AssistAnswer.FIELDS.name` will have a value. |
| `sessionInfo` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#SessionInfo`)`` Session information. Only included in the final StreamAssistResponse of the response stream. |
| `assistToken` | `string` A global unique ID that identifies the current pair of request and stream of responses. Used for feedback and support. |
| `invocationTools[]` | `string` The tool names of the tools that were invoked. |
| `invokedSkills[]` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#InvokedSkill`)`` The skills executed during the turn. |
| `connectorAuthErrors[]` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#ConnectorAuthError`)`` Per-connector authentication errors encountered during the request. Present when one or more connectors failed authentication but the request proceeded with the remaining connectors. |

### Authorization scopes

Requires one of the following OAuth scopes:

- `https://www.googleapis.com/auth/cloud-platform`
- `https://www.googleapis.com/auth/discoveryengine.assist.readwrite`
- `https://www.googleapis.com/auth/discoveryengine.readwrite`
- `https://www.googleapis.com/auth/discoveryengine.serving.readwrite`

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 `name` resource:

- `discoveryengine.assistants.assist`

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

## AgentsSpec

Specification of agents that are used to serve the request.

| JSON representation |
|---|
| ``` { "agentSpecs": [ { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#AgentSpec`) } ], "mentionMode": enum (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#MentionMode`) } ``` |

| Fields ||
|---|---|
| `agentSpecs[]` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#AgentSpec`)`` Optional. Specification of agents that are used to serve the request. |
| `mentionMode` | ``enum (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#MentionMode`)`` Optional. How to invoke the mentioned agents in `agentSpecs`. See `MentionMode`. |

## AgentSpec

Specification of an agent.

| JSON representation |
|---|
| ``` { "agentId": string, "inputVariables": { object } } ``` |

| Fields ||
|---|---|
| `agentId` | `string` Required. ID to identify the agent resource serving the request. This field must conform to [RFC-1034](https://tools.ietf.org/html/rfc1034) with a length limit of 63 characters. |
| `inputVariables` | ``object (`https://protobuf.dev/reference/protobuf/google.protobuf#struct` format)`` Optional. Input variables supplied at invocation time for a WorkflowAgent. The keys are the declared input variable names; the values are the user- or caller-supplied values. Exposed to downstream nodes as global inputs. |

## MentionMode

How to invoke the mentioned agents in `agentSpecs`.

| Enums ||
|---|---|
| `MENTION_MODE_UNSPECIFIED` | Defaults to `DIRECT`. |
| `DIRECT` | Mentioned agent becomes the top-level agent that runs the turn. Only one entry in `agentSpecs` is allowed. |
| `TOOL` | Each `AgentSpec` is attached as a tool under a synthesized orchestrator. Multi-mention. MVP: workflow agents only, latest published revision; do not set `version` / `revisionId`. |
| `TOOL_WORKFLOW_DIRECT` | Single workflow agent as its own chat surface. Exactly one `AgentSpec`; set either `version = "draft"` (Agent table) or `revisionId` (specific `AgentRevision`). Workflow must have a `ManualTrigger`. |

## ToolsSpec

Specification of tools that are used to serve the request.

| JSON representation |
|---|
| ``` { "vertexAiSearchSpec": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#VertexAiSearchSpec`) }, "webGroundingSpec": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#WebGroundingSpec`) }, "imageGenerationSpec": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#ImageGenerationSpec`) }, "videoGenerationSpec": { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#VideoGenerationSpec`) } } ``` |

| Fields ||
|---|---|
| `vertexAiSearchSpec` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#VertexAiSearchSpec`)`` Optional. Specification of the Vertex AI Search tool. |
| `webGroundingSpec` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#WebGroundingSpec`)`` Optional. Specification of the web grounding tool. If field is present, enables grounding with web search. Works only if `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants#Assistant.FIELDS.web_grounding_type` is `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants#WebGroundingType.ENUM_VALUES.WEB_GROUNDING_TYPE_GOOGLE_SEARCH` or `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants#WebGroundingType.ENUM_VALUES.WEB_GROUNDING_TYPE_ENTERPRISE_WEB_SEARCH`. |
| `imageGenerationSpec` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#ImageGenerationSpec`)`` Optional. Specification of the image generation tool. |
| `videoGenerationSpec` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines.assistants/streamAssist#VideoGenerationSpec`)`` Optional. Specification of the video generation tool. |

## VertexAiSearchSpec

Specification of the Vertex AI Search tool.

| JSON representation |
|---|
| ``` { "dataStoreSpecs": [ { object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.evaluations#DataStoreSpec`) } ], "filter": string } ``` |

| Fields ||
|---|---|
| `dataStoreSpecs[]` | ``object (`https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.evaluations#DataStoreSpec`)`` Optional. Specs defining `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.dataStores#DataStore`s to filter on in a search call and configurations for those data stores. This is only considered for `https://docs.cloud.google.com/gemini/enterprise/docs/reference/rest/v1beta/projects.locations.collections.engines#Engine`s with multiple data stores. |
| `filter` | `string` Optional. The filter syntax consists of an expression language for constructing a predicate from one or more fields of the documents being filtered. Filter expression is case-sensitive. If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. Filtering in Vertex AI Search is done by mapping the LHS filter key to a key property defined in the Vertex AI Search backend -- this mapping is defined by the customer in their schema. For example a media customer might have a field 'name' in their schema. In this case the filter would look like this: filter --\> name:'ANY("king kong")' For more information about filtering including syntax and filter operators, see [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata) |

## WebGroundingSpec

This type has no fields.
Specification of the web grounding tool.

## ImageGenerationSpec

This type has no fields.
Specification of the image generation tool.

## VideoGenerationSpec

This type has no fields.
Specification of the video generation tool.

## GenerationSpec

Assistant generation specification for the request. This allows to override the default generation configuration at the engine level.

| JSON representation |
|---|
| ``` { "modelId": string } ``` |

| Fields ||
|---|---|
| `modelId` | `string` Optional. The Vertex AI modelId used for the generative model. If not set, the default Assistant model will be used. |

## SessionInfo

Information about the session.

| JSON representation |
|---|
| ``` { "session": string } ``` |

| Fields ||
|---|---|
| `session` | `string` Name of the newly generated or continued session. Format: `projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}`. |

## InvokedSkill

Represents a skill used during the assist call.

| JSON representation |
|---|
| ``` { "name": string, "displayName": string } ``` |

| Fields ||
|---|---|
| `name` | `string` The resource name of the skill. |
| `displayName` | `string` The display name of the skill. |

## ConnectorAuthError

Describes an authentication error for a specific data connector.

| JSON representation |
|---|
| ``` { "dataConnector": string, "errorMessage": string } ``` |

| Fields ||
|---|---|
| `dataConnector` | `string` Resource name of the data connector that failed authentication. |
| `errorMessage` | `string` Human-readable error message describing the auth failure. |