diff --git a/google/genai/_gaos/types/interactions/__init__.py b/google/genai/_gaos/types/interactions/__init__.py index c71739cc5..25e33cd50 100644 --- a/google/genai/_gaos/types/interactions/__init__.py +++ b/google/genai/_gaos/types/interactions/__init__.py @@ -88,6 +88,7 @@ CreateModelInteractionResponseFormat, CreateModelInteractionResponseFormatParam, ) + from .cronconfig import CronConfig, CronConfigTypedDict from .deepresearchagentconfig import ( DeepResearchAgentConfig, DeepResearchAgentConfigParam, @@ -134,6 +135,7 @@ ) from .filesearchresultstep import FileSearchResultStep, FileSearchResultStepParam from .filter_ import Filter, FilterParam + from .filterrule import FilterRule, FilterRuleTypedDict, Operator from .findrequest import FindRequest, FindRequestParam, Mode from .fixrequest import FixRequest, FixRequestParam from .function import Function, FunctionParam @@ -388,6 +390,7 @@ TranscriptionModeParam, UnknownTranscriptionMode, ) + from .trigger import Script, ScriptTypedDict from .urlcitation import URLCitation, URLCitationParam from .urlcontext import URLContext, URLContextParam from .urlcontextcallarguments import ( @@ -431,6 +434,14 @@ VideoResponseFormatParam, ) from .webhookconfig import WebhookConfig, WebhookConfigParam + from .webhooktriggerconfig import ( + Verification, + VerificationTypedDict, + WebhookTriggerConfig, + WebhookTriggerConfigFilter, + WebhookTriggerConfigFilterTypedDict, + WebhookTriggerConfigTypedDict, + ) from .wordinfo import WordInfo, WordInfoParam __all__ = [ @@ -489,6 +500,8 @@ "CreateModelInteractionParam", "CreateModelInteractionResponseFormat", "CreateModelInteractionResponseFormatParam", + "CronConfig", + "CronConfigTypedDict", "DeepResearchAgentConfig", "DeepResearchAgentConfigParam", "Disabled", @@ -532,6 +545,8 @@ "FileSearchResultTypedDict", "Filter", "FilterParam", + "FilterRule", + "FilterRuleTypedDict", "FindRequest", "FindRequestParam", "FixRequest", @@ -667,6 +682,7 @@ "Network", "NetworkEnum", "NetworkParam", + "Operator", "ParallelAISearchConfig", "ParallelAISearchConfigParam", "PlaceCitation", @@ -708,6 +724,8 @@ "ReviewSnippetParam", "SafetySetting", "SafetySettingParam", + "Script", + "ScriptTypedDict", "ServiceTier", "SessionConfig", "SessionConfigParam", @@ -808,6 +826,8 @@ "UserInputStepParam", "VerbatimTranscriptionMode", "VerbatimTranscriptionModeParam", + "Verification", + "VerificationTypedDict", "VertexAISearchConfig", "VertexAISearchConfigParam", "VideoConfig", @@ -825,6 +845,10 @@ "Visualization", "WebhookConfig", "WebhookConfigParam", + "WebhookTriggerConfig", + "WebhookTriggerConfigFilter", + "WebhookTriggerConfigFilterTypedDict", + "WebhookTriggerConfigTypedDict", "WordInfo", "WordInfoParam", ] @@ -890,6 +914,8 @@ "CreateModelInteractionParam": ".createmodelinteraction", "CreateModelInteractionResponseFormat": ".createmodelinteraction", "CreateModelInteractionResponseFormatParam": ".createmodelinteraction", + "CronConfig": ".cronconfig", + "CronConfigTypedDict": ".cronconfig", "DeepResearchAgentConfig": ".deepresearchagentconfig", "DeepResearchAgentConfigParam": ".deepresearchagentconfig", "Visualization": ".deepresearchagentconfig", @@ -937,6 +963,9 @@ "FileSearchResultStepParam": ".filesearchresultstep", "Filter": ".filter_", "FilterParam": ".filter_", + "FilterRule": ".filterrule", + "FilterRuleTypedDict": ".filterrule", + "Operator": ".filterrule", "FindRequest": ".findrequest", "FindRequestParam": ".findrequest", "Mode": ".findrequest", @@ -1177,6 +1206,8 @@ "TranscriptionMode": ".transcriptionmode", "TranscriptionModeParam": ".transcriptionmode", "UnknownTranscriptionMode": ".transcriptionmode", + "Script": ".trigger", + "ScriptTypedDict": ".trigger", "URLCitation": ".urlcitation", "URLCitationParam": ".urlcitation", "URLContext": ".urlcontext", @@ -1221,6 +1252,12 @@ "VideoResponseFormatParam": ".videoresponseformat", "WebhookConfig": ".webhookconfig", "WebhookConfigParam": ".webhookconfig", + "Verification": ".webhooktriggerconfig", + "VerificationTypedDict": ".webhooktriggerconfig", + "WebhookTriggerConfig": ".webhooktriggerconfig", + "WebhookTriggerConfigFilter": ".webhooktriggerconfig", + "WebhookTriggerConfigFilterTypedDict": ".webhooktriggerconfig", + "WebhookTriggerConfigTypedDict": ".webhooktriggerconfig", "WordInfo": ".wordinfo", "WordInfoParam": ".wordinfo", } diff --git a/google/genai/_gaos/types/interactions/cronconfig.py b/google/genai/_gaos/types/interactions/cronconfig.py new file mode 100644 index 000000000..b1917ff37 --- /dev/null +++ b/google/genai/_gaos/types/interactions/cronconfig.py @@ -0,0 +1,40 @@ +# 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 +from typing_extensions import TypedDict + + +class CronConfigTypedDict(TypedDict): + r"""Cron-specific trigger configuration.""" + + schedule: str + r"""Required. Standard 5-part cron expression (e.g., \"0 2 * * 1-5\").""" + time_zone: str + r"""Required. IANA time zone identifier (e.g., \"America/Los_Angeles\", \"UTC\").""" + + +class CronConfig(BaseModel): + r"""Cron-specific trigger configuration.""" + + schedule: str + r"""Required. Standard 5-part cron expression (e.g., \"0 2 * * 1-5\").""" + + time_zone: str + r"""Required. IANA time zone identifier (e.g., \"America/Los_Angeles\", \"UTC\").""" diff --git a/google/genai/_gaos/types/interactions/filterrule.py b/google/genai/_gaos/types/interactions/filterrule.py new file mode 100644 index 000000000..512163035 --- /dev/null +++ b/google/genai/_gaos/types/interactions/filterrule.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, UnrecognizedStr +from typing import List, Literal, Union +from typing_extensions import TypedDict + + +Operator = Union[ + Literal[ + "equals", + "in", + ], + UnrecognizedStr, +] + + +class FilterRuleTypedDict(TypedDict): + r"""A single declarative filter rule for webhook payload evaluation.""" + + field_path: str + r"""Required. JSON path in the payload to evaluate (e.g., \"payload.action\"). + Uses dot notation for nested fields. + """ + operator: Operator + values: List[str] + r"""Required. Values to match against. For EQUALS, only values[0] is used.""" + + +class FilterRule(BaseModel): + r"""A single declarative filter rule for webhook payload evaluation.""" + + field_path: str + r"""Required. JSON path in the payload to evaluate (e.g., \"payload.action\"). + Uses dot notation for nested fields. + """ + + operator: Operator + + values: List[str] + r"""Required. Values to match against. For EQUALS, only values[0] is used.""" diff --git a/google/genai/_gaos/types/interactions/trigger.py b/google/genai/_gaos/types/interactions/trigger.py new file mode 100644 index 000000000..c3bbe0770 --- /dev/null +++ b/google/genai/_gaos/types/interactions/trigger.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 List, Optional +from typing_extensions import NotRequired, TypedDict + + +class ScriptTypedDict(TypedDict): + r"""Execute a script inside the agent's container environment.""" + + command: str + r"""Required. Command to execute in the container (e.g., \"node\", \"python3\", \"bash\").""" + args: NotRequired[List[str]] + r"""Arguments to pass to the command (e.g., [\".agents/triggers/handler.js\"]).""" + + +class Script(BaseModel): + r"""Execute a script inside the agent's container environment.""" + + command: str + r"""Required. Command to execute in the container (e.g., \"node\", \"python3\", \"bash\").""" + + args: Optional[List[str]] = None + r"""Arguments to pass to the command (e.g., [\".agents/triggers/handler.js\"]).""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["args"]) + 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/webhooktriggerconfig.py b/google/genai/_gaos/types/interactions/webhooktriggerconfig.py new file mode 100644 index 000000000..ea0749d75 --- /dev/null +++ b/google/genai/_gaos/types/interactions/webhooktriggerconfig.py @@ -0,0 +1,161 @@ +# 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 .filterrule import FilterRule, FilterRuleTypedDict +from .. import BaseModel, UNSET_SENTINEL +import pydantic +from pydantic import model_serializer +from typing import List, Optional +from typing_extensions import Annotated, NotRequired, TypedDict + + +class WebhookTriggerConfigFilterTypedDict(TypedDict): + r"""Optional declarative filter rules evaluated before waking the container.""" + + rules: NotRequired[List[FilterRuleTypedDict]] + + +class WebhookTriggerConfigFilter(BaseModel): + r"""Optional declarative filter rules evaluated before waking the container.""" + + rules: Optional[List[FilterRule]] = None + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["rules"]) + 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 + + +class VerificationTypedDict(TypedDict): + r"""Signature verification configuration.""" + + credential_id: NotRequired[str] + r"""Resource ID referencing a stored credential for signature verification. + Format: \"credentials/{credential_id}\" + """ + custom_header_name: NotRequired[str] + r"""Custom header name override for non-preset HMAC verification. + Only used when preset is empty (custom verification). + """ + preset: NotRequired[str] + r"""Named verification preset. Currently supported: \"github\". + When set, the preset configures the header name, algorithm, and + deduplication logic automatically. + """ + + +class Verification(BaseModel): + r"""Signature verification configuration.""" + + credential_id: Optional[str] = None + r"""Resource ID referencing a stored credential for signature verification. + Format: \"credentials/{credential_id}\" + """ + + custom_header_name: Optional[str] = None + r"""Custom header name override for non-preset HMAC verification. + Only used when preset is empty (custom verification). + """ + + preset: Optional[str] = None + r"""Named verification preset. Currently supported: \"github\". + When set, the preset configures the header name, algorithm, and + deduplication logic automatically. + """ + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["credential_id", "custom_header_name", "preset"]) + 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 + + +class WebhookTriggerConfigTypedDict(TypedDict): + r"""Webhook-specific trigger configuration.""" + + endpoint_url: NotRequired[str] + r"""Output only. Public endpoint URL for receiving webhook POST requests. + Format: + https://generativelanguage.googleapis.com/v1beta/agents/{agent_id}/triggers/{trigger_id} + """ + filter_: NotRequired[WebhookTriggerConfigFilterTypedDict] + r"""Optional declarative filter rules evaluated before waking the container.""" + verification: NotRequired[VerificationTypedDict] + r"""Signature verification configuration.""" + + +class WebhookTriggerConfig(BaseModel): + r"""Webhook-specific trigger configuration.""" + + endpoint_url: Optional[str] = None + r"""Output only. Public endpoint URL for receiving webhook POST requests. + Format: + https://generativelanguage.googleapis.com/v1beta/agents/{agent_id}/triggers/{trigger_id} + """ + + filter_: Annotated[ + Optional[WebhookTriggerConfigFilter], pydantic.Field(alias="filter") + ] = None + r"""Optional declarative filter rules evaluated before waking the container.""" + + verification: Optional[Verification] = None + r"""Signature verification configuration.""" + + @model_serializer(mode="wrap") + def serialize_model(self, handler): + optional_fields = set(["endpoint_url", "filter", "verification"]) + 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: + WebhookTriggerConfig.model_rebuild() +except NameError: + pass diff --git a/google/genai/_gaos/types/triggers/trigger.py b/google/genai/_gaos/types/triggers/trigger.py index 5c0b71cce..f9c7e7d68 100644 --- a/google/genai/_gaos/types/triggers/trigger.py +++ b/google/genai/_gaos/types/triggers/trigger.py @@ -19,10 +19,16 @@ from __future__ import annotations from datetime import datetime from .. import BaseModel, UNSET_SENTINEL, UnrecognizedStr -from ..interactions import interaction as interactions_interaction +from ..interactions import ( + cronconfig as interactions_cronconfig, + interaction as interactions_interaction, + trigger as interactions_trigger, + webhooktriggerconfig as interactions_webhooktriggerconfig, +) +import pydantic from pydantic import model_serializer from typing import Literal, Optional, Union -from typing_extensions import NotRequired, TypedDict +from typing_extensions import Annotated, NotRequired, TypedDict TriggerStatus = Union[ @@ -41,26 +47,28 @@ class TriggerTypedDict(TypedDict): id: str r"""Required. Output only. Identifier. The ID of the trigger.""" - interaction: interactions_interaction.InteractionTypedDict - r"""The Interaction resource.""" - schedule: str - r"""Required. The cron schedule on which the trigger should run. - Standard cron format. + agent_id: NotRequired[str] + r"""The agent that owns this trigger. Set automatically when creating + via the agent-scoped endpoint. """ - time_zone: str - r"""Required. Time zone in which the schedule should be interpreted.""" consecutive_failure_count: NotRequired[int] r"""Output only. The number of consecutive failures that have occurred since the last successful execution. """ create_time: NotRequired[datetime] r"""Output only. The time when the trigger was created.""" + cron: NotRequired[interactions_cronconfig.CronConfigTypedDict] + r"""Cron-specific trigger configuration.""" display_name: NotRequired[str] r"""Optional. The display name of the trigger.""" environment_id: NotRequired[str] r"""Optional. The environment ID for the trigger execution.""" execution_timeout_seconds: NotRequired[int] r"""Optional. The execution timeout for the triggered interaction.""" + interaction: NotRequired[interactions_interaction.InteractionTypedDict] + r"""The Interaction resource.""" + interaction_template: NotRequired[interactions_interaction.InteractionTypedDict] + r"""The Interaction resource.""" last_pause_time: NotRequired[datetime] r"""Output only. The time when the trigger was last paused.""" last_resume_time: NotRequired[datetime] @@ -75,10 +83,25 @@ class TriggerTypedDict(TypedDict): r"""Output only. The time when the trigger is scheduled to run next.""" previous_interaction_id: NotRequired[str] r"""Output only. The ID of the last interaction created by this trigger.""" + schedule: NotRequired[str] + r"""Deprecated: Use cron.schedule instead. + The cron schedule on which the trigger should run. + Standard cron format. + """ + script: NotRequired[interactions_trigger.ScriptTypedDict] + r"""Execute a script inside the agent's container environment.""" status: NotRequired[TriggerStatus] r"""Output only. The current status of the trigger.""" + time_zone: NotRequired[str] + r"""Deprecated: Use cron.time_zone instead. + Time zone in which the schedule should be interpreted. + """ update_time: NotRequired[datetime] r"""Output only. The time when the trigger was last updated.""" + webhook: NotRequired[ + interactions_webhooktriggerconfig.WebhookTriggerConfigTypedDict + ] + r"""Webhook-specific trigger configuration.""" class Trigger(BaseModel): @@ -87,17 +110,11 @@ class Trigger(BaseModel): id: str r"""Required. Output only. Identifier. The ID of the trigger.""" - interaction: interactions_interaction.Interaction - r"""The Interaction resource.""" - - schedule: str - r"""Required. The cron schedule on which the trigger should run. - Standard cron format. + agent_id: Optional[str] = None + r"""The agent that owns this trigger. Set automatically when creating + via the agent-scoped endpoint. """ - time_zone: str - r"""Required. Time zone in which the schedule should be interpreted.""" - consecutive_failure_count: Optional[int] = None r"""Output only. The number of consecutive failures that have occurred since the last successful execution. @@ -106,6 +123,9 @@ class Trigger(BaseModel): create_time: Optional[datetime] = None r"""Output only. The time when the trigger was created.""" + cron: Optional[interactions_cronconfig.CronConfig] = None + r"""Cron-specific trigger configuration.""" + display_name: Optional[str] = None r"""Optional. The display name of the trigger.""" @@ -115,6 +135,12 @@ class Trigger(BaseModel): execution_timeout_seconds: Optional[int] = None r"""Optional. The execution timeout for the triggered interaction.""" + interaction: Optional[interactions_interaction.Interaction] = None + r"""The Interaction resource.""" + + interaction_template: Optional[interactions_interaction.Interaction] = None + r"""The Interaction resource.""" + last_pause_time: Optional[datetime] = None r"""Output only. The time when the trigger was last paused.""" @@ -135,29 +161,64 @@ class Trigger(BaseModel): previous_interaction_id: Optional[str] = None r"""Output only. The ID of the last interaction created by this trigger.""" + schedule: Annotated[ + Optional[str], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ), + ] = None + r"""Deprecated: Use cron.schedule instead. + The cron schedule on which the trigger should run. + Standard cron format. + """ + + script: Optional[interactions_trigger.Script] = None + r"""Execute a script inside the agent's container environment.""" + status: Optional[TriggerStatus] = None r"""Output only. The current status of the trigger.""" + time_zone: Annotated[ + Optional[str], + pydantic.Field( + deprecated="warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible." + ), + ] = None + r"""Deprecated: Use cron.time_zone instead. + Time zone in which the schedule should be interpreted. + """ + update_time: Optional[datetime] = None r"""Output only. The time when the trigger was last updated.""" + webhook: Optional[interactions_webhooktriggerconfig.WebhookTriggerConfig] = None + r"""Webhook-specific trigger configuration.""" + @model_serializer(mode="wrap") def serialize_model(self, handler): optional_fields = set( [ + "agent_id", "consecutive_failure_count", "create_time", + "cron", "display_name", "environment_id", "execution_timeout_seconds", + "interaction", + "interaction_template", "last_pause_time", "last_resume_time", "last_run_time", "max_consecutive_failures", "next_run_time", "previous_interaction_id", + "schedule", + "script", "status", + "time_zone", "update_time", + "webhook", ] ) serialized = handler(self)