Gemini Enterprise for Customer Experience API . projects . locations . apps . assistantSessions

Instance Methods

cancelAssistantTurn(name, body=None, x__xgafv=None)

Cancels the assistant session's in-flight turn, if any: the explicit user stop for a turn running detached from any stream. A cancel landing on a task that does not host the turn preempts it through the session turn epoch instead, ending it within one lease renewal.

close()

Close httplib2 connections.

create(parent, body=None, x__xgafv=None)

Creates a new assistant session in the given app.

delete(name, x__xgafv=None)

Deletes the specified assistant session.

get(name, x__xgafv=None)

Gets details of the specified assistant session.

list(parent, filter=None, pageSize=None, pageToken=None, x__xgafv=None)

Lists all assistant sessions in the given app.

list_next(previous_request, previous_response)

Retrieves the next page of results.

streamChatAiAssistant(name, body=None, x__xgafv=None)

Runs the Chat AI assistant agent for the specified assistant session in a streaming fashion.

Method Details

cancelAssistantTurn(name, body=None, x__xgafv=None)
Cancels the assistant session's in-flight turn, if any: the explicit user stop for a turn running detached from any stream. A cancel landing on a task that does not host the turn preempts it through the session turn epoch instead, ending it within one lease renewal.

Args:
  name: string, Required. The assistant session whose in-flight turn to cancel. (required)
  body: object, The request body.
    The object takes the form of:

{ # Request to cancel an assistant session's in-flight turn.
  "turnId": "A String", # Optional. The turn to cancel; empty cancels whichever turn is running. A cancel naming a turn that is no longer the running one is a no-op.
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response for CancelAssistantTurn.
  "cancelled": True or False, # Whether an in-flight turn was found and asked to stop (directly on this task, or through an epoch preemption for a turn hosted elsewhere).
}
close()
Close httplib2 connections.
create(parent, body=None, x__xgafv=None)
Creates a new assistant session in the given app.

Args:
  parent: string, Required. The app to create the assistant session in Format: `projects/{project}/locations/{location}/apps/{app}` (required)
  body: object, The request body.
    The object takes the form of:

{ # Request message for AssistantService.CreateAssistantSession.
  "assistantSessionId": "A String", # Optional. The ID to use for the assistant session, which will become the final component of the assistant session's resource name. If not provided, a unique ID will be automatically assigned for the assistant session.
  "assistantSessionMessages": [ # Optional. The messages to seed the assistant session with.
    { # A message in an assistant session.
      "attachedGcsUris": [ # Optional. Cloud Storage URIs for files uploaded by the user during this turn. This allows attachments to be persisted and rendered in the session history UI. Example: "gs://cxas-transient-uploads/uuid/prd.pdf"
        "A String",
      ],
      "chunks": [ # Optional. Content of the message as chunks.
        { # A chunk of data in an assistant message.
          "createTime": "A String", # Optional. Timestamp when the chunk was created or emitted.
          "payload": { # Optional. Payload which contains structured responses like the quality report, agent version name, suggested responses etc.
            "a_key": "", # Properties of the object.
          },
          "text": "A String", # Optional. Text data.
          "thought": "A String", # Optional. Thought generated by the model.
          "typedPayload": { # Payload with a type. # Optional. Typed payload which contains structured responses.
            "displayName": "A String", # Required. The display name of the payload.
            "metadata": { # Optional. The metadata of the payload.
              "a_key": "", # Properties of the object.
            },
            "type": "A String", # Required. The type of the payload.
            "value": { # Required. The value of the payload.
              "a_key": "", # Properties of the object.
            },
          },
        },
      ],
      "eventTime": "A String", # Required. Timestamp when the message was sent or received.
      "role": "A String", # Required. Role within the conversation "user" or "model".
    },
  ],
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # An assistant session represents a conversation between a user and the assistant agent.
  "activeTurn": { # Live-attachment info for a session turn that is currently running, disconnected from its client, or parked for pickup by another server task. # Output only. Attachment info for this session's currently running turn. Unset when no turn is running.
    "lastProgressTime": "A String", # Output only. When the turn last persisted progress.
    "orphanDeadlineTime": "A String", # Output only. When the turn will be wound down if no client attaches.
    "startTime": "A String", # Output only. When the turn started.
    "status": "A String", # Current attachment status.
    "turnId": "A String", # Identifies the turn; echoed by resume snapshots on the streaming API.
  },
  "artifacts": [ # Output only. Document artifacts (e.g. generated TDDs in markdown) produced by the assistant in this session. Pointers only; the file content lives in the customer's Cloud Storage bucket.
    { # A document artifact generated by the assistant within a session, stored as a file in the customer's Cloud Storage bucket.
      "createTime": "A String", # Output only. When the artifact was persisted.
      "displayName": "A String", # Output only. The file name shown to the user, e.g. "hotel_booking_tdd.md".
      "gcsUri": "A String", # Output only. The Cloud Storage object holding the artifact content. Example: "gs://{project}-agent-assist-artifacts/agent-assist-generated/1_tdd.md"
      "id": "A String", # Output only. The unique identifier of the artifact within the session.
      "mimeType": "A String", # Output only. The IANA media type of the artifact content, e.g. "text/markdown".
      "turnIndex": 42, # Output only. Index of the message in [AssistantSession.messages] whose turn produced the artifact, for placing the artifact chip when history is restored.
    },
  ],
  "createTime": "A String", # Output only. The time the assistant session was created.
  "displayName": "A String", # Optional. The display name of the assistant session.
  "messages": [ # Optional. History of messages in the session.
    { # A message in an assistant session.
      "attachedGcsUris": [ # Optional. Cloud Storage URIs for files uploaded by the user during this turn. This allows attachments to be persisted and rendered in the session history UI. Example: "gs://cxas-transient-uploads/uuid/prd.pdf"
        "A String",
      ],
      "chunks": [ # Optional. Content of the message as chunks.
        { # A chunk of data in an assistant message.
          "createTime": "A String", # Optional. Timestamp when the chunk was created or emitted.
          "payload": { # Optional. Payload which contains structured responses like the quality report, agent version name, suggested responses etc.
            "a_key": "", # Properties of the object.
          },
          "text": "A String", # Optional. Text data.
          "thought": "A String", # Optional. Thought generated by the model.
          "typedPayload": { # Payload with a type. # Optional. Typed payload which contains structured responses.
            "displayName": "A String", # Required. The display name of the payload.
            "metadata": { # Optional. The metadata of the payload.
              "a_key": "", # Properties of the object.
            },
            "type": "A String", # Required. The type of the payload.
            "value": { # Required. The value of the payload.
              "a_key": "", # Properties of the object.
            },
          },
        },
      ],
      "eventTime": "A String", # Required. Timestamp when the message was sent or received.
      "role": "A String", # Required. Role within the conversation "user" or "model".
    },
  ],
  "name": "A String", # Required. Identifier. The unique identifier of the session. Format: `projects/{project}/locations/{location}/apps/{app}/assistantSessions/{session}`
  "requestor": "A String", # Output only. The user who initiated the session.
  "sessionCheckpoint": { # Session checkpoint containing inferred user intent for session title and UI. # Output only. Session checkpoint containing user intent and rolling history summary.
    "userIntent": "A String", # Inferred user goal or topic for the session (e.g. "Building E-Commerce Support Agent").
  },
  "state": "A String", # Output only. The status of the assistant session.
  "updateTime": "A String", # Output only. The time the assistant session was last updated.
  "userResponseSuggestions": { # Suggested user responses from the assistant agent. # Output only. Suggested user responses from the assistant agent.
    "suggestions": [ # Required. The assistant suggested user responses. These are suggestions for the user on how to interact with the assistant.
      "A String",
    ],
  },
}
delete(name, x__xgafv=None)
Deletes the specified assistant session.

Args:
  name: string, Required. The name of the assistant session to delete. Format: `projects/{project}/locations/{location}/apps/{app}/assistantSessions/{assistant_session}` (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }
}
get(name, x__xgafv=None)
Gets details of the specified assistant session.

Args:
  name: string, Required. The name of the assistant session to retrieve. Format: `projects/{project}/locations/{location}/apps/{app}/assistantSessions/{assistant_session}` (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # An assistant session represents a conversation between a user and the assistant agent.
  "activeTurn": { # Live-attachment info for a session turn that is currently running, disconnected from its client, or parked for pickup by another server task. # Output only. Attachment info for this session's currently running turn. Unset when no turn is running.
    "lastProgressTime": "A String", # Output only. When the turn last persisted progress.
    "orphanDeadlineTime": "A String", # Output only. When the turn will be wound down if no client attaches.
    "startTime": "A String", # Output only. When the turn started.
    "status": "A String", # Current attachment status.
    "turnId": "A String", # Identifies the turn; echoed by resume snapshots on the streaming API.
  },
  "artifacts": [ # Output only. Document artifacts (e.g. generated TDDs in markdown) produced by the assistant in this session. Pointers only; the file content lives in the customer's Cloud Storage bucket.
    { # A document artifact generated by the assistant within a session, stored as a file in the customer's Cloud Storage bucket.
      "createTime": "A String", # Output only. When the artifact was persisted.
      "displayName": "A String", # Output only. The file name shown to the user, e.g. "hotel_booking_tdd.md".
      "gcsUri": "A String", # Output only. The Cloud Storage object holding the artifact content. Example: "gs://{project}-agent-assist-artifacts/agent-assist-generated/1_tdd.md"
      "id": "A String", # Output only. The unique identifier of the artifact within the session.
      "mimeType": "A String", # Output only. The IANA media type of the artifact content, e.g. "text/markdown".
      "turnIndex": 42, # Output only. Index of the message in [AssistantSession.messages] whose turn produced the artifact, for placing the artifact chip when history is restored.
    },
  ],
  "createTime": "A String", # Output only. The time the assistant session was created.
  "displayName": "A String", # Optional. The display name of the assistant session.
  "messages": [ # Optional. History of messages in the session.
    { # A message in an assistant session.
      "attachedGcsUris": [ # Optional. Cloud Storage URIs for files uploaded by the user during this turn. This allows attachments to be persisted and rendered in the session history UI. Example: "gs://cxas-transient-uploads/uuid/prd.pdf"
        "A String",
      ],
      "chunks": [ # Optional. Content of the message as chunks.
        { # A chunk of data in an assistant message.
          "createTime": "A String", # Optional. Timestamp when the chunk was created or emitted.
          "payload": { # Optional. Payload which contains structured responses like the quality report, agent version name, suggested responses etc.
            "a_key": "", # Properties of the object.
          },
          "text": "A String", # Optional. Text data.
          "thought": "A String", # Optional. Thought generated by the model.
          "typedPayload": { # Payload with a type. # Optional. Typed payload which contains structured responses.
            "displayName": "A String", # Required. The display name of the payload.
            "metadata": { # Optional. The metadata of the payload.
              "a_key": "", # Properties of the object.
            },
            "type": "A String", # Required. The type of the payload.
            "value": { # Required. The value of the payload.
              "a_key": "", # Properties of the object.
            },
          },
        },
      ],
      "eventTime": "A String", # Required. Timestamp when the message was sent or received.
      "role": "A String", # Required. Role within the conversation "user" or "model".
    },
  ],
  "name": "A String", # Required. Identifier. The unique identifier of the session. Format: `projects/{project}/locations/{location}/apps/{app}/assistantSessions/{session}`
  "requestor": "A String", # Output only. The user who initiated the session.
  "sessionCheckpoint": { # Session checkpoint containing inferred user intent for session title and UI. # Output only. Session checkpoint containing user intent and rolling history summary.
    "userIntent": "A String", # Inferred user goal or topic for the session (e.g. "Building E-Commerce Support Agent").
  },
  "state": "A String", # Output only. The status of the assistant session.
  "updateTime": "A String", # Output only. The time the assistant session was last updated.
  "userResponseSuggestions": { # Suggested user responses from the assistant agent. # Output only. Suggested user responses from the assistant agent.
    "suggestions": [ # Required. The assistant suggested user responses. These are suggestions for the user on how to interact with the assistant.
      "A String",
    ],
  },
}
list(parent, filter=None, pageSize=None, pageToken=None, x__xgafv=None)
Lists all assistant sessions in the given app.

Args:
  parent: string, Required. The app to list assistant sessions from. Format: `projects/{project}/locations/{location}/apps/{app}` (required)
  filter: string, Optional. Filter to be applied when listing the assistant sessions. See https://google.aip.dev/160 for more details.
  pageSize: integer, Optional. Requested page size. Server may return fewer items than requested. If unspecified, server will pick an appropriate default.
  pageToken: string, Optional. The next_page_token value returned from a previous list AssistantService.ListAssistantSessions call.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response message for AssistantService.ListAssistantSessions.
  "assistantSessions": [ # The list of assistant sessions.
    { # An assistant session represents a conversation between a user and the assistant agent.
      "activeTurn": { # Live-attachment info for a session turn that is currently running, disconnected from its client, or parked for pickup by another server task. # Output only. Attachment info for this session's currently running turn. Unset when no turn is running.
        "lastProgressTime": "A String", # Output only. When the turn last persisted progress.
        "orphanDeadlineTime": "A String", # Output only. When the turn will be wound down if no client attaches.
        "startTime": "A String", # Output only. When the turn started.
        "status": "A String", # Current attachment status.
        "turnId": "A String", # Identifies the turn; echoed by resume snapshots on the streaming API.
      },
      "artifacts": [ # Output only. Document artifacts (e.g. generated TDDs in markdown) produced by the assistant in this session. Pointers only; the file content lives in the customer's Cloud Storage bucket.
        { # A document artifact generated by the assistant within a session, stored as a file in the customer's Cloud Storage bucket.
          "createTime": "A String", # Output only. When the artifact was persisted.
          "displayName": "A String", # Output only. The file name shown to the user, e.g. "hotel_booking_tdd.md".
          "gcsUri": "A String", # Output only. The Cloud Storage object holding the artifact content. Example: "gs://{project}-agent-assist-artifacts/agent-assist-generated/1_tdd.md"
          "id": "A String", # Output only. The unique identifier of the artifact within the session.
          "mimeType": "A String", # Output only. The IANA media type of the artifact content, e.g. "text/markdown".
          "turnIndex": 42, # Output only. Index of the message in [AssistantSession.messages] whose turn produced the artifact, for placing the artifact chip when history is restored.
        },
      ],
      "createTime": "A String", # Output only. The time the assistant session was created.
      "displayName": "A String", # Optional. The display name of the assistant session.
      "messages": [ # Optional. History of messages in the session.
        { # A message in an assistant session.
          "attachedGcsUris": [ # Optional. Cloud Storage URIs for files uploaded by the user during this turn. This allows attachments to be persisted and rendered in the session history UI. Example: "gs://cxas-transient-uploads/uuid/prd.pdf"
            "A String",
          ],
          "chunks": [ # Optional. Content of the message as chunks.
            { # A chunk of data in an assistant message.
              "createTime": "A String", # Optional. Timestamp when the chunk was created or emitted.
              "payload": { # Optional. Payload which contains structured responses like the quality report, agent version name, suggested responses etc.
                "a_key": "", # Properties of the object.
              },
              "text": "A String", # Optional. Text data.
              "thought": "A String", # Optional. Thought generated by the model.
              "typedPayload": { # Payload with a type. # Optional. Typed payload which contains structured responses.
                "displayName": "A String", # Required. The display name of the payload.
                "metadata": { # Optional. The metadata of the payload.
                  "a_key": "", # Properties of the object.
                },
                "type": "A String", # Required. The type of the payload.
                "value": { # Required. The value of the payload.
                  "a_key": "", # Properties of the object.
                },
              },
            },
          ],
          "eventTime": "A String", # Required. Timestamp when the message was sent or received.
          "role": "A String", # Required. Role within the conversation "user" or "model".
        },
      ],
      "name": "A String", # Required. Identifier. The unique identifier of the session. Format: `projects/{project}/locations/{location}/apps/{app}/assistantSessions/{session}`
      "requestor": "A String", # Output only. The user who initiated the session.
      "sessionCheckpoint": { # Session checkpoint containing inferred user intent for session title and UI. # Output only. Session checkpoint containing user intent and rolling history summary.
        "userIntent": "A String", # Inferred user goal or topic for the session (e.g. "Building E-Commerce Support Agent").
      },
      "state": "A String", # Output only. The status of the assistant session.
      "updateTime": "A String", # Output only. The time the assistant session was last updated.
      "userResponseSuggestions": { # Suggested user responses from the assistant agent. # Output only. Suggested user responses from the assistant agent.
        "suggestions": [ # Required. The assistant suggested user responses. These are suggestions for the user on how to interact with the assistant.
          "A String",
        ],
      },
    },
  ],
  "nextPageToken": "A String", # Optional. A token that can be sent as ListAssistantSessionsRequest.page_token to retrieve the next page. Absence of this field indicates there are no subsequent pages.
}
list_next(previous_request, previous_response)
Retrieves the next page of results.

Args:
  previous_request: The request for the previous page. (required)
  previous_response: The response from the request for the previous page. (required)

Returns:
  A request object that you can call 'execute()' on to request the next
  page. Returns None if there are no more items in the collection.
streamChatAiAssistant(name, body=None, x__xgafv=None)
Runs the Chat AI assistant agent for the specified assistant session in a streaming fashion.

Args:
  name: string, Required. The assistant session to be used to run the assistant. Format: `projects/{project}/locations/{location}/apps/{app}/assistantSessions/{assistant_session}` (required)
  body: object, The request body.
    The object takes the form of:

{ # Request message for SessionService.StreamChatAiAssistant.
  "attachOnly": True or False, # Optional. Optional flag to attach to an existing in-flight turn without submitting a new message.
  "attachedGcsUris": [ # Optional. Cloud Storage URIs for files uploaded by the user during this turn. Example: "gs://cxas-transient-uploads/uuid/prd.pdf"
    "A String",
  ],
  "clientCapabilities": [ # Optional. Response features this client can render. The server only emits events that need a capability (e.g. `confirmation_request`) when the capability is declared, so older clients never receive events they would silently drop.
    "A String",
  ],
  "confirmationResponse": { # The user's answer to an AssistantConfirmationRequest, sent on the next SessionService.StreamChatAiAssistant call to resume the paused agent. # Optional. The user's answer to a pending AssistantConfirmationRequest. When set, the server resumes the paused agent with this answer instead of (or in addition to) starting a new prompt turn.
    "answerText": "A String", # The chosen option's submit_text, or free-form user text. The paused action is cancelled and the text is handed to the agent to act on.
    "confirmationId": "A String", # The AssistantConfirmationRequest.confirmation_id being answered.
    "confirmed": True or False, # Binary answer: true approves the paused action, false declines it.
  },
  "contextToken": "A String", # Optional. Opaque onboarding context token returned by SessionService.GenerateOnboardingSuggestions. When set and still fresh, the server reuses the onboarding snapshot computed for the zero state instead of recomputing it for the first conversation turn.
  "message": "A String", # Optional. The message to send to the assistant agent. May be empty when `confirmation_response` is set (answering a pending confirmation without adding a new message); at least one of the two must be provided.
  "operationCompletedEvent": { # Event sent by the client or background worker to resume an assistant session after an asynchronous Long-Running Operation (LRO) completes. # Optional. Resumes an assistant session paused waiting for a client-managed long-running operation to complete.
    "deduplicationToken": "A String", # Optional deduplication token (e.g. UUID) to prevent duplicate turn execution from concurrent browser tabs.
    "error": { # The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). # Optional canonical error status if the operation failed.
      "code": 42, # The status code, which should be an enum value of google.rpc.Code.
      "details": [ # A list of messages that carry the error details. There is a common set of message types for APIs to use.
        {
          "a_key": "", # Properties of the object. Contains field @type with type URL.
        },
      ],
      "message": "A String", # A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
    },
    "metadata": { # Optional structured result metadata (e.g. pass_rate, total_examples, export_uri).
      "a_key": "", # Properties of the object.
    },
    "operationName": "A String", # The operation resource name (e.g. `operations/{op}`).
    "operationType": "A String", # The operation type or tool name (e.g. "run_evaluation", "copy_app", "export_app").
    "status": "A String", # Status of the operation run (e.g. "SUCCEEDED", "FAILED", "CANCELLED").
    "targetResourceName": "A String", # The primary resource targeted or produced by the operation (e.g. evaluation run ID, app ID, dataset ID).
  },
  "resumeFromSequenceNumber": "A String", # Optional. Optional cursor to resume and replay events from an in-flight or completed turn.
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response message for SessionService.StreamChatAiAssistant.
  "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 GCS URI once the file has been persisted. # Generated-document artifact event (live preview deltas + final GCS pointer).
    "artifactId": "A String", # Identifier of the artifact, stable across all chunks of one artifact within the stream.
    "contentDelta": "A String", # Incremental artifact content. Set on DELTA chunks.
    "displayName": "A String", # The file name shown to the user, e.g. "hotel_booking_tdd.md". Set on STARTED (and repeated on FINALIZED).
    "gcsUri": "A String", # The GCS object the artifact was persisted to. Set on FINALIZED chunks.
    "mimeType": "A String", # The IANA media type of the artifact content, e.g. "text/markdown".
    "state": "A String", # Lifecycle position of this chunk.
  },
  "confirmationRequest": { # 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. # A blocking confirmation the agent paused on. The agent resumes when the answer arrives on a later request's `confirmation_response`. Only sent to clients that declared the CONFIRMATION_CARDS capability on the request.
    "agentName": "A String", # Display label of the agent that raised the confirmation (e.g. `"Contract Architect"`), for the card header.
    "confirmationId": "A String", # Identifier correlating this request with its response. Opaque to clients; must be echoed verbatim on the answering request.
    "context": "A String", # 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.
    "expireTime": "A String", # 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.
    "negativeLabel": "A String", # Label for the declining action of a binary confirmation (e.g. "Not yet"). Unset when `questions` is populated.
    "positiveLabel": "A String", # Label for the approving action of a binary confirmation (e.g. "Publish"). Unset when `questions` is populated.
    "questions": [ # Multi-choice form of the confirmation. When populated, the card renders a selectable option list and the chosen option's submit_text (or free-form user text) is returned as AssistantConfirmationResponse.answer_text.
      { # One question with its options.
        "options": [ # The selectable options, in presentation order.
          { # A single selectable option.
            "details": "A String", # Optional trade-off details shown as secondary text.
            "submitText": "A String", # Optional message text to send when the option is chosen; defaults to `title` when empty.
            "title": "A String", # Short plain-text option title (no markdown, no numbering).
          },
        ],
        "question": "A String", # The question header text.
      },
    ],
    "tool": "A String", # Name of the tool call the agent paused on (e.g. "update_app"), for the card header. Unset for pure questions.
  },
  "eventId": "A String", # Unique identifier for the event.
  "eventTime": "A String", # Timestamp when the event occurred.
  "handoff": { # Emitted before this task stops serving the stream mid-turn (e.g. a server restart). The turn's state is persisted; a reconnect carrying resume_from_sequence_number continues it on another task. # Tells the client to silently reconnect with resume_from_sequence_number: the task serving this stream is going away and the turn will continue elsewhere. Not an error; the stream completes normally after this event.
    "reason": "A String", # Why the stream is handing off.
    "turnId": "A String", # Identifies the turn to resume.
  },
  "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. # Structured clarification options parsed out of the model turn. The console renders these as a selectable option list instead of raw text.
    "questions": [ # The questions asked this turn. More than one entry drives the console's "1 of N" pager.
      { # One question with its options.
        "options": [ # The selectable options, in presentation order.
          { # A single selectable option.
            "details": "A String", # Optional trade-off details shown as secondary text.
            "submitText": "A String", # Optional message text to send when the option is chosen; defaults to `title` when empty.
            "title": "A String", # Short plain-text option title (no markdown, no numbering).
          },
        ],
        "question": "A String", # The question header text.
      },
    ],
  },
  "resumeSnapshot": { # 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. # 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.
    "events": [ # Compacted events reconstructing the turn's visible output, in render order, using the same event shapes as live streaming.
      # Object with schema name: StreamChatAiAssistantResponse
    ],
    "orphanDeadlineTime": "A String", # When the turn will be wound down if no client remains attached.
    "resolvedSequenceNumber": "A String", # The position this snapshot represents. Live events follow with sequence_number strictly greater than this. When lower than the resume_from_sequence_number 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.
    "turnId": "A String", # Identifies the turn being attached to.
  },
  "sequenceNumber": "A String", # Optional. Monotonically increasing sequence number for this session turn.
  "sessionCheckpoint": { # Session checkpoint containing inferred user intent for session title and UI. # Session checkpoint/compaction recap event containing user intent and rolling summary.
    "userIntent": "A String", # Inferred user goal or topic for the session (e.g. "Building E-Commerce Support Agent").
  },
  "status": { # The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). # Simple status update.
    "code": 42, # The status code, which should be an enum value of google.rpc.Code.
    "details": [ # A list of messages that carry the error details. There is a common set of message types for APIs to use.
      {
        "a_key": "", # Properties of the object. Contains field @type with type URL.
      },
    ],
    "message": "A String", # A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
  },
  "textChunk": "A String", # Text Token (for streaming Gemini responses word-by-word).
  "thoughtChunk": "A String", # Thought text chunk (agent's reasoning before generating response).
  "toolCall": { # Request for the client or the agent to execute the specified tool. # Tool call execution event.
    "agentName": "A 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": { # Optional. The input parameters and values for the tool in JSON object format.
      "a_key": "", # Properties of the object.
    },
    "displayName": "A String", # Output only. Display name of the tool.
    "id": "A 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": "A 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.
    "tool": "A String", # Optional. The name of the tool to execute. Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`
    "toolsetTool": { # A tool that is created from a toolset. # Optional. The toolset tool to execute.
      "toolId": "A String", # Optional. The tool ID to filter the tools to retrieve the schema for.
      "toolset": "A String", # Required. The resource name of the Toolset from which this tool is derived. Format: `projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}`
    },
  },
  "toolResponse": { # The execution result of a specific tool from the client or the agent. # Tool call response event.
    "agentName": "A 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": "A String", # Output only. Display name of the tool.
    "id": "A String", # Optional. The matching ID of the tool call the response is for.
    "parentToolCallId": "A 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": { # 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.
      "a_key": "", # Properties of the object.
    },
    "tool": "A String", # Optional. The name of the tool to execute. Format: `projects/{project}/locations/{location}/apps/{app}/tools/{tool}`
    "toolsetTool": { # A tool that is created from a toolset. # Optional. The toolset tool that got executed.
      "toolId": "A String", # Optional. The tool ID to filter the tools to retrieve the schema for.
      "toolset": "A String", # Required. The resource name of the Toolset from which this tool is derived. Format: `projects/{project}/locations/{location}/apps/{app}/toolsets/{toolset}`
    },
  },
  "turnCompleted": { # Terminal event of a turn (see StreamChatAiAssistantResponse.turn_completed). # 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.
    "finalSequenceNumber": "A String", # 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.
    "reason": "A String", # Why the turn ended.
    "turnId": "A String", # Identifier of the turn that ended; matches TurnResumeSnapshot.turn_id and ActiveTurnInfo.turn_id.
  },
  "turnInProgress": True or False, # Optional. Indicates whether the turn is still actively running in the background.
  "turnMetadata": { # Turn-level metadata and intent categorization. # Optional. Turn-level metadata and intent categorization.
    "contractDraftComplete": True or False, # Set on the terminal event of a contract draft whose every placeholder is resolved (contract_progress is 100%), whether or not the draft was published. Clients complete and dismiss the contract progress display on it; publication is reported separately by contract_finalized.
    "contractFinalized": True or False, # 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: contract_progress is authoritative and complete.
    "contractRelated": True or False, # Indicates whether this assistant turn was contract-related (e.g. contract drafting, alignment, extraction, or revision).
    "contractStreamingPhase": "A String", # 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.
  },
  "uiEvent": { # Represents a UI event payload. # Optional. UI event payload.
    "jsonPayload": "A String", # The JSON payload representing the A2UI surface.
    "mimeType": "A String", # The media type (MIME type) indicating the format of the UI event payload (e.g., "application/json+a2ui").
  },
}