From 0d0257d4f124a3a9b785574d27111a724ad53a48 Mon Sep 17 00:00:00 2001 From: Google Team Member Date: Mon, 29 Jun 2026 22:12:57 -0700 Subject: [PATCH] feat(interactions): add CodeMenderAgentConfig PiperOrigin-RevId: 940223251 --- .../_gaos/resources/interactions/__init__.py | 4 + .../codemenderagentconfig/__init__.py | 25 ++++ .../findrequest/__init__.py | 21 ++++ .../fixrequest/__init__.py | 21 ++++ .../_gaos/types/interactions/__init__.py | 27 +++++ .../interactions/codemenderagentconfig.py | 111 ++++++++++++++++++ .../interactions/createagentinteraction.py | 10 +- .../_gaos/types/interactions/filecontent.py | 58 +++++++++ .../_gaos/types/interactions/findrequest.py | 93 +++++++++++++++ .../_gaos/types/interactions/fixrequest.py | 80 +++++++++++++ .../_gaos/types/interactions/interaction.py | 15 ++- .../_gaos/types/interactions/sessionconfig.py | 57 +++++++++ 12 files changed, 518 insertions(+), 4 deletions(-) create mode 100644 google/genai/_gaos/resources/interactions/codemenderagentconfig/__init__.py create mode 100644 google/genai/_gaos/resources/interactions/codemenderagentconfig/findrequest/__init__.py create mode 100644 google/genai/_gaos/resources/interactions/codemenderagentconfig/fixrequest/__init__.py create mode 100644 google/genai/_gaos/types/interactions/codemenderagentconfig.py create mode 100644 google/genai/_gaos/types/interactions/filecontent.py create mode 100644 google/genai/_gaos/types/interactions/findrequest.py create mode 100644 google/genai/_gaos/types/interactions/fixrequest.py create mode 100644 google/genai/_gaos/types/interactions/sessionconfig.py diff --git a/google/genai/_gaos/resources/interactions/__init__.py b/google/genai/_gaos/resources/interactions/__init__.py index b0275cf63..21179bda8 100644 --- a/google/genai/_gaos/resources/interactions/__init__.py +++ b/google/genai/_gaos/resources/interactions/__init__.py @@ -35,6 +35,7 @@ from ...types.interactions.codeexecutioncallarguments import CodeExecutionCallArguments from ...types.interactions.codeexecutioncallstep import CodeExecutionCallStep from ...types.interactions.codeexecutionresultstep import CodeExecutionResultStep +from ...types.interactions.codemenderagentconfig import CodeMenderAgentConfig from ...types.interactions.content import Content from ...types.interactions.createagentinteraction import ( CreateAgentInteractionParam as CreateAgentInteractionParamsNonStreaming, @@ -103,6 +104,7 @@ from ...types.interactions.videoresponseformat import VideoResponseFormat from ...types.interactions.webhookconfig import WebhookConfig from . import codeexecutioncallstep +from . import codemenderagentconfig from . import environment from . import errorevent from . import googlemapscallstep @@ -134,6 +136,7 @@ "CodeExecutionCallArguments", "CodeExecutionCallStep", "CodeExecutionResultStep", + "CodeMenderAgentConfig", "Content", "CreateAgentInteractionParamsNonStreaming", "CreateAgentInteractionParamsStreaming", @@ -204,6 +207,7 @@ "VideoResponseFormat", "WebhookConfig", "codeexecutioncallstep", + "codemenderagentconfig", "environment", "errorevent", "googlemapscallstep", diff --git a/google/genai/_gaos/resources/interactions/codemenderagentconfig/__init__.py b/google/genai/_gaos/resources/interactions/codemenderagentconfig/__init__.py new file mode 100644 index 000000000..f48c5954e --- /dev/null +++ b/google/genai/_gaos/resources/interactions/codemenderagentconfig/__init__.py @@ -0,0 +1,25 @@ +# Copyright 2026 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. +# +# pyformat: disable + +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from ....types.interactions.findrequest import FindRequest +from ....types.interactions.fixrequest import FixRequest +from ....types.interactions.sessionconfig import SessionConfig +from . import findrequest +from . import fixrequest + +__all__ = ["FindRequest", "FixRequest", "SessionConfig", "findrequest", "fixrequest"] diff --git a/google/genai/_gaos/resources/interactions/codemenderagentconfig/findrequest/__init__.py b/google/genai/_gaos/resources/interactions/codemenderagentconfig/findrequest/__init__.py new file mode 100644 index 000000000..1b40e3663 --- /dev/null +++ b/google/genai/_gaos/resources/interactions/codemenderagentconfig/findrequest/__init__.py @@ -0,0 +1,21 @@ +# Copyright 2026 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. +# +# pyformat: disable + +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .....types.interactions.filecontent import FileContent as SourceFile + +__all__ = ["SourceFile"] diff --git a/google/genai/_gaos/resources/interactions/codemenderagentconfig/fixrequest/__init__.py b/google/genai/_gaos/resources/interactions/codemenderagentconfig/fixrequest/__init__.py new file mode 100644 index 000000000..1b40e3663 --- /dev/null +++ b/google/genai/_gaos/resources/interactions/codemenderagentconfig/fixrequest/__init__.py @@ -0,0 +1,21 @@ +# Copyright 2026 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. +# +# pyformat: disable + +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from .....types.interactions.filecontent import FileContent as SourceFile + +__all__ = ["SourceFile"] diff --git a/google/genai/_gaos/types/interactions/__init__.py b/google/genai/_gaos/types/interactions/__init__.py index b0fb93dda..778b3c047 100644 --- a/google/genai/_gaos/types/interactions/__init__.py +++ b/google/genai/_gaos/types/interactions/__init__.py @@ -53,6 +53,7 @@ CodeExecutionResultStep, CodeExecutionResultStepParam, ) + from .codemenderagentconfig import CodeMenderAgentConfig, CodeMenderAgentConfigParam from .computeruse import ( ComputerUse, ComputerUseParam, @@ -113,6 +114,7 @@ from .errorevent import ErrorEvent, ErrorEventTypedDict from .exaaisearchconfig import ExaAISearchConfig, ExaAISearchConfigParam from .filecitation import FileCitation, FileCitationParam + from .filecontent import FileContent, FileContentParam from .filesearch import FileSearch, FileSearchParam from .filesearchcalldelta import FileSearchCallDelta, FileSearchCallDeltaTypedDict from .filesearchcallstep import FileSearchCallStep, FileSearchCallStepParam @@ -123,6 +125,8 @@ ) from .filesearchresultstep import FileSearchResultStep, FileSearchResultStepParam from .filter_ import Filter, FilterParam + from .findrequest import FindRequest, FindRequestParam, Mode + from .fixrequest import FixRequest, FixRequestParam from .function import Function, FunctionParam from .functioncallstep import FunctionCallStep, FunctionCallStepParam from .functionresultdelta import ( @@ -307,6 +311,7 @@ ) from .reviewsnippet import ReviewSnippet, ReviewSnippetParam from .servicetier import ServiceTier + from .sessionconfig import SessionConfig, SessionConfigParam from .source import Source, SourceParam, SourceType from .speechconfig import SpeechConfig, SpeechConfigParam from .status import Status, StatusParam @@ -412,6 +417,8 @@ "CodeExecutionResultDeltaTypedDict", "CodeExecutionResultStep", "CodeExecutionResultStepParam", + "CodeMenderAgentConfig", + "CodeMenderAgentConfigParam", "ComputerUse", "ComputerUseParam", "Content", @@ -457,6 +464,8 @@ "ExaAISearchConfigParam", "FileCitation", "FileCitationParam", + "FileContent", + "FileContentParam", "FileSearch", "FileSearchCallDelta", "FileSearchCallDeltaTypedDict", @@ -471,6 +480,10 @@ "FileSearchResultTypedDict", "Filter", "FilterParam", + "FindRequest", + "FindRequestParam", + "FixRequest", + "FixRequestParam", "Function", "FunctionCallStep", "FunctionCallStepParam", @@ -591,6 +604,7 @@ "MediaResolution", "ModalityTokens", "ModalityTokensTypedDict", + "Mode", "Model", "ModelOutputStep", "ModelOutputStepParam", @@ -625,6 +639,8 @@ "ReviewSnippet", "ReviewSnippetParam", "ServiceTier", + "SessionConfig", + "SessionConfigParam", "Source", "SourceParam", "SourceType", @@ -760,6 +776,8 @@ "CodeExecutionResultDeltaTypedDict": ".codeexecutionresultdelta", "CodeExecutionResultStep": ".codeexecutionresultstep", "CodeExecutionResultStepParam": ".codeexecutionresultstep", + "CodeMenderAgentConfig": ".codemenderagentconfig", + "CodeMenderAgentConfigParam": ".codemenderagentconfig", "ComputerUse": ".computeruse", "ComputerUseParam": ".computeruse", "DisabledSafetyPolicy": ".computeruse", @@ -812,6 +830,8 @@ "ExaAISearchConfigParam": ".exaaisearchconfig", "FileCitation": ".filecitation", "FileCitationParam": ".filecitation", + "FileContent": ".filecontent", + "FileContentParam": ".filecontent", "FileSearch": ".filesearch", "FileSearchParam": ".filesearch", "FileSearchCallDelta": ".filesearchcalldelta", @@ -826,6 +846,11 @@ "FileSearchResultStepParam": ".filesearchresultstep", "Filter": ".filter_", "FilterParam": ".filter_", + "FindRequest": ".findrequest", + "FindRequestParam": ".findrequest", + "Mode": ".findrequest", + "FixRequest": ".fixrequest", + "FixRequestParam": ".fixrequest", "Function": ".function", "FunctionParam": ".function", "FunctionCallStep": ".functioncallstep", @@ -981,6 +1006,8 @@ "ReviewSnippet": ".reviewsnippet", "ReviewSnippetParam": ".reviewsnippet", "ServiceTier": ".servicetier", + "SessionConfig": ".sessionconfig", + "SessionConfigParam": ".sessionconfig", "Source": ".source", "SourceParam": ".source", "SourceType": ".source", diff --git a/google/genai/_gaos/types/interactions/codemenderagentconfig.py b/google/genai/_gaos/types/interactions/codemenderagentconfig.py new file mode 100644 index 000000000..770ea36e4 --- /dev/null +++ b/google/genai/_gaos/types/interactions/codemenderagentconfig.py @@ -0,0 +1,111 @@ +# Copyright 2026 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. +# +# pyformat: disable + +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .. import BaseModel, UNSET_SENTINEL +from ...utils import validate_const +from .findrequest import FindRequest, FindRequestParam +from .fixrequest import FixRequest, FixRequestParam +from .sessionconfig import SessionConfig, SessionConfigParam +import pydantic +from pydantic import model_serializer +from pydantic.functional_validators import AfterValidator +from typing import Literal, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class CodeMenderAgentConfigParam(TypedDict): + r"""Configuration for the CodeMender agent.""" + + type: Literal["code-mender"] + find_request: NotRequired[FindRequestParam] + r"""Request parameters specific to FIND sessions, used for discovering + vulnerabilities in a codebase. + """ + fix_request: NotRequired[FixRequestParam] + r"""Request parameters specific to FIX sessions, used for generating and + validating security patches. + """ + session_id: NotRequired[str] + r"""Parameter for grouping multiple interactions that belong to + the same CodeMender session. + """ + session_config: NotRequired[SessionConfigParam] + r"""The configuration of CodeMender sessions.""" + model: NotRequired[str] + r"""The name of the model to use for the CodeMender agent. One + CodeMender session will only use one model. + """ + + +class CodeMenderAgentConfig(BaseModel): + r"""Configuration for the CodeMender agent.""" + + type: Annotated[ + Annotated[ + Literal["code-mender"], AfterValidator(validate_const("code-mender")) + ], + pydantic.Field(alias="type"), + ] = "code-mender" + + find_request: Optional[FindRequest] = None + r"""Request parameters specific to FIND sessions, used for discovering + vulnerabilities in a codebase. + """ + + fix_request: Optional[FixRequest] = None + r"""Request parameters specific to FIX sessions, used for generating and + validating security patches. + """ + + session_id: Optional[str] = None + r"""Parameter for grouping multiple interactions that belong to + the same CodeMender session. + """ + + session_config: Optional[SessionConfig] = None + r"""The configuration of CodeMender sessions.""" + + model: Optional[str] = None + r"""The name of the model to use for the CodeMender agent. One + CodeMender session will only use one model. + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set( + ["find_request", "fix_request", "session_id", "session_config", "model"] + ) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m + + +try: + CodeMenderAgentConfig.model_rebuild() +except NameError: + pass diff --git a/google/genai/_gaos/types/interactions/createagentinteraction.py b/google/genai/_gaos/types/interactions/createagentinteraction.py index 18736d09e..99b0ece8f 100644 --- a/google/genai/_gaos/types/interactions/createagentinteraction.py +++ b/google/genai/_gaos/types/interactions/createagentinteraction.py @@ -19,6 +19,7 @@ from __future__ import annotations from .. import BaseModel, UNSET_SENTINEL from .agentoption import AgentOption +from .codemenderagentconfig import CodeMenderAgentConfig, CodeMenderAgentConfigParam from .deepresearchagentconfig import ( DeepResearchAgentConfig, DeepResearchAgentConfigParam, @@ -64,13 +65,18 @@ CreateAgentInteractionAgentConfigParam = TypeAliasType( "CreateAgentInteractionAgentConfigParam", - Union[DynamicAgentConfigParam, DeepResearchAgentConfigParam], + Union[ + DynamicAgentConfigParam, + DeepResearchAgentConfigParam, + CodeMenderAgentConfigParam, + ], ) r"""Configuration parameters for the agent interaction.""" CreateAgentInteractionAgentConfig = Annotated[ - Union[DynamicAgentConfig, DeepResearchAgentConfig], Field(discriminator="type") + Union[DynamicAgentConfig, DeepResearchAgentConfig, CodeMenderAgentConfig], + Field(discriminator="type"), ] r"""Configuration parameters for the agent interaction.""" diff --git a/google/genai/_gaos/types/interactions/filecontent.py b/google/genai/_gaos/types/interactions/filecontent.py new file mode 100644 index 000000000..800c3d062 --- /dev/null +++ b/google/genai/_gaos/types/interactions/filecontent.py @@ -0,0 +1,58 @@ +# Copyright 2026 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. +# +# pyformat: disable + +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .. import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class FileContentParam(TypedDict): + r"""Content of a single file in the codebase.""" + + path: NotRequired[str] + r"""The relative path of the file from the project root.""" + content: NotRequired[str] + r"""The UTF-8 encoded text content of the file.""" + + +class FileContent(BaseModel): + r"""Content of a single file in the codebase.""" + + path: Optional[str] = None + r"""The relative path of the file from the project root.""" + + content: Optional[str] = None + r"""The UTF-8 encoded text content of the file.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["path", "content"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/google/genai/_gaos/types/interactions/findrequest.py b/google/genai/_gaos/types/interactions/findrequest.py new file mode 100644 index 000000000..368fa3976 --- /dev/null +++ b/google/genai/_gaos/types/interactions/findrequest.py @@ -0,0 +1,93 @@ +# Copyright 2026 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. +# +# pyformat: disable + +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr +from .filecontent import FileContent, FileContentParam +from pydantic import model_serializer +from typing import List, Literal, Optional, Union +from typing_extensions import NotRequired, TypedDict + + +Mode = Union[ + Literal[ + "scan", + "verify", + ], + UnrecognizedStr, +] +r"""The mode of the find session.""" + + +class FindRequestParam(TypedDict): + r"""Request parameters specific to FIND sessions, used for discovering + vulnerabilities in a codebase. + """ + + source_files: NotRequired[List[FileContentParam]] + r"""A list of source files to provide as context for the scan.""" + finding_id: NotRequired[str] + r"""The identifier of a specific finding to verify. This is primarily used in + VERIFY mode to focus the agent's execution-based validation on a single + vulnerability. + """ + description: NotRequired[str] + r"""Additional context or custom instructions provided by the user to guide + the vulnerability analysis. + """ + mode: NotRequired[Mode] + r"""The mode of the find session.""" + + +class FindRequest(BaseModel): + r"""Request parameters specific to FIND sessions, used for discovering + vulnerabilities in a codebase. + """ + + source_files: Optional[List[FileContent]] = None + r"""A list of source files to provide as context for the scan.""" + + finding_id: Optional[str] = None + r"""The identifier of a specific finding to verify. This is primarily used in + VERIFY mode to focus the agent's execution-based validation on a single + vulnerability. + """ + + description: Optional[str] = None + r"""Additional context or custom instructions provided by the user to guide + the vulnerability analysis. + """ + + mode: Optional[Mode] = None + r"""The mode of the find session.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["source_files", "finding_id", "description", "mode"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/google/genai/_gaos/types/interactions/fixrequest.py b/google/genai/_gaos/types/interactions/fixrequest.py new file mode 100644 index 000000000..efe54ef1f --- /dev/null +++ b/google/genai/_gaos/types/interactions/fixrequest.py @@ -0,0 +1,80 @@ +# Copyright 2026 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. +# +# pyformat: disable + +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .. import BaseModel, UNSET_SENTINEL +from .filecontent import FileContent, FileContentParam +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import NotRequired, TypedDict + + +class FixRequestParam(TypedDict): + r"""Request parameters specific to FIX sessions, used for generating and + validating security patches. + """ + + source_files: NotRequired[List[FileContentParam]] + r"""A list of source files providing context for the remediation. These files + are typically the ones containing the identified vulnerability. + """ + finding_id: NotRequired[str] + r"""The identifier of the specific security finding to be remediated. This ID + maps to a previously discovered vulnerability. + """ + description: NotRequired[str] + r"""Additional context or custom instructions provided by the user to guide + the patch generation process. + """ + + +class FixRequest(BaseModel): + r"""Request parameters specific to FIX sessions, used for generating and + validating security patches. + """ + + source_files: Optional[List[FileContent]] = None + r"""A list of source files providing context for the remediation. These files + are typically the ones containing the identified vulnerability. + """ + + finding_id: Optional[str] = None + r"""The identifier of the specific security finding to be remediated. This ID + maps to a previously discovered vulnerability. + """ + + description: Optional[str] = None + r"""Additional context or custom instructions provided by the user to guide + the patch generation process. + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["source_files", "finding_id", "description"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m diff --git a/google/genai/_gaos/types/interactions/interaction.py b/google/genai/_gaos/types/interactions/interaction.py index 2f3d33fab..0d5e7b3fe 100644 --- a/google/genai/_gaos/types/interactions/interaction.py +++ b/google/genai/_gaos/types/interactions/interaction.py @@ -21,6 +21,7 @@ from ...utils.unions import parse_open_union from .agentoption import AgentOption from .audiocontent import AudioContent, AudioContentParam +from .codemenderagentconfig import CodeMenderAgentConfig, CodeMenderAgentConfigParam from .deepresearchagentconfig import ( DeepResearchAgentConfig, DeepResearchAgentConfigParam, @@ -89,7 +90,11 @@ InteractionAgentConfigTypedDict = TypeAliasType( "InteractionAgentConfigTypedDict", - Union[DynamicAgentConfigParam, DeepResearchAgentConfigParam], + Union[ + DynamicAgentConfigParam, + DeepResearchAgentConfigParam, + CodeMenderAgentConfigParam, + ], ) r"""Configuration parameters for the agent interaction.""" @@ -107,11 +112,17 @@ class UnknownInteractionAgentConfig(BaseModel): _INTERACTION_AGENT_CONFIG_VARIANTS: dict[str, Any] = { "dynamic": DynamicAgentConfig, "deep-research": DeepResearchAgentConfig, + "code-mender": CodeMenderAgentConfig, } InteractionAgentConfig = Annotated[ - Union[DynamicAgentConfig, DeepResearchAgentConfig, UnknownInteractionAgentConfig], + Union[ + DynamicAgentConfig, + DeepResearchAgentConfig, + CodeMenderAgentConfig, + UnknownInteractionAgentConfig, + ], BeforeValidator( partial( parse_open_union, diff --git a/google/genai/_gaos/types/interactions/sessionconfig.py b/google/genai/_gaos/types/interactions/sessionconfig.py new file mode 100644 index 000000000..8452280af --- /dev/null +++ b/google/genai/_gaos/types/interactions/sessionconfig.py @@ -0,0 +1,57 @@ +# Copyright 2026 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. +# +# pyformat: disable + +"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.""" + +from __future__ import annotations +from .. import BaseModel, UNSET_SENTINEL +from pydantic import model_serializer +from typing import Optional +from typing_extensions import NotRequired, TypedDict + + +class SessionConfigParam(TypedDict): + r"""The configuration of CodeMender sessions.""" + + max_rounds: NotRequired[int] + r"""The maximum number of interaction rounds the agent is allowed to perform + before reaching a timeout. + """ + + +class SessionConfig(BaseModel): + r"""The configuration of CodeMender sessions.""" + + max_rounds: Optional[int] = None + r"""The maximum number of interaction rounds the agent is allowed to perform + before reaching a timeout. + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["max_rounds"]) + serialized = handler(self) + m = {} + + for n, f in type(self).model_fields.items(): + k = f.alias or n + val = serialized.get(k, serialized.get(n)) + + if val != UNSET_SENTINEL: + if val is not None or k not in optional_fields: + m[k] = val + + return m