# Vertex AI API . projects . locations . reasoningEngines . sessions . events

## Instance Methods

Close httplib2 connections.

Lists Events in a given session.

Retrieves the next page of results.

### Method Details

`close()`

    Close httplib2 connections.

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

    Lists Events in a given session.

    Args:
      parent: string, Required. The resource name of the session to list events from. Format: `projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}` (required)
      filter: string, Optional. The standard list filter. Supported fields: * `timestamp` range (i.e. `timestamp>="2025-01-31T11:30:00-04:00"` where the timestamp is in RFC 3339 format) More detail in [AIP-160](https://google.aip.dev/160).
      orderBy: string, Optional. A comma-separated list of fields to order by, sorted in ascending order. Use "desc" after a field name for descending. Supported fields: * `timestamp` Example: `timestamp desc`.
      pageSize: integer, Optional. The maximum number of events to return. The service may return fewer than this value. If unspecified, at most 100 events will be returned. These events are ordered by timestamp in ascending order.
      pageToken: string, Optional. The next_page_token value returned from a previous list SessionService.ListEvents 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 SessionService.ListEvents.
      "nextPageToken": "A String", # A token, which can be sent as ListEventsRequest.page_token to retrieve the next page. Absence of this field indicates there are no subsequent pages.
      "sessionEvents": [ # A list of events matching the request. Ordered by timestamp in ascending order.
        { # An event represents a message from either the user or agent.
          "actions": { # Actions are parts of events that are executed by the agent. # Optional. Actions executed by the agent.
            "artifactDelta": { # Optional. Indicates that the event is updating an artifact. key is the filename, value is the version.
              "a_key": 42,
            },
            "escalate": True or False, # Optional. The agent is escalating to a higher level agent.
            "requestedAuthConfigs": { # Optional. Will only be set by a tool response indicating tool request euc. Struct key is the function call id since one function call response (from model) could correspond to multiple function calls. Struct value is the required auth config, which can be another struct.
              "a_key": "", # Properties of the object.
            },
            "skipSummarization": True or False, # Optional. If true, it won't call model to summarize function response. Only used for function_response event.
            "stateDelta": { # Optional. Indicates that the event is updating the state with the given delta.
              "a_key": "", # Properties of the object.
            },
            "transferAgent": "A String", # Optional. If set, the event transfers to the specified agent.
          },
          "author": "A String", # Required. The name of the agent that sent the event, or user.
          "content": { # The structured data content of a message. A Content message contains a `role` field, which indicates the producer of the content, and a `parts` field, which contains the multi-part data of the message. # Optional. Content of the event provided by the author.
            "parts": [ # Required. A list of Part objects that make up a single message. Parts of a message can have different MIME types. A Content message must have at least one Part.
              { # A datatype containing media that is part of a multi-part Content message. A `Part` consists of data which has an associated datatype. A `Part` can only contain one of the accepted types in `Part.data`. For media types that are not text, `Part` must have a fixed IANA MIME type identifying the type and subtype of the media if `inline_data` or `file_data` field is filled with raw bytes.
                "codeExecutionResult": { # Result of executing the [ExecutableCode]. Only generated when using the [CodeExecution] tool, and always follows a `part` containing the [ExecutableCode]. # Optional. The result of executing the ExecutableCode.
                  "outcome": "A String", # Required. Outcome of the code execution.
                  "output": "A String", # Optional. Contains stdout when code execution is successful, stderr or other description otherwise.
                },
                "executableCode": { # Code generated by the model that is meant to be executed, and the result returned to the model. Generated when using the [CodeExecution] tool, in which the code will be automatically executed, and a corresponding [CodeExecutionResult] will also be generated. # Optional. Code generated by the model that is intended to be executed.
                  "code": "A String", # Required. The code to be executed.
                  "language": "A String", # Required. Programming language of the `code`.
                },
                "fileData": { # URI-based data. A FileData message contains a URI pointing to data of a specific media type. It is used to represent images, audio, and video stored in Google Cloud Storage. # Optional. The URI-based data of the part. This can be used to include files from Google Cloud Storage.
                  "displayName": "A String", # Optional. The display name of the file. Used to provide a label or filename to distinguish files. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server side tools (`code_execution`, `google_search`, and `url_context`) are enabled.
                  "fileUri": "A String", # Required. The URI of the file in Google Cloud Storage.
                  "mimeType": "A String", # Required. The IANA standard MIME type of the source data.
                },
                "functionCall": { # A predicted [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing the parameters and their values. # Optional. A predicted function call returned from the model. This contains the name of the function to call and the arguments to pass to the function.
                  "args": { # Optional. The function parameters and values in JSON object format. See [FunctionDeclaration.parameters] for parameter details.
                    "a_key": "", # Properties of the object.
                  },
                  "id": "A String", # Optional. The unique id of the function call. If populated, the client to execute the `function_call` and return the response with the matching `id`.
                  "name": "A String", # Optional. The name of the function to call. Matches [FunctionDeclaration.name].
                },
                "functionResponse": { # The result output from a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function is used as context to the model. This should contain the result of a [FunctionCall] made based on model prediction. # Optional. The result of a function call. This is used to provide the model with the result of a function call that it predicted.
                  "id": "A String", # Optional. The id of the function call this response is for. Populated by the client to match the corresponding function call `id`.
                  "name": "A String", # Required. The name of the function to call. Matches [FunctionDeclaration.name] and [FunctionCall.name].
                  "parts": [ # Optional. Ordered `Parts` that constitute a function response. Parts may have different IANA MIME types.
                    { # A datatype containing media that is part of a `FunctionResponse` message. A `FunctionResponsePart` consists of data which has an associated datatype. A `FunctionResponsePart` can only contain one of the accepted types in `FunctionResponsePart.data`. A `FunctionResponsePart` must have a fixed IANA MIME type identifying the type and subtype of the media if the `inline_data` field is filled with raw bytes.
                      "fileData": { # URI based data for function response. # URI based data.
                        "displayName": "A String", # Optional. Display name of the file data. Used to provide a label or filename to distinguish file datas. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled.
                        "fileUri": "A String", # Required. URI.
                        "mimeType": "A String", # Required. The IANA standard MIME type of the source data.
                      },
                      "inlineData": { # Raw media bytes for function response. Text should not be sent as raw bytes, use the 'text' field. # Inline media bytes.
                        "data": "A String", # Required. Raw bytes.
                        "displayName": "A String", # Optional. Display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in PromptMessage for prompt management. It is currently used in the Gemini GenerateContent calls only when server side tools (code_execution, google_search, and url_context) are enabled.
                        "mimeType": "A String", # Required. The IANA standard MIME type of the source data.
                      },
                    },
                  ],
                  "response": { # Required. The function response in JSON object format. Use "output" key to specify function output and "error" key to specify error details (if any). If "output" and "error" keys are not specified, then whole "response" is treated as function output.
                    "a_key": "", # Properties of the object.
                  },
                },
                "inlineData": { # A content blob. A Blob contains data of a specific media type. It is used to represent images, audio, and video. # Optional. The inline data content of the part. This can be used to include images, audio, or video in a request.
                  "data": "A String", # Required. The raw bytes of the data.
                  "displayName": "A String", # Optional. The display name of the blob. Used to provide a label or filename to distinguish blobs. This field is only returned in `PromptMessage` for prompt management. It is used in the Gemini calls only when server-side tools (`code_execution`, `google_search`, and `url_context`) are enabled.
                  "mimeType": "A String", # Required. The IANA standard MIME type of the source data.
                },
                "text": "A String", # Optional. The text content of the part.
                "thought": True or False, # Optional. Indicates whether the `part` represents the model's thought process or reasoning.
                "thoughtSignature": "A String", # Optional. An opaque signature for the thought so it can be reused in subsequent requests.
                "videoMetadata": { # Provides metadata for a video, including the start and end offsets for clipping and the frame rate. # Optional. Video metadata. The metadata should only be specified while the video data is presented in inline_data or file_data.
                  "endOffset": "A String", # Optional. The end offset of the video.
                  "fps": 3.14, # Optional. The frame rate of the video sent to the model. If not specified, the default value is 1.0. The valid range is (0.0, 24.0].
                  "startOffset": "A String", # Optional. The start offset of the video.
                },
              },
            ],
            "role": "A String", # Optional. The producer of the content. Must be either 'user' or 'model'. If not set, the service will default to 'user'.
          },
          "errorCode": "A String", # Optional. Error code if the response is an error. Code varies by model.
          "errorMessage": "A String", # Optional. Error message if the response is an error.
          "eventMetadata": { # Metadata relating to a LLM response event. # Optional. Metadata relating to this event.
            "branch": "A String", # Optional. The branch of the event. The format is like agent_1.agent_2.agent_3, where agent_1 is the parent of agent_2, and agent_2 is the parent of agent_3. Branch is used when multiple child agents shouldn't see their siblings' conversation history.
            "customMetadata": { # The custom metadata of the LlmResponse.
              "a_key": "", # Properties of the object.
            },
            "groundingMetadata": { # Information about the sources that support the content of a response. When grounding is enabled, the model returns citations for claims in the response. This object contains the retrieved sources. # Optional. Metadata returned to client when grounding is enabled.
              "googleMapsWidgetContextToken": "A String", # Optional. Output only. A token that can be used to render a Google Maps widget with the contextual data. This field is populated only when the grounding source is Google Maps.
              "groundingChunks": [ # A list of supporting references retrieved from the grounding source. This field is populated when the grounding source is Google Search, Vertex AI Search, or Google Maps.
                { # A piece of evidence that supports a claim made by the model. This is used to show a citation for a claim made by the model. When grounding is enabled, the model returns a `GroundingChunk` that contains a reference to the source of the information.
                  "maps": { # A `Maps` chunk is a piece of evidence that comes from Google Maps. It contains information about a place, such as its name, address, and reviews. This is used to provide the user with rich, location-based information. # A grounding chunk from Google Maps. See the `Maps` message for details.
                    "placeAnswerSources": { # The sources that were used to generate the place answer. This includes review snippets and photos that were used to generate the answer, as well as URIs to flag content. # The sources that were used to generate the place answer. This includes review snippets and photos that were used to generate the answer, as well as URIs to flag content.
                      "reviewSnippets": [ # Snippets of reviews that were used to generate the answer.
                        { # A review snippet that is used to generate the answer.
                          "googleMapsUri": "A String", # A link to show the review on Google Maps.
                          "reviewId": "A String", # The ID of the review that is being referenced.
                          "title": "A String", # The title of the review.
                        },
                      ],
                    },
                    "placeId": "A String", # This Place's resource name, in `places/{place_id}` format. This can be used to look up the place in the Google Maps API.
                    "text": "A String", # The text of the place answer.
                    "title": "A String", # The title of the place.
                    "uri": "A String", # The URI of the place.
                  },
                  "retrievedContext": { # Context retrieved from a data source to ground the model's response. This is used when a retrieval tool fetches information from a user-provided corpus or a public dataset. # A grounding chunk from a data source retrieved by a retrieval tool, such as Vertex AI Search. See the `RetrievedContext` message for details
                    "documentName": "A String", # Output only. The full resource name of the referenced Vertex AI Search document. This is used to identify the specific document that was retrieved. The format is `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}`.
                    "ragChunk": { # A RagChunk includes the content of a chunk of a RagFile, and associated metadata. # Additional context for a Retrieval-Augmented Generation (RAG) retrieval result. This is populated only when the RAG retrieval tool is used.
                      "pageSpan": { # Represents where the chunk starts and ends in the document. # If populated, represents where the chunk starts and ends in the document.
                        "firstPage": 42, # Page where chunk starts in the document. Inclusive. 1-indexed.
                        "lastPage": 42, # Page where chunk ends in the document. Inclusive. 1-indexed.
                      },
                      "text": "A String", # The content of the chunk.
                    },
                    "text": "A String", # The content of the retrieved data source.
                    "title": "A String", # The title of the retrieved data source.
                    "uri": "A String", # The URI of the retrieved data source.
                  },
                  "web": { # A `Web` chunk is a piece of evidence that comes from a web page. It contains the URI of the web page, the title of the page, and the domain of the page. This is used to provide the user with a link to the source of the information. # A grounding chunk from a web page, typically from Google Search. See the `Web` message for details.
                    "domain": "A String", # The domain of the web page that contains the evidence. This can be used to filter out low-quality sources.
                    "title": "A String", # The title of the web page that contains the evidence.
                    "uri": "A String", # The URI of the web page that contains the evidence.
                  },
                },
              ],
              "groundingSupports": [ # Optional. A list of grounding supports that connect the generated content to the grounding chunks. This field is populated when the grounding source is Google Search or Vertex AI Search.
                { # A collection of supporting references for a segment of the model's response.
                  "confidenceScores": [ # The confidence scores for the support references. This list is parallel to the `grounding_chunk_indices` list. A score is a value between 0.0 and 1.0, with a higher score indicating a higher confidence that the reference supports the claim. For Gemini 2.0 and before, this list has the same size as `grounding_chunk_indices`. For Gemini 2.5 and later, this list is empty and should be ignored.
                    3.14,
                  ],
                  "groundingChunkIndices": [ # A list of indices into the `grounding_chunks` field of the `GroundingMetadata` message. These indices specify which grounding chunks support the claim made in the content segment. For example, if this field has the values `[1, 3]`, it means that `grounding_chunks[1]` and `grounding_chunks[3]` are the sources for the claim in the content segment.
                    42,
                  ],
                  "segment": { # A segment of the content. # The content segment that this support message applies to.
                    "endIndex": 42, # Output only. The end index of the segment in the `Part`, measured in bytes. This marks the end of the segment and is exclusive, meaning the segment includes content up to, but not including, the byte at this index.
                    "partIndex": 42, # Output only. The index of the `Part` object that this segment belongs to. This is useful for associating the segment with a specific part of the content.
                    "startIndex": 42, # Output only. The start index of the segment in the `Part`, measured in bytes. This marks the beginning of the segment and is inclusive, meaning the byte at this index is the first byte of the segment.
                    "text": "A String", # Output only. The text of the segment.
                  },
                },
              ],
              "retrievalMetadata": { # Metadata related to the retrieval grounding source. This is part of the `GroundingMetadata` returned when grounding is enabled. # Optional. Output only. Metadata related to the retrieval grounding source.
                "googleSearchDynamicRetrievalScore": 3.14, # Optional. A score indicating how likely it is that a Google Search query could help answer the prompt. The score is in the range of `[0, 1]`. A score of 1 means the model is confident that a search will be helpful, and 0 means it is not. This score is populated only when Google Search grounding and dynamic retrieval are enabled. The score is used to determine whether to trigger a search.
              },
              "retrievalQueries": [ # Optional. The queries that were executed by the retrieval tools. This field is populated only when the grounding source is a retrieval tool, such as Vertex AI Search.
                "A String",
              ],
              "searchEntryPoint": { # An entry point for displaying Google Search results. A `SearchEntryPoint` is populated when the grounding source for a model's response is Google Search. It provides information that you can use to display the search results in your application. # Optional. A web search entry point that can be used to display search results. This field is populated only when the grounding source is Google Search.
                "renderedContent": "A String", # Optional. An HTML snippet that can be embedded in a web page or an application's webview. This snippet displays a search result, including the title, URL, and a brief description of the search result.
                "sdkBlob": "A String", # Optional. A base64-encoded JSON object that contains a list of search queries and their corresponding search URLs. This information can be used to build a custom search UI.
              },
              "sourceFlaggingUris": [ # Optional. Output only. A list of URIs that can be used to flag a place or review for inappropriate content. This field is populated only when the grounding source is Google Maps.
                { # A URI that can be used to flag a place or review for inappropriate content. This is populated only when the grounding source is Google Maps.
                  "flagContentUri": "A String", # The URI that can be used to flag the content.
                  "sourceId": "A String", # The ID of the place or review.
                },
              ],
              "webSearchQueries": [ # Optional. The web search queries that were used to generate the content. This field is populated only when the grounding source is Google Search.
                "A String",
              ],
            },
            "interrupted": True or False, # Optional. Flag indicating that LLM was interrupted when generating the content. Usually it's due to user interruption during a bidi streaming.
            "longRunningToolIds": [ # Optional. Set of ids of the long running function calls. Agent client will know from this field about which function call is long running. Only valid for function call event.
              "A String",
            ],
            "partial": True or False, # Optional. Indicates whether the text content is part of a unfinished text stream. Only used for streaming mode and when the content is plain text.
            "turnComplete": True or False, # Optional. Indicates whether the response from the model is complete. Only used for streaming mode.
          },
          "invocationId": "A String", # Required. The invocation id of the event, multiple events can have the same invocation id.
          "name": "A String", # Identifier. The resource name of the event. Format:`projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}/events/{event}`.
          "timestamp": "A String", # Required. Timestamp when the event was created on client side.
        },
      ],
    }

`list_next()`

    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.