diff --git a/agentplatform/_genai/evals.py b/agentplatform/_genai/evals.py index 32d045588a..ab6de8d7ca 100644 --- a/agentplatform/_genai/evals.py +++ b/agentplatform/_genai/evals.py @@ -215,6 +215,13 @@ def _CustomCodeExecutionSpec_from_vertex( getv(from_object, ["evaluation_function"]), ) + if getv(from_object, ["codeExecutionRegion"]) is not None: + setv( + to_object, + ["code_execution_region"], + getv(from_object, ["codeExecutionRegion"]), + ) + return to_object @@ -237,6 +244,13 @@ def _CustomCodeExecutionSpec_to_vertex( getv(from_object, ["remote_custom_function"]), ) + if getv(from_object, ["code_execution_region"]) is not None: + setv( + to_object, + ["codeExecutionRegion"], + getv(from_object, ["code_execution_region"]), + ) + return to_object diff --git a/agentplatform/_genai/types/common.py b/agentplatform/_genai/types/common.py index a5c33b5b9c..32351b8742 100644 --- a/agentplatform/_genai/types/common.py +++ b/agentplatform/_genai/types/common.py @@ -328,6 +328,8 @@ class SandboxState(_common.CaseInSensitiveEnum): """Sandbox runtime is pausing.""" STATE_RESUMING = "STATE_RESUMING" """Sandbox runtime is resuming.""" + STATE_STOPPING = "STATE_STOPPING" + """Sandbox runtime is stopping.""" class Protocol(_common.CaseInSensitiveEnum): @@ -1705,6 +1707,10 @@ def evaluate(instance: dict[str, Any]) -> float: Instance is the evaluation instance, any fields populated in the instance are available to the function as instance[field_name].""", ) + code_execution_region: Optional[str] = Field( + default=None, + description="""Optional. The region to use for code execution. If set, the Code Execution Sandbox will be invoked in the specified region regardless of the request's originating region. Must be a region where the Code Execution Sandbox is available. Supported regions: northamerica-northeast1, southamerica-east1, us-central1, us-east1, us-east4, us-west1, us-west4, europe-central2, europe-north1, europe-southwest1, europe-west1, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-west1, asia-east1, asia-east2, asia-northeast1, asia-northeast3, asia-south1, asia-south2, asia-southeast1, australia-southeast2. If unset, the request's originating region is used; requests from regions where the sandbox is unavailable will fail with UNIMPLEMENTED.""", + ) class CustomCodeExecutionSpecDict(TypedDict, total=False): @@ -1724,6 +1730,9 @@ def evaluate(instance: dict[str, Any]) -> float: Instance is the evaluation instance, any fields populated in the instance are available to the function as instance[field_name].""" + code_execution_region: Optional[str] + """Optional. The region to use for code execution. If set, the Code Execution Sandbox will be invoked in the specified region regardless of the request's originating region. Must be a region where the Code Execution Sandbox is available. Supported regions: northamerica-northeast1, southamerica-east1, us-central1, us-east1, us-east4, us-west1, us-west4, europe-central2, europe-north1, europe-southwest1, europe-west1, europe-west2, europe-west3, europe-west4, europe-west6, europe-west8, europe-west9, me-west1, asia-east1, asia-east2, asia-northeast1, asia-northeast3, asia-south1, asia-south2, asia-southeast1, australia-southeast2. If unset, the request's originating region is used; requests from regions where the sandbox is unavailable will fail with UNIMPLEMENTED.""" + CustomCodeExecutionSpecOrDict = Union[ CustomCodeExecutionSpec, CustomCodeExecutionSpecDict @@ -6665,7 +6674,7 @@ class ReservationAffinity(_common.BaseModel): ) values: Optional[list[str]] = Field( default=None, - description="""Optional. Corresponds to the label values of a reservation resource. This must be the full resource name of the reservation or reservation block.""", + description="""Optional. Corresponds to the label values of a reservation resource. This must be the resource name of the reservation, reservation block, or reservation sub- block.""", ) @@ -6679,7 +6688,7 @@ class ReservationAffinityDict(TypedDict, total=False): """Required. Specifies the reservation affinity type.""" values: Optional[list[str]] - """Optional. Corresponds to the label values of a reservation resource. This must be the full resource name of the reservation or reservation block.""" + """Optional. Corresponds to the label values of a reservation resource. This must be the resource name of the reservation, reservation block, or reservation sub- block.""" ReservationAffinityOrDict = Union[ReservationAffinity, ReservationAffinityDict] @@ -11538,6 +11547,9 @@ class Memory(_common.BaseModel): default=None, description="""Optional. Represents the structured content of the memory.""", ) + context: Optional[str] = Field( + default=None, description="""Optional. Represents the context of the memory.""" + ) class MemoryDict(TypedDict, total=False): @@ -11594,6 +11606,9 @@ class MemoryDict(TypedDict, total=False): structured_content: Optional[MemoryStructuredContentDict] """Optional. Represents the structured content of the memory.""" + context: Optional[str] + """Optional. Represents the context of the memory.""" + MemoryOrDict = Union[Memory, MemoryDict] @@ -13281,6 +13296,10 @@ class MemoryRevision(_common.BaseModel): default=None, description="""Output only. Represents the structured value of the memory at the time of revision creation.""", ) + context: Optional[str] = Field( + default=None, + description="""Output only. Represents the context of the Memory Revision. The context may include context from both the historical revisions and the extracted content.""", + ) class MemoryRevisionDict(TypedDict, total=False): @@ -13307,6 +13326,9 @@ class MemoryRevisionDict(TypedDict, total=False): structured_data: Optional[dict[str, Any]] """Output only. Represents the structured value of the memory at the time of revision creation.""" + context: Optional[str] + """Output only. Represents the context of the Memory Revision. The context may include context from both the historical revisions and the extracted content.""" + MemoryRevisionOrDict = Union[MemoryRevision, MemoryRevisionDict] @@ -16564,13 +16586,13 @@ class SandboxEnvironmentSpecComputerUseEnvironmentDict(TypedDict, total=False): class SandboxEnvironmentSpecShellEnvironment(_common.BaseModel): - """The shell environment with customized settings.""" + """The shell environment.""" pass class SandboxEnvironmentSpecShellEnvironmentDict(TypedDict, total=False): - """The shell environment with customized settings.""" + """The shell environment.""" pass @@ -16590,7 +16612,12 @@ class SandboxEnvironmentSpec(_common.BaseModel): Field(default=None, description="""Optional. The computer use environment.""") ) shell_environment: Optional[SandboxEnvironmentSpecShellEnvironment] = Field( - default=None, description="""Optional. The shell environment.""" + default=None, + description="""Optional. The shell environment for executing shell commands and scripts.""", + ) + use_gke_td: Optional[bool] = Field( + default=None, + description="""Optional. Immutable. Whether to provision the SandboxEnvironment via the GKE TD pool. Immutable.""", ) @@ -16606,7 +16633,10 @@ class SandboxEnvironmentSpecDict(TypedDict, total=False): """Optional. The computer use environment.""" shell_environment: Optional[SandboxEnvironmentSpecShellEnvironmentDict] - """Optional. The shell environment.""" + """Optional. The shell environment for executing shell commands and scripts.""" + + use_gke_td: Optional[bool] + """Optional. Immutable. Whether to provision the SandboxEnvironment via the GKE TD pool. Immutable.""" SandboxEnvironmentSpecOrDict = Union[SandboxEnvironmentSpec, SandboxEnvironmentSpecDict] @@ -17551,11 +17581,11 @@ class SandboxEnvironmentTemplateEgressControlConfigDnsPeeringConfig(_common.Base ) target_network: Optional[str] = Field( default=None, - description="""Required. The VPC network name in the target_project where the DNS zone specified by 'domain' is visible.""", + description="""Required. The VPC network name in the target_project where the DNS zone specified by `domain` is visible.""", ) target_project: Optional[str] = Field( default=None, - description="""Required. The project ID hosting the Cloud DNS managed zone that contains the 'domain'. The Vertex AI Service Agent requires the dns.peer role on this project.""", + description="""Required. The project ID hosting the Cloud DNS managed zone that contains the `domain`. The Vertex AI Service Agent requires the dns.peer role on this project.""", ) @@ -17568,10 +17598,10 @@ class SandboxEnvironmentTemplateEgressControlConfigDnsPeeringConfigDict( """Required. The DNS name suffix of the zone being peered to, e.g., "my-internal-domain.corp.". Must end with a dot.""" target_network: Optional[str] - """Required. The VPC network name in the target_project where the DNS zone specified by 'domain' is visible.""" + """Required. The VPC network name in the target_project where the DNS zone specified by `domain` is visible.""" target_project: Optional[str] - """Required. The project ID hosting the Cloud DNS managed zone that contains the 'domain'. The Vertex AI Service Agent requires the dns.peer role on this project.""" + """Required. The project ID hosting the Cloud DNS managed zone that contains the `domain`. The Vertex AI Service Agent requires the dns.peer role on this project.""" SandboxEnvironmentTemplateEgressControlConfigDnsPeeringConfigOrDict = Union[ @@ -17586,10 +17616,6 @@ class SandboxEnvironmentTemplateEgressControlConfig(_common.BaseModel): internet_access: Optional[bool] = Field( default=None, description="""Optional. Whether to allow internet access.""" ) - customer_vpc_network: Optional[str] = Field( - default=None, - description="""Optional. The customer VPC network that sandbox egress is routed into.""", - ) dns_peering_configs: Optional[ list[SandboxEnvironmentTemplateEgressControlConfigDnsPeeringConfig] ] = Field( @@ -17598,7 +17624,7 @@ class SandboxEnvironmentTemplateEgressControlConfig(_common.BaseModel): ) network_attachment: Optional[str] = Field( default=None, - description="""Optional. The name of the customer VPC NetworkAttachment used to draw a PSC interface IP into the customer VPC for sandbox egress.""", + description="""Optional. The name of the customer VPC `NetworkAttachment` used to draw a PSC interface IP into the customer VPC for sandbox egress.""", ) @@ -17608,16 +17634,13 @@ class SandboxEnvironmentTemplateEgressControlConfigDict(TypedDict, total=False): internet_access: Optional[bool] """Optional. Whether to allow internet access.""" - customer_vpc_network: Optional[str] - """Optional. The customer VPC network that sandbox egress is routed into.""" - dns_peering_configs: Optional[ list[SandboxEnvironmentTemplateEgressControlConfigDnsPeeringConfigDict] ] """Optional. DNS peering configurations that allow sandbox egress to resolve customer-internal domains via the customer VPC.""" network_attachment: Optional[str] - """Optional. The name of the customer VPC NetworkAttachment used to draw a PSC interface IP into the customer VPC for sandbox egress.""" + """Optional. The name of the customer VPC `NetworkAttachment` used to draw a PSC interface IP into the customer VPC for sandbox egress.""" SandboxEnvironmentTemplateEgressControlConfigOrDict = Union[ @@ -17873,6 +17896,10 @@ class SandboxEnvironmentTemplate(_common.BaseModel): default=None, description="""Optional. The configuration for private ingress (PSC-E) of this template. When set, the sandbox router is exposed privately via a PSC service attachment so VPC-SC customers can connect from their VPC over a private endpoint instead of the public internet. The resulting service attachment is surfaced on `SandboxEnvironment.connection_info.service_attachment`. Only the PSC-E (service-attachment/ingress) portion of `PrivateServiceConnectConfig` applies here: `enable_private_service_connect` and `project_allowlist` (the consumer projects allowed to connect). The nested `psc_interface_config` (PSC-I / egress) is not used for sandbox ingress; sandbox egress is configured via `egress_control_config` instead.""", ) + use_gke_td: Optional[bool] = Field( + default=None, + description="""Optional. Immutable. Whether to provision the SandboxEnvironmentTemplate via the GKE TD pool.""", + ) class SandboxEnvironmentTemplateDict(TypedDict, total=False): @@ -17909,6 +17936,9 @@ class SandboxEnvironmentTemplateDict(TypedDict, total=False): ingress_control_config: Optional[PrivateServiceConnectConfigDict] """Optional. The configuration for private ingress (PSC-E) of this template. When set, the sandbox router is exposed privately via a PSC service attachment so VPC-SC customers can connect from their VPC over a private endpoint instead of the public internet. The resulting service attachment is surfaced on `SandboxEnvironment.connection_info.service_attachment`. Only the PSC-E (service-attachment/ingress) portion of `PrivateServiceConnectConfig` applies here: `enable_private_service_connect` and `project_allowlist` (the consumer projects allowed to connect). The nested `psc_interface_config` (PSC-I / egress) is not used for sandbox ingress; sandbox egress is configured via `egress_control_config` instead.""" + use_gke_td: Optional[bool] + """Optional. Immutable. Whether to provision the SandboxEnvironmentTemplate via the GKE TD pool.""" + SandboxEnvironmentTemplateOrDict = Union[ SandboxEnvironmentTemplate, SandboxEnvironmentTemplateDict @@ -18340,6 +18370,10 @@ class SandboxEnvironmentSnapshot(_common.BaseModel): default=None, description="""Output only. The timestamp when this SandboxEnvironment was most recently updated.""", ) + use_gke_td: Optional[bool] = Field( + default=None, + description="""Output only. Whether the source SandboxEnvironment uses the GKE TD pool.""", + ) class SandboxEnvironmentSnapshotDict(TypedDict, total=False): @@ -18379,6 +18413,9 @@ class SandboxEnvironmentSnapshotDict(TypedDict, total=False): update_time: Optional[datetime.datetime] """Output only. The timestamp when this SandboxEnvironment was most recently updated.""" + use_gke_td: Optional[bool] + """Output only. Whether the source SandboxEnvironment uses the GKE TD pool.""" + SandboxEnvironmentSnapshotOrDict = Union[ SandboxEnvironmentSnapshot, SandboxEnvironmentSnapshotDict @@ -20965,6 +21002,10 @@ class SchemaPromptSpecAppBuilderData(_common.BaseModel): description="""Linked resources attached to the application by the user.""", ) ) + deployed_regions: Optional[list[str]] = Field( + default=None, + description="""Optional. The Cloud Run regions in which the application is currently deployed. Used to rediscover and redeploy the app in the regions it already runs in, which may differ from the prompt's location.""", + ) class SchemaPromptSpecAppBuilderDataDict(TypedDict, total=False): @@ -20979,6 +21020,9 @@ class SchemaPromptSpecAppBuilderDataDict(TypedDict, total=False): linked_resources: Optional[list[SchemaPromptSpecAppBuilderDataLinkedResourceDict]] """Linked resources attached to the application by the user.""" + deployed_regions: Optional[list[str]] + """Optional. The Cloud Run regions in which the application is currently deployed. Used to rediscover and redeploy the app in the regions it already runs in, which may differ from the prompt's location.""" + SchemaPromptSpecAppBuilderDataOrDict = Union[ SchemaPromptSpecAppBuilderData, SchemaPromptSpecAppBuilderDataDict @@ -28666,11 +28710,11 @@ class AudioTranscriptionWordInfoDict(TypedDict, total=False): class AudioTranscription(_common.BaseModel): - """The transcription of an audio part. For multi-speaker audio, each speaker segment is a separate Part with its own AudioTranscription carrying the speaker_label.""" + """The transcription of an audio part. For multi-speaker audio, each speaker segment is a separate `Part` with its own `AudioTranscription` carrying the `speaker_label`.""" speaker_label: Optional[str] = Field( default=None, - description="""Optional. A label identifying the speaker of this audio segment (e.g. "spk_1", "spk_2"). Present when diarization is set.""", + description="""Optional. A label identifying the speaker of this audio segment (e.g. `spk_1`, `spk_2`). Present when `diarization` is set.""", ) text: Optional[str] = Field( default=None, @@ -28678,21 +28722,21 @@ class AudioTranscription(_common.BaseModel): ) words: Optional[list[AudioTranscriptionWordInfo]] = Field( default=None, - description="""Optional. Detailed word-level transcriptions and timing details. Present when word_timestamp is set.""", + description="""Optional. Detailed word-level transcriptions and timing details. Present when `word_timestamp` is set.""", ) class AudioTranscriptionDict(TypedDict, total=False): - """The transcription of an audio part. For multi-speaker audio, each speaker segment is a separate Part with its own AudioTranscription carrying the speaker_label.""" + """The transcription of an audio part. For multi-speaker audio, each speaker segment is a separate `Part` with its own `AudioTranscription` carrying the `speaker_label`.""" speaker_label: Optional[str] - """Optional. A label identifying the speaker of this audio segment (e.g. "spk_1", "spk_2"). Present when diarization is set.""" + """Optional. A label identifying the speaker of this audio segment (e.g. `spk_1`, `spk_2`). Present when `diarization` is set.""" text: Optional[str] """Required. The transcription text of this audio segment.""" words: Optional[list[AudioTranscriptionWordInfoDict]] - """Optional. Detailed word-level transcriptions and timing details. Present when word_timestamp is set.""" + """Optional. Detailed word-level transcriptions and timing details. Present when `word_timestamp` is set.""" AudioTranscriptionOrDict = Union[AudioTranscription, AudioTranscriptionDict]