diff --git a/vertexai/_genai/a2a_tasks.py b/vertexai/_genai/a2a_tasks.py new file mode 100644 index 0000000000..7d166e6226 --- /dev/null +++ b/vertexai/_genai/a2a_tasks.py @@ -0,0 +1,535 @@ +# Copyright 2025 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# Code generated by the Google Gen AI SDK generator DO NOT EDIT. + +import json +import logging +from typing import Any, Optional, Union +from urllib.parse import urlencode + +from google.genai import _api_module +from google.genai import _common +from google.genai._common import get_value_by_path as getv +from google.genai._common import set_value_by_path as setv + +from . import types + + +logger = logging.getLogger("vertexai_genai.a2atasks") + + +def _CreateAgentEngineTaskConfig_to_vertex( + from_object: Union[dict[str, Any], object], + parent_object: Optional[dict[str, Any]] = None, +) -> dict[str, Any]: + to_object: dict[str, Any] = {} + + if getv(from_object, ["display_name"]) is not None: + setv(parent_object, ["displayName"], getv(from_object, ["display_name"])) + + if getv(from_object, ["session_state"]) is not None: + setv(parent_object, ["sessionState"], getv(from_object, ["session_state"])) + + if getv(from_object, ["ttl"]) is not None: + setv(parent_object, ["ttl"], getv(from_object, ["ttl"])) + + if getv(from_object, ["expire_time"]) is not None: + setv(parent_object, ["expireTime"], getv(from_object, ["expire_time"])) + + return to_object + + +def _CreateAgentEngineTaskRequestParameters_to_vertex( + from_object: Union[dict[str, Any], object], + parent_object: Optional[dict[str, Any]] = None, +) -> dict[str, Any]: + to_object: dict[str, Any] = {} + if getv(from_object, ["name"]) is not None: + setv(to_object, ["_url", "name"], getv(from_object, ["name"])) + + if getv(from_object, ["user_id"]) is not None: + setv(to_object, ["userId"], getv(from_object, ["user_id"])) + + if getv(from_object, ["config"]) is not None: + setv( + to_object, + ["config"], + _CreateAgentEngineTaskConfig_to_vertex( + getv(from_object, ["config"]), to_object + ), + ) + + return to_object + + +def _GetAgentEngineTaskRequestParameters_to_vertex( + from_object: Union[dict[str, Any], object], + parent_object: Optional[dict[str, Any]] = None, +) -> dict[str, Any]: + to_object: dict[str, Any] = {} + if getv(from_object, ["name"]) is not None: + setv(to_object, ["_url", "name"], getv(from_object, ["name"])) + + if getv(from_object, ["config"]) is not None: + setv(to_object, ["config"], getv(from_object, ["config"])) + + return to_object + + +def _ListReasoningEngineTasksConfig_to_vertex( + from_object: Union[dict[str, Any], object], + parent_object: Optional[dict[str, Any]] = None, +) -> dict[str, Any]: + to_object: dict[str, Any] = {} + + if getv(from_object, ["page_size"]) is not None: + setv(parent_object, ["_query", "pageSize"], getv(from_object, ["page_size"])) + + if getv(from_object, ["page_token"]) is not None: + setv(parent_object, ["_query", "pageToken"], getv(from_object, ["page_token"])) + + if getv(from_object, ["filter"]) is not None: + setv(parent_object, ["_query", "filter"], getv(from_object, ["filter"])) + + return to_object + + +def _ListReasoningEngineTasksRequestParameters_to_vertex( + from_object: Union[dict[str, Any], object], + parent_object: Optional[dict[str, Any]] = None, +) -> dict[str, Any]: + to_object: dict[str, Any] = {} + if getv(from_object, ["name"]) is not None: + setv(to_object, ["_url", "name"], getv(from_object, ["name"])) + + if getv(from_object, ["config"]) is not None: + setv( + to_object, + ["config"], + _ListReasoningEngineTasksConfig_to_vertex( + getv(from_object, ["config"]), to_object + ), + ) + + return to_object + + +class A2aTasks(_api_module.BaseModule): + + def get( + self, + *, + name: str, + config: Optional[types.GetAgentEngineTaskConfigOrDict] = None, + ) -> types.A2aTask: + """ + Gets an agent engine task. + + Args: + name (str): Required. The name of the Agent Engine task to get. Format: + `projects/{project}/locations/{location}/reasoningEngines/{resource_id}/a2aTasks/{task_id}`. + config (GetAgentEngineTaskConfig): + Optional. Additional configurations for getting the Agent Engine task. + + Returns: + AgentEngineTask: The requested Agent Engine task. + + """ + + parameter_model = types._GetAgentEngineTaskRequestParameters( + name=name, + config=config, + ) + + request_url_dict: Optional[dict[str, str]] + if not self._api_client.vertexai: + raise ValueError("This method is only supported in the Vertex AI client.") + else: + request_dict = _GetAgentEngineTaskRequestParameters_to_vertex( + parameter_model + ) + request_url_dict = request_dict.get("_url") + if request_url_dict: + path = "{name}".format_map(request_url_dict) + else: + path = "{name}" + + query_params = request_dict.get("_query") + if query_params: + path = f"{path}?{urlencode(query_params)}" + # TODO: remove the hack that pops config. + request_dict.pop("config", None) + + http_options: Optional[types.HttpOptions] = None + if ( + parameter_model.config is not None + and parameter_model.config.http_options is not None + ): + http_options = parameter_model.config.http_options + + request_dict = _common.convert_to_dict(request_dict) + request_dict = _common.encode_unserializable_types(request_dict) + + response = self._api_client.request("get", path, request_dict, http_options) + + response_dict = {} if not response.body else json.loads(response.body) + + return_value = types.A2aTask._from_response( + response=response_dict, kwargs=parameter_model.model_dump() + ) + + self._api_client._verify_response(return_value) + return return_value + + def _list( + self, + *, + name: str, + config: Optional[types.ListReasoningEngineTasksConfigOrDict] = None, + ) -> types.ListReasoningEngineTasksResponse: + """ + Lists Agent Engine tasks. + + Args: + name (str): Required. The name of the Agent Engine to list tasks for. Format: + `projects/{project}/locations/{location}/reasoningEngines/{resource_id}`. + config (ListAgentEngineTasksConfig): + Optional. Additional configurations for listing the Agent Engine tasks. + + Returns: + ListAgentEngineTasksResponse: The requested Agent Engine tasks. + + """ + + parameter_model = types._ListReasoningEngineTasksRequestParameters( + name=name, + config=config, + ) + + request_url_dict: Optional[dict[str, str]] + if not self._api_client.vertexai: + raise ValueError("This method is only supported in the Vertex AI client.") + else: + request_dict = _ListReasoningEngineTasksRequestParameters_to_vertex( + parameter_model + ) + request_url_dict = request_dict.get("_url") + if request_url_dict: + path = "{name}/a2aTasks".format_map(request_url_dict) + else: + path = "{name}/a2aTasks" + + query_params = request_dict.get("_query") + if query_params: + path = f"{path}?{urlencode(query_params)}" + # TODO: remove the hack that pops config. + request_dict.pop("config", None) + + http_options: Optional[types.HttpOptions] = None + if ( + parameter_model.config is not None + and parameter_model.config.http_options is not None + ): + http_options = parameter_model.config.http_options + + request_dict = _common.convert_to_dict(request_dict) + request_dict = _common.encode_unserializable_types(request_dict) + + response = self._api_client.request("get", path, request_dict, http_options) + + response_dict = {} if not response.body else json.loads(response.body) + + return_value = types.ListReasoningEngineTasksResponse._from_response( + response=response_dict, kwargs=parameter_model.model_dump() + ) + + self._api_client._verify_response(return_value) + return return_value + + def _create( + self, + *, + name: str, + user_id: str, + config: Optional[types.CreateAgentEngineTaskConfigOrDict] = None, + ) -> types.A2aTask: + """ + Creates a new task in the Agent Engine. + + Args: + name (str): Required. The name of the Agent Engine to create the task under. Format: + `projects/{project}/locations/{location}/reasoningEngines/{resource_id}`. + user_id (str): Required. The user ID of the task. + config (CreateAgentEngineTaskConfig): + Optional. Additional configurations for creating the Agent Engine task. + + Returns: + AgentEngineTaskOperation: The operation for creating the Agent Engine task. + + """ + + parameter_model = types._CreateAgentEngineTaskRequestParameters( + name=name, + user_id=user_id, + config=config, + ) + + request_url_dict: Optional[dict[str, str]] + if not self._api_client.vertexai: + raise ValueError("This method is only supported in the Vertex AI client.") + else: + request_dict = _CreateAgentEngineTaskRequestParameters_to_vertex( + parameter_model + ) + request_url_dict = request_dict.get("_url") + if request_url_dict: + path = "{name}/a2aTasks".format_map(request_url_dict) + else: + path = "{name}/a2aTasks" + + query_params = request_dict.get("_query") + if query_params: + path = f"{path}?{urlencode(query_params)}" + # TODO: remove the hack that pops config. + request_dict.pop("config", None) + + http_options: Optional[types.HttpOptions] = None + if ( + parameter_model.config is not None + and parameter_model.config.http_options is not None + ): + http_options = parameter_model.config.http_options + + request_dict = _common.convert_to_dict(request_dict) + request_dict = _common.encode_unserializable_types(request_dict) + + response = self._api_client.request("post", path, request_dict, http_options) + + response_dict = {} if not response.body else json.loads(response.body) + + return_value = types.A2aTask._from_response( + response=response_dict, kwargs=parameter_model.model_dump() + ) + + self._api_client._verify_response(return_value) + return return_value + + +class AsyncA2aTasks(_api_module.BaseModule): + + async def get( + self, + *, + name: str, + config: Optional[types.GetAgentEngineTaskConfigOrDict] = None, + ) -> types.A2aTask: + """ + Gets an agent engine task. + + Args: + name (str): Required. The name of the Agent Engine task to get. Format: + `projects/{project}/locations/{location}/reasoningEngines/{resource_id}/a2aTasks/{task_id}`. + config (GetAgentEngineTaskConfig): + Optional. Additional configurations for getting the Agent Engine task. + + Returns: + AgentEngineTask: The requested Agent Engine task. + + """ + + parameter_model = types._GetAgentEngineTaskRequestParameters( + name=name, + config=config, + ) + + request_url_dict: Optional[dict[str, str]] + if not self._api_client.vertexai: + raise ValueError("This method is only supported in the Vertex AI client.") + else: + request_dict = _GetAgentEngineTaskRequestParameters_to_vertex( + parameter_model + ) + request_url_dict = request_dict.get("_url") + if request_url_dict: + path = "{name}".format_map(request_url_dict) + else: + path = "{name}" + + query_params = request_dict.get("_query") + if query_params: + path = f"{path}?{urlencode(query_params)}" + # TODO: remove the hack that pops config. + request_dict.pop("config", None) + + http_options: Optional[types.HttpOptions] = None + if ( + parameter_model.config is not None + and parameter_model.config.http_options is not None + ): + http_options = parameter_model.config.http_options + + request_dict = _common.convert_to_dict(request_dict) + request_dict = _common.encode_unserializable_types(request_dict) + + response = await self._api_client.async_request( + "get", path, request_dict, http_options + ) + + response_dict = {} if not response.body else json.loads(response.body) + + return_value = types.A2aTask._from_response( + response=response_dict, kwargs=parameter_model.model_dump() + ) + + self._api_client._verify_response(return_value) + return return_value + + async def _list( + self, + *, + name: str, + config: Optional[types.ListReasoningEngineTasksConfigOrDict] = None, + ) -> types.ListReasoningEngineTasksResponse: + """ + Lists Agent Engine tasks. + + Args: + name (str): Required. The name of the Agent Engine to list tasks for. Format: + `projects/{project}/locations/{location}/reasoningEngines/{resource_id}`. + config (ListAgentEngineTasksConfig): + Optional. Additional configurations for listing the Agent Engine tasks. + + Returns: + ListAgentEngineTasksResponse: The requested Agent Engine tasks. + + """ + + parameter_model = types._ListReasoningEngineTasksRequestParameters( + name=name, + config=config, + ) + + request_url_dict: Optional[dict[str, str]] + if not self._api_client.vertexai: + raise ValueError("This method is only supported in the Vertex AI client.") + else: + request_dict = _ListReasoningEngineTasksRequestParameters_to_vertex( + parameter_model + ) + request_url_dict = request_dict.get("_url") + if request_url_dict: + path = "{name}/a2aTasks".format_map(request_url_dict) + else: + path = "{name}/a2aTasks" + + query_params = request_dict.get("_query") + if query_params: + path = f"{path}?{urlencode(query_params)}" + # TODO: remove the hack that pops config. + request_dict.pop("config", None) + + http_options: Optional[types.HttpOptions] = None + if ( + parameter_model.config is not None + and parameter_model.config.http_options is not None + ): + http_options = parameter_model.config.http_options + + request_dict = _common.convert_to_dict(request_dict) + request_dict = _common.encode_unserializable_types(request_dict) + + response = await self._api_client.async_request( + "get", path, request_dict, http_options + ) + + response_dict = {} if not response.body else json.loads(response.body) + + return_value = types.ListReasoningEngineTasksResponse._from_response( + response=response_dict, kwargs=parameter_model.model_dump() + ) + + self._api_client._verify_response(return_value) + return return_value + + async def _create( + self, + *, + name: str, + user_id: str, + config: Optional[types.CreateAgentEngineTaskConfigOrDict] = None, + ) -> types.A2aTask: + """ + Creates a new task in the Agent Engine. + + Args: + name (str): Required. The name of the Agent Engine to create the task under. Format: + `projects/{project}/locations/{location}/reasoningEngines/{resource_id}`. + user_id (str): Required. The user ID of the task. + config (CreateAgentEngineTaskConfig): + Optional. Additional configurations for creating the Agent Engine task. + + Returns: + AgentEngineTaskOperation: The operation for creating the Agent Engine task. + + """ + + parameter_model = types._CreateAgentEngineTaskRequestParameters( + name=name, + user_id=user_id, + config=config, + ) + + request_url_dict: Optional[dict[str, str]] + if not self._api_client.vertexai: + raise ValueError("This method is only supported in the Vertex AI client.") + else: + request_dict = _CreateAgentEngineTaskRequestParameters_to_vertex( + parameter_model + ) + request_url_dict = request_dict.get("_url") + if request_url_dict: + path = "{name}/a2aTasks".format_map(request_url_dict) + else: + path = "{name}/a2aTasks" + + query_params = request_dict.get("_query") + if query_params: + path = f"{path}?{urlencode(query_params)}" + # TODO: remove the hack that pops config. + request_dict.pop("config", None) + + http_options: Optional[types.HttpOptions] = None + if ( + parameter_model.config is not None + and parameter_model.config.http_options is not None + ): + http_options = parameter_model.config.http_options + + request_dict = _common.convert_to_dict(request_dict) + request_dict = _common.encode_unserializable_types(request_dict) + + response = await self._api_client.async_request( + "post", path, request_dict, http_options + ) + + response_dict = {} if not response.body else json.loads(response.body) + + return_value = types.A2aTask._from_response( + response=response_dict, kwargs=parameter_model.model_dump() + ) + + self._api_client._verify_response(return_value) + return return_value diff --git a/vertexai/_genai/types/__init__.py b/vertexai/_genai/types/__init__.py index fa43a483dc..8544c46bee 100644 --- a/vertexai/_genai/types/__init__.py +++ b/vertexai/_genai/types/__init__.py @@ -29,6 +29,7 @@ from .common import _CreateAgentEngineRequestParameters from .common import _CreateAgentEngineSandboxRequestParameters from .common import _CreateAgentEngineSessionRequestParameters +from .common import _CreateAgentEngineTaskRequestParameters from .common import _CreateDatasetParameters from .common import _CreateDatasetVersionParameters from .common import _CreateEvaluationItemParameters @@ -58,6 +59,7 @@ from .common import _GetAgentEngineSandboxRequestParameters from .common import _GetAgentEngineSessionOperationParameters from .common import _GetAgentEngineSessionRequestParameters +from .common import _GetAgentEngineTaskRequestParameters from .common import _GetCustomJobParameters from .common import _GetCustomJobParameters from .common import _GetDatasetOperationParameters @@ -77,6 +79,7 @@ from .common import _ListDatasetsRequestParameters from .common import _ListDatasetVersionsRequestParameters from .common import _ListMultimodalDatasetsRequestParameters +from .common import _ListReasoningEngineTasksRequestParameters from .common import _OptimizeRequestParameters from .common import _OptimizeRequestParameters from .common import _PurgeAgentEngineMemoriesRequestParameters @@ -89,6 +92,9 @@ from .common import _UpdateAgentEngineSessionRequestParameters from .common import _UpdateDatasetParameters from .common import _UpdateMultimodalDatasetParameters +from .common import A2aTask +from .common import A2aTaskDict +from .common import A2aTaskOrDict from .common import AcceleratorType from .common import AgentEngine from .common import AgentEngineConfig @@ -199,6 +205,9 @@ from .common import CreateAgentEngineSessionConfig from .common import CreateAgentEngineSessionConfigDict from .common import CreateAgentEngineSessionConfigOrDict +from .common import CreateAgentEngineTaskConfig +from .common import CreateAgentEngineTaskConfigDict +from .common import CreateAgentEngineTaskConfigOrDict from .common import CreateDatasetConfig from .common import CreateDatasetConfigDict from .common import CreateDatasetConfigOrDict @@ -453,6 +462,9 @@ from .common import GetAgentEngineSessionConfig from .common import GetAgentEngineSessionConfigDict from .common import GetAgentEngineSessionConfigOrDict +from .common import GetAgentEngineTaskConfig +from .common import GetAgentEngineTaskConfigDict +from .common import GetAgentEngineTaskConfigOrDict from .common import GetDatasetOperationConfig from .common import GetDatasetOperationConfigDict from .common import GetDatasetOperationConfigOrDict @@ -529,6 +541,12 @@ from .common import ListReasoningEnginesSessionsResponse from .common import ListReasoningEnginesSessionsResponseDict from .common import ListReasoningEnginesSessionsResponseOrDict +from .common import ListReasoningEngineTasksConfig +from .common import ListReasoningEngineTasksConfigDict +from .common import ListReasoningEngineTasksConfigOrDict +from .common import ListReasoningEngineTasksResponse +from .common import ListReasoningEngineTasksResponseDict +from .common import ListReasoningEngineTasksResponseOrDict from .common import LLMBasedMetricSpec from .common import LLMBasedMetricSpecDict from .common import LLMBasedMetricSpecOrDict @@ -1047,6 +1065,21 @@ from .common import WorkerPoolSpecOrDict __all__ = [ + "GetAgentEngineTaskConfig", + "GetAgentEngineTaskConfigDict", + "GetAgentEngineTaskConfigOrDict", + "A2aTask", + "A2aTaskDict", + "A2aTaskOrDict", + "ListReasoningEngineTasksConfig", + "ListReasoningEngineTasksConfigDict", + "ListReasoningEngineTasksConfigOrDict", + "ListReasoningEngineTasksResponse", + "ListReasoningEngineTasksResponseDict", + "ListReasoningEngineTasksResponseOrDict", + "CreateAgentEngineTaskConfig", + "CreateAgentEngineTaskConfigDict", + "CreateAgentEngineTaskConfigOrDict", "CreateEvaluationItemConfig", "CreateEvaluationItemConfigDict", "CreateEvaluationItemConfigOrDict", @@ -1981,6 +2014,9 @@ "MessageDict", "Importance", "ParsedResponseUnion", + "_GetAgentEngineTaskRequestParameters", + "_ListReasoningEngineTasksRequestParameters", + "_CreateAgentEngineTaskRequestParameters", "_CreateEvaluationItemParameters", "_CreateEvaluationRunParameters", "_CreateEvaluationSetParameters", diff --git a/vertexai/_genai/types/common.py b/vertexai/_genai/types/common.py index 2716964936..bb2ac1a21d 100644 --- a/vertexai/_genai/types/common.py +++ b/vertexai/_genai/types/common.py @@ -420,6 +420,249 @@ class OptimizationMethod(_common.CaseInSensitiveEnum): """The data driven prompt optimizer designer for prompts from Android core API.""" +class GetAgentEngineTaskConfig(_common.BaseModel): + """Config for getting an Agent Engine Task.""" + + http_options: Optional[genai_types.HttpOptions] = Field( + default=None, description="""Used to override HTTP request options.""" + ) + + +class GetAgentEngineTaskConfigDict(TypedDict, total=False): + """Config for getting an Agent Engine Task.""" + + http_options: Optional[genai_types.HttpOptionsDict] + """Used to override HTTP request options.""" + + +GetAgentEngineTaskConfigOrDict = Union[ + GetAgentEngineTaskConfig, GetAgentEngineTaskConfigDict +] + + +class _GetAgentEngineTaskRequestParameters(_common.BaseModel): + """Parameters for getting an agent engine task.""" + + name: Optional[str] = Field( + default=None, description="""Name of the agent engine task.""" + ) + config: Optional[GetAgentEngineTaskConfig] = Field(default=None, description="""""") + + +class _GetAgentEngineTaskRequestParametersDict(TypedDict, total=False): + """Parameters for getting an agent engine task.""" + + name: Optional[str] + """Name of the agent engine task.""" + + config: Optional[GetAgentEngineTaskConfigDict] + """""" + + +_GetAgentEngineTaskRequestParametersOrDict = Union[ + _GetAgentEngineTaskRequestParameters, _GetAgentEngineTaskRequestParametersDict +] + + +class A2aTask(_common.BaseModel): + """A task.""" + + pass + + +class A2aTaskDict(TypedDict, total=False): + """A task.""" + + pass + + +A2aTaskOrDict = Union[A2aTask, A2aTaskDict] + + +class ListReasoningEngineTasksConfig(_common.BaseModel): + """Config for listing agent engine tasks.""" + + http_options: Optional[genai_types.HttpOptions] = Field( + default=None, description="""Used to override HTTP request options.""" + ) + page_size: Optional[int] = Field(default=None, description="""""") + page_token: Optional[str] = Field(default=None, description="""""") + filter: Optional[str] = Field( + default=None, + description="""An expression for filtering the results of the request. + For field names both snake_case and camelCase are supported.""", + ) + + +class ListReasoningEngineTasksConfigDict(TypedDict, total=False): + """Config for listing agent engine tasks.""" + + http_options: Optional[genai_types.HttpOptionsDict] + """Used to override HTTP request options.""" + + page_size: Optional[int] + """""" + + page_token: Optional[str] + """""" + + filter: Optional[str] + """An expression for filtering the results of the request. + For field names both snake_case and camelCase are supported.""" + + +ListReasoningEngineTasksConfigOrDict = Union[ + ListReasoningEngineTasksConfig, ListReasoningEngineTasksConfigDict +] + + +class _ListReasoningEngineTasksRequestParameters(_common.BaseModel): + """Parameters for listing agent engines.""" + + name: Optional[str] = Field( + default=None, description="""Name of the agent engine.""" + ) + config: Optional[ListReasoningEngineTasksConfig] = Field( + default=None, description="""""" + ) + + +class _ListReasoningEngineTasksRequestParametersDict(TypedDict, total=False): + """Parameters for listing agent engines.""" + + name: Optional[str] + """Name of the agent engine.""" + + config: Optional[ListReasoningEngineTasksConfigDict] + """""" + + +_ListReasoningEngineTasksRequestParametersOrDict = Union[ + _ListReasoningEngineTasksRequestParameters, + _ListReasoningEngineTasksRequestParametersDict, +] + + +class ListReasoningEngineTasksResponse(_common.BaseModel): + """Response for listing agent engine tasks.""" + + sdk_http_response: Optional[genai_types.HttpResponse] = Field( + default=None, description="""Used to retain the full HTTP response.""" + ) + next_page_token: Optional[str] = Field(default=None, description="""""") + tasks: Optional[list[A2aTask]] = Field( + default=None, description="""List of agent engine tasks.""" + ) + + +class ListReasoningEngineTasksResponseDict(TypedDict, total=False): + """Response for listing agent engine tasks.""" + + sdk_http_response: Optional[genai_types.HttpResponseDict] + """Used to retain the full HTTP response.""" + + next_page_token: Optional[str] + """""" + + tasks: Optional[list[A2aTaskDict]] + """List of agent engine tasks.""" + + +ListReasoningEngineTasksResponseOrDict = Union[ + ListReasoningEngineTasksResponse, ListReasoningEngineTasksResponseDict +] + + +class CreateAgentEngineTaskConfig(_common.BaseModel): + """Config for creating a Session.""" + + http_options: Optional[genai_types.HttpOptions] = Field( + default=None, description="""Used to override HTTP request options.""" + ) + display_name: Optional[str] = Field( + default=None, description="""The display name of the task.""" + ) + session_state: Optional[dict[str, Any]] = Field( + default=None, description="""Task state which stores key conversation points.""" + ) + wait_for_completion: Optional[bool] = Field( + default=True, + description="""Waits for the operation to complete before returning.""", + ) + ttl: Optional[str] = Field( + default=None, + description="""Optional. Input only. The TTL for this resource. + + The expiration time is computed: now + TTL.""", + ) + expire_time: Optional[datetime.datetime] = Field( + default=None, + description="""Optional. Timestamp of when this resource is considered expired. This is *always* provided on output, regardless of what `expiration` was sent on input.""", + ) + + +class CreateAgentEngineTaskConfigDict(TypedDict, total=False): + """Config for creating a Session.""" + + http_options: Optional[genai_types.HttpOptionsDict] + """Used to override HTTP request options.""" + + display_name: Optional[str] + """The display name of the task.""" + + session_state: Optional[dict[str, Any]] + """Task state which stores key conversation points.""" + + wait_for_completion: Optional[bool] + """Waits for the operation to complete before returning.""" + + ttl: Optional[str] + """Optional. Input only. The TTL for this resource. + + The expiration time is computed: now + TTL.""" + + expire_time: Optional[datetime.datetime] + """Optional. Timestamp of when this resource is considered expired. This is *always* provided on output, regardless of what `expiration` was sent on input.""" + + +CreateAgentEngineTaskConfigOrDict = Union[ + CreateAgentEngineTaskConfig, CreateAgentEngineTaskConfigDict +] + + +class _CreateAgentEngineTaskRequestParameters(_common.BaseModel): + """Parameters for creating Agent Engine Tasks.""" + + name: Optional[str] = Field( + default=None, + description="""Name of the agent engine to create the task under.""", + ) + user_id: Optional[str] = Field( + default=None, description="""The user ID of the task.""" + ) + config: Optional[CreateAgentEngineTaskConfig] = Field( + default=None, description="""""" + ) + + +class _CreateAgentEngineTaskRequestParametersDict(TypedDict, total=False): + """Parameters for creating Agent Engine Tasks.""" + + name: Optional[str] + """Name of the agent engine to create the task under.""" + + user_id: Optional[str] + """The user ID of the task.""" + + config: Optional[CreateAgentEngineTaskConfigDict] + """""" + + +_CreateAgentEngineTaskRequestParametersOrDict = Union[ + _CreateAgentEngineTaskRequestParameters, _CreateAgentEngineTaskRequestParametersDict +] + + class CreateEvaluationItemConfig(_common.BaseModel): """Config to create an evaluation item."""