From bf9e0ffbdb9d4c08817cb54d46f6b22f968f077d Mon Sep 17 00:00:00 2001 From: A Vertex SDK engineer Date: Tue, 17 Feb 2026 12:50:02 -0800 Subject: [PATCH] feat: GenAI SDK client - Make operation polling interval configurable when creating agent engine sandbox PiperOrigin-RevId: 871452484 --- .../genai/replays/test_create_agent_engine_sandbox.py | 1 + vertexai/_genai/sandboxes.py | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/unit/vertexai/genai/replays/test_create_agent_engine_sandbox.py b/tests/unit/vertexai/genai/replays/test_create_agent_engine_sandbox.py index 39124d9775..70c3e73269 100644 --- a/tests/unit/vertexai/genai/replays/test_create_agent_engine_sandbox.py +++ b/tests/unit/vertexai/genai/replays/test_create_agent_engine_sandbox.py @@ -25,6 +25,7 @@ def test_create_sandbox(client): operation = client.agent_engines.sandboxes.create( name=agent_engine.api_resource.name, + poll_interval_seconds=1, spec={ "code_execution_environment": { "machineConfig": "MACHINE_CONFIG_VCPU4_RAM4GIB" diff --git a/vertexai/_genai/sandboxes.py b/vertexai/_genai/sandboxes.py index c88be4e269..d4f8db5497 100644 --- a/vertexai/_genai/sandboxes.py +++ b/vertexai/_genai/sandboxes.py @@ -540,6 +540,7 @@ def create( self, *, name: str, + poll_interval_seconds: float = 0.1, spec: Optional[types.SandboxEnvironmentSpecOrDict] = None, config: Optional[types.CreateAgentEngineSandboxConfigOrDict] = None, ) -> types.AgentEngineSandboxOperation: @@ -549,6 +550,9 @@ def create( name (str): Required. The name of the agent engine to create sandbox for. projects/{project}/locations/{location}/reasoningEngines/{resource_id} + poll_interval_seconds (float): + Optional. The interval in seconds to poll for sandbox creation + completion. spec (SandboxEnvironmentSpec): Optional. The specification for the sandbox to create. config (CreateAgentEngineSandboxConfigOrDict): @@ -582,7 +586,7 @@ def create( operation = _agent_engines_utils._await_operation( operation_name=operation.name, get_operation_fn=self._get_sandbox_operation, - poll_interval_seconds=0.1, + poll_interval_seconds=poll_interval_seconds, ) # We need to make a call to get the sandbox because the operation # response might not contain the relevant fields.