# 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, 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).
      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.
            "transferToAgent": True or False, # Deprecated. 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 base structured datatype containing multi-part content of a message. A `Content` includes a `role` field designating the producer of the `Content` and a `parts` field containing multi-part data that contains the content of the message turn. # Optional. Content of the event provided by the author.
            "parts": [ # Required. Ordered `Parts` that constitute a single message. Parts may have different IANA MIME types.
              { # 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`. A `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. 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 meant 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. # Optional. 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.
                },
                "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 [FunctionCall] returned from the model that contains a string representing the [FunctionDeclaration.name] with the parameters and their values.
                  "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", # Required. 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 output of a [FunctionCall] that contains a string representing the [FunctionDeclaration.name] and a structured JSON object containing any output from the function call. It is used as context to the model.
                  "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].
                  "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": { # Content blob. # Optional. Inlined bytes data.
                  "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.
                },
                "text": "A String", # Optional. Text part (can be code).
                "thought": True or False, # Optional. Indicates if the part is thought from the model.
                "thoughtSignature": "A String", # Optional. An opaque signature for the thought so it can be reused in subsequent requests.
                "videoMetadata": { # Metadata describes the input video content. # 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 will be 1.0. The fps 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'. Useful to set for multi-turn conversations, otherwise can be left blank or unset.
          },
          "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": { # Metadata returned to client when grounding is enabled. # Optional. Metadata returned to client when grounding is enabled.
              "googleMapsWidgetContextToken": "A String", # Optional. Output only. Resource name of the Google Maps widget context token to be used with the PlacesContextElement widget to render contextual data. This is populated only for Google Maps grounding.
              "groundingChunks": [ # List of supporting references retrieved from specified grounding source.
                { # Grounding chunk.
                  "maps": { # Chunk from Google Maps. # Grounding chunk from Google Maps.
                    "placeAnswerSources": { # Sources used to generate the place answer. # Sources 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.
                      "flagContentUri": "A String", # A link where users can flag a problem with the generated answer.
                      "reviewSnippets": [ # Snippets of reviews that are used to generate the answer.
                        { # Encapsulates a review snippet.
                          "authorAttribution": { # Author attribution for a photo or review. # This review's author.
                            "displayName": "A String", # Name of the author of the Photo or Review.
                            "photoUri": "A String", # Profile photo URI of the author of the Photo or Review.
                            "uri": "A String", # URI of the author of the Photo or Review.
                          },
                          "flagContentUri": "A String", # A link where users can flag a problem with the review.
                          "googleMapsUri": "A String", # A link to show the review on Google Maps.
                          "relativePublishTimeDescription": "A String", # A string of formatted recent time, expressing the review time relative to the current time in a form appropriate for the language and country.
                          "review": "A String", # A reference representing this place review which may be used to look up this place review again.
                        },
                      ],
                    },
                    "placeId": "A String", # This Place's resource name, in `places/{place_id}` format. Can be used to look up the Place.
                    "text": "A String", # Text of the chunk.
                    "title": "A String", # Title of the chunk.
                    "uri": "A String", # URI reference of the chunk.
                  },
                  "retrievedContext": { # Chunk from context retrieved by the retrieval tools. # Grounding chunk from context retrieved by the retrieval tools.
                    "documentName": "A String", # Output only. The full document name for the referenced Vertex AI Search document.
                    "ragChunk": { # A RagChunk includes the content of a chunk of a RagFile, and associated metadata. # Additional context for the RAG retrieval result. This is only populated when using the RAG retrieval tool.
                      "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", # Text of the attribution.
                    "title": "A String", # Title of the attribution.
                    "uri": "A String", # URI reference of the attribution.
                  },
                  "web": { # Chunk from the web. # Grounding chunk from the web.
                    "domain": "A String", # Domain of the (original) URI.
                    "title": "A String", # Title of the chunk.
                    "uri": "A String", # URI reference of the chunk.
                  },
                },
              ],
              "groundingSupports": [ # Optional. List of grounding support.
                { # Grounding support.
                  "confidenceScores": [ # Confidence score of the support references. Ranges from 0 to 1. 1 is the most confident. For Gemini 2.0 and before, this list must have the same size as the grounding_chunk_indices. For Gemini 2.5 and after, this list will be empty and should be ignored.
                    3.14,
                  ],
                  "groundingChunkIndices": [ # A list of indices (into 'grounding_chunk') specifying the citations associated with the claim. For instance [1,3,4] means that grounding_chunk[1], grounding_chunk[3], grounding_chunk[4] are the retrieved content attributed to the claim.
                    42,
                  ],
                  "segment": { # Segment of the content. # Segment of the content this support belongs to.
                    "endIndex": 42, # Output only. End index in the given Part, measured in bytes. Offset from the start of the Part, exclusive, starting at zero.
                    "partIndex": 42, # Output only. The index of a Part object within its parent Content object.
                    "startIndex": 42, # Output only. Start index in the given Part, measured in bytes. Offset from the start of the Part, inclusive, starting at zero.
                    "text": "A String", # Output only. The text corresponding to the segment from the response.
                  },
                },
              ],
              "retrievalMetadata": { # Metadata related to retrieval in the grounding flow. # Optional. Output only. Retrieval metadata.
                "googleSearchDynamicRetrievalScore": 3.14, # Optional. Score indicating how likely information from Google Search could help answer the prompt. The score is in the range `[0, 1]`, where 0 is the least likely and 1 is the most likely. This score is only populated when Google Search grounding and dynamic retrieval is enabled. It will be compared to the threshold to determine whether to trigger Google Search.
              },
              "retrievalQueries": [ # Optional. Queries executed by the retrieval tools.
                "A String",
              ],
              "searchEntryPoint": { # Google search entry point. # Optional. Google search entry for the following-up web searches.
                "renderedContent": "A String", # Optional. Web content snippet that can be embedded in a web page or an app webview.
                "sdkBlob": "A String", # Optional. Base64 encoded JSON representing array of tuple.
              },
              "webSearchQueries": [ # Optional. Web search queries for the following-up web 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.