- HTTP request
- Path parameters
- Request body
- Response body
- Authorization scopes
- IAM Permissions
- AssistantConfirmationResponse
- StreamChatAiAssistantRequest.ClientCapability
- OperationCompletedEvent
- ArtifactChunk
- ArtifactChunk.State
- OptionQuestionsChunk
- OptionQuestionsChunk.Question
- OptionQuestionsChunk.Option
- AssistantConfirmationRequest
- AssistantConfirmationRequest.Target
- SessionCheckpoint
- TurnResumeSnapshot
- TurnHandoffEvent
- TurnHandoffEvent.Reason
- TurnCompletedEvent
- TurnCompletedEvent.Reason
- UiEvent
- TurnMetadata
- TurnMetadata.ContractStreamingPhase
Runs Arc, the AI assistant, for the specified assistant session in a streaming fashion.
HTTP request
POST https://ces.googleapis.com/v1/{name=projects/*/locations/*/apps/*/assistantSessions/*}:streamChatAiAssistant
The URL uses gRPC Transcoding syntax.
Path parameters
| Parameters | |
|---|---|
name |
Required. The assistant session to be used to run the assistant. Format: |
Request body
The request body contains data with the following structure:
| JSON representation |
|---|
{ "message": string, "attachedGcsUris": [ string ], "contextToken": string, "confirmationResponse": { object ( |
| Fields | |
|---|---|
message |
Optional. The message to send to the assistant agent. May be empty when |
attachedGcsUris[] |
Optional. Cloud Storage URIs for files uploaded by the user during this turn. Example: "gs://cxas-transient-uploads/uuid/prd.pdf" |
contextToken |
Optional. Opaque onboarding context token returned by |
confirmationResponse |
Optional. The user's answer to a pending |
clientCapabilities[] |
Optional. Response features this client can render. The server only emits events that need a capability (e.g. |
operationCompletedEvent |
Optional. Resumes an assistant session paused waiting for a client-managed long-running operation to complete. |
resumeFromSequenceNumber |
Optional. Optional cursor to resume and replay events from an in-flight or completed turn. |
attachOnly |
Optional. Optional flag to attach to an existing in-flight turn without submitting a new message. |
Response body
Response message for SessionService.StreamChatAiAssistant.
If successful, the response body contains data with the following structure:
| JSON representation |
|---|
{ "eventId": string, "eventTime": string, "uiEvent": { object ( |
| Fields | |
|---|---|
eventId |
Unique identifier for the event. |
eventTime |
Timestamp when the event occurred. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
uiEvent |
Optional. UI event payload. |
turnMetadata |
Optional. Turn-level metadata and intent categorization. |
sequenceNumber |
Optional. Monotonically increasing sequence number for this session turn. |
turnInProgress |
Optional. Indicates whether the turn is still actively running in the background. |
| The event payload. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: | |
textChunk |
Text Token (for streaming Gemini responses word-by-word). |
status |
Simple status update. |
thoughtChunk |
Thought text chunk (agent's reasoning before generating response). |
toolCall |
Tool call execution event. |
toolResponse |
Tool call response event. |
artifactChunk |
Generated-document artifact event (live preview deltas + final Cloud Storage pointer). |
optionQuestionsChunk |
Structured clarification options parsed out of the model turn. The console renders these as a selectable option list instead of raw text. |
confirmationRequest |
A blocking confirmation the agent paused on. The agent resumes when the answer arrives on a later request's |
sessionCheckpoint |
Session checkpoint/compaction recap event containing user intent and rolling summary. |
resumeSnapshot |
A compacted replay of an in-flight turn, sent as the first event of every attach or resume before any live event. The client replaces any locally rendered state for this turn with the snapshot's contents. |
handoff |
Tells the client to silently reconnect with resumeFromSequenceNumber: the task serving this stream is going away and the turn will continue elsewhere. Not an error; the stream completes normally after this event. |
turnCompleted |
The turn has ended. Sent as the last event of every turn, on the original stream and on every attached or resumed stream, so clients can end the turn on an explicit signal instead of inferring it from stream closure. |
| End of mutually exclusive fields. | |
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/cloud-platformhttps://www.googleapis.com/auth/ces
For more information, see the Authentication Overview.
IAM Permissions
Requires the following IAM permission on the name resource:
ces.assistantSessions.get
For more information, see the IAM documentation.
AssistantConfirmationResponse
The user's answer to an AssistantConfirmationRequest, sent on the next SessionService.StreamChatAiAssistant call to resume the paused agent.
| JSON representation |
|---|
{ "confirmationId": string, // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "confirmed": boolean, "answerText": string // End of mutually exclusive fields. } |
| Fields | |
|---|---|
confirmationId |
The |
| The user's answer. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: | |
confirmed |
Binary answer: true approves the paused action, false declines it. |
answerText |
The chosen option's submitText, or free-form user text. The paused action is cancelled and the text is handed to the agent to act on. |
| End of mutually exclusive fields. | |
StreamChatAiAssistantRequest.ClientCapability
Response features a client can declare.
| Enums | |
|---|---|
CLIENT_CAPABILITY_UNSPECIFIED |
Unspecified capability; ignored. |
CONFIRMATION_CARDS |
The client renders AssistantConfirmationRequest cards and answers them via confirmationResponse. |
CLIENT_MANAGED_LRO |
The client manages long-running operations out-of-band by polling the operation and sending operationCompletedEvent to resume the turn. If not declared, the server manages LRO polling and completes the turn inline. |
PROJECT_SCOPE |
The client renders project-scope events: typedPayload cards, targetApp on tool calls and responses, targets on confirmation requests and touchedApps on turn completion. |
OperationCompletedEvent
Event sent by the client or background worker to resume an assistant session after an asynchronous Long-Running Operation (LRO) completes.
| JSON representation |
|---|
{
"operationName": string,
"targetResourceName": string,
"operationType": string,
"status": string,
"deduplicationToken": string,
"error": {
object ( |
| Fields | |
|---|---|
operationName |
The operation resource name (e.g. |
targetResourceName |
The primary resource targeted or produced by the operation (e.g. evaluation run ID, app ID, dataset ID). |
operationType |
The operation type or tool name (e.g. "run_evaluation", "copy_app", "export_app"). |
status |
Status of the operation run (e.g. "SUCCEEDED", "FAILED", "CANCELLED"). |
deduplicationToken |
Optional deduplication token (e.g. UUID) to prevent duplicate turn execution from concurrent browser tabs. |
error |
Optional canonical error status if the operation failed. |
metadata |
Optional structured result metadata (e.g. pass_rate, total_examples, export_uri). |
ArtifactChunk
A streamed fragment of a document artifact (e.g. a markdown TDD) that the assistant is generating. Content deltas stream while the document is being written so clients can render a live preview; the FINALIZED chunk carries the Cloud Storage URI once the file has been persisted.
| JSON representation |
|---|
{
"artifactId": string,
"displayName": string,
"mimeType": string,
"contentDelta": string,
"gcsUri": string,
"state": enum ( |
| Fields | |
|---|---|
artifactId |
Identifier of the artifact, stable across all chunks of one artifact within the stream. |
displayName |
The file name shown to the user, e.g. "hotel_booking_tdd.md". Set on STARTED (and repeated on FINALIZED). |
mimeType |
The IANA media type of the artifact content, e.g. "text/markdown". |
contentDelta |
Incremental artifact content. Set on DELTA chunks. |
gcsUri |
The Cloud Storage object the artifact was persisted to. Set on FINALIZED chunks. |
state |
Lifecycle position of this chunk. |
targetApp |
Output only. The app this artifact was produced for, when it was produced for one. Format: |
ArtifactChunk.State
Lifecycle position of this chunk within the artifact's stream.
| Enums | |
|---|---|
STATE_UNSPECIFIED |
Unused default. |
STARTED |
The assistant started generating the artifact. |
DELTA |
A content increment; contentDelta is set. |
FINALIZED |
The artifact was persisted; gcsUri is set. |
FAILED |
Generation or persistence failed; the artifact was not saved. |
CLOSED |
The document finished streaming: its content was fully delivered via contentDelta chunks. Persistence may still follow; a FINALIZED chunk with a gcsUri is sent if and when the artifact is saved. |
OptionQuestionsChunk
Structured clarification options the assistant asks the user to choose among, transduced server-side out of the model's turn (the option block is stripped from the streamed and persisted text). The console renders a keyboard-navigable option list docked above the composer.
| JSON representation |
|---|
{
"questions": [
{
object ( |
| Fields | |
|---|---|
questions[] |
The questions asked this turn. More than one entry drives the console's "1 of N" pager. |
OptionQuestionsChunk.Question
One question with its options.
| JSON representation |
|---|
{
"question": string,
"options": [
{
object ( |
| Fields | |
|---|---|
question |
The question header text. |
options[] |
The selectable options, in presentation order. |
OptionQuestionsChunk.Option
A single selectable option.
| JSON representation |
|---|
{ "title": string, "details": string, "submitText": string } |
| Fields | |
|---|---|
title |
Short plain-text option title (no markdown, no numbering). |
details |
Optional trade-off details shown as secondary text. |
submitText |
Optional message text to send when the option is chosen; defaults to |
AssistantConfirmationRequest
A blocking question or confirmation the assistant needs answered before an agent action can proceed. The requesting agent is paused and resumes only when the answer arrives on a later StreamChatAiAssistantRequest.confirmation_response.
| JSON representation |
|---|
{ "confirmationId": string, "context": string, "positiveLabel": string, "negativeLabel": string, "questions": [ { object ( |
| Fields | |
|---|---|
confirmationId |
Identifier correlating this request with its response. Opaque to clients; must be echoed verbatim on the answering request. |
context |
Context describing what is being confirmed (e.g. the action the agent wants to take, or the question it needs answered). Rendered as plain text, not Markdown. |
positiveLabel |
Label for the approving action of a binary confirmation (e.g. "Publish"). Unset when |
negativeLabel |
Label for the declining action of a binary confirmation (e.g. "Not yet"). Unset when |
questions[] |
Multi-choice form of the confirmation. When populated, the card renders a selectable option list and the chosen option's submitText (or free-form user text) is returned as |
tool |
Name of the tool call the agent paused on (e.g. "update_app"), for the card header. Unset for pure questions. |
agentName |
Display label of the agent that raised the confirmation (e.g. |
expireTime |
Time after which this confirmation can no longer be answered. An expired card renders as inactive, and the server declines the confirmation on the next turn so the paused agent does not wait indefinitely. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
targets[] |
Everything the confirmed action will change, so the console can render "Update 2 apps" and one badge per app. Empty for legacy single-target cards. |
AssistantConfirmationRequest.Target
One resource the confirmed action will change.
| JSON representation |
|---|
{ "resource": string, "displayName": string, "action": string, "targetApp": string } |
| Fields | |
|---|---|
resource |
The resource that will change, as a full resource name. |
displayName |
Display name of the resource or app, for the card. |
action |
The action, e.g. |
targetApp |
The app the resource belongs to, or empty for a location-scoped action such as creating an app. Format: |
SessionCheckpoint
Session checkpoint containing inferred user intent for session title and UI.
| JSON representation |
|---|
{ "userIntent": string } |
| Fields | |
|---|---|
userIntent |
Inferred user goal or topic for the session (e.g. "Building E-Commerce Support Agent"). |
TurnResumeSnapshot
A compacted replay of an in-flight turn: everything needed to render the turn's visible output so far, plus the position live events continue from.
| JSON representation |
|---|
{
"turnId": string,
"resolvedSequenceNumber": string,
"events": [
{
object ( |
| Fields | |
|---|---|
turnId |
Identifies the turn being attached to. |
resolvedSequenceNumber |
The position this snapshot represents. Live events follow with sequenceNumber strictly greater than this. When lower than the resumeFromSequenceNumber the client requested, flushed progress lags what the client already rendered: the client must discard its rendered content of this turn beyond this position before applying the snapshot. |
events[] |
Compacted events reconstructing the turn's visible output, in render order, using the same event shapes as live streaming. |
orphanDeadlineTime |
When the turn will be wound down if no client remains attached. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: |
TurnHandoffEvent
Emitted before this task stops serving the stream mid-turn (e.g. a server restart). The turn's state is persisted; a reconnect carrying resumeFromSequenceNumber continues it on another task.
| JSON representation |
|---|
{
"turnId": string,
"reason": enum ( |
| Fields | |
|---|---|
turnId |
Identifies the turn to resume. |
reason |
Why the stream is handing off. |
TurnHandoffEvent.Reason
Why the stream is handing off.
| Enums | |
|---|---|
REASON_UNSPECIFIED |
Unspecified. |
SERVER_RESTART |
The serving task is shutting down (release push or rescheduling). |
TurnCompletedEvent
Terminal event of a turn (see StreamChatAiAssistantResponse.turn_completed).
| JSON representation |
|---|
{
"turnId": string,
"reason": enum ( |
| Fields | |
|---|---|
turnId |
Identifier of the turn that ended; matches TurnResumeSnapshot.turn_id and ActiveTurnInfo.turn_id. |
reason |
Why the turn ended. |
finalSequenceNumber |
Sequence number of the last event the turn produced. A client whose cursor is lower missed content and should reload the session to see it. |
touchedApps[] |
Apps this turn targeted or changed, so the console can refresh exactly those apps' stores. Project-scoped sessions only. Format: |
TurnCompletedEvent.Reason
Why the turn ended, so a client that attached late can word the outcome instead of guessing from an empty stream.
| Enums | |
|---|---|
REASON_UNSPECIFIED |
Unspecified. |
COMPLETED |
The turn ran to completion; the session holds its committed output. |
ABANDONED |
No task was driving the turn any more; it was sealed to a committed partial and cannot be continued. |
RESUME_UNAVAILABLE |
This server does not serve attach or resume for the session, so nothing was tailed; the client should reload the session instead. |
UiEvent
Represents a UI event payload.
| JSON representation |
|---|
{ "mimeType": string, "jsonPayload": string } |
| Fields | |
|---|---|
mimeType |
The media type (MIME type) indicating the format of the UI event payload (e.g., "application/json+a2ui"). |
jsonPayload |
The JSON payload representing the A2UI surface. |
TurnMetadata
Turn-level metadata and intent categorization.
| JSON representation |
|---|
{
"contractRelated": boolean,
"contractFinalized": boolean,
"contractStreamingPhase": enum ( |
| Fields | |
|---|---|
contractRelated |
Indicates whether this assistant turn was contract-related (e.g. contract drafting, alignment, extraction, or revision). |
contractFinalized |
Set on the final artifact event of a turn whose contract draft was published (a revision was activated). Terminal for the clarification flow of this draft: contractProgress is authoritative and complete. |
contractStreamingPhase |
Set only on in-flight progress estimates emitted while a contract artifact fence is streaming, and on the revision-turn-start event. Unset on authoritative payloads. |
contractDraftComplete |
Set on the terminal event of a contract draft whose every placeholder is resolved (contractProgress is 100%), whether or not the draft was published. Clients complete and dismiss the contract progress display on it; publication is reported separately by contractFinalized. |
TurnMetadata.ContractStreamingPhase
Streaming phase of the contract progress payload.
| Enums | |
|---|---|
CONTRACT_STREAMING_PHASE_UNSPECIFIED |
The payload is authoritative (computed from a complete contract document, a persisted snapshot, or the pre-draft state). Clients must replace any previously received progress with it. |
DRAFTING |
An initial contract draft is streaming. contractProgress is an in-flight estimate: non-decreasing within one artifact fence, capped below the authoritative range, with pillarBreakdowns carrying totalItemCount == 0 to mark estimated pillar states. |
REVISING |
A revision of an existing contract is streaming (for example after an annotation submission). Same estimate semantics as DRAFTING. |