Skip to content

Commit d5d9c06

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
feat: GenAI SDK client - Make operation polling interval configurable when creating agent engine sandbox
PiperOrigin-RevId: 867762024
1 parent b57c503 commit d5d9c06

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

tests/unit/vertexai/genai/replays/test_create_agent_engine_sandbox.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ def test_create_sandbox(client):
2525

2626
operation = client.agent_engines.sandboxes.create(
2727
name=agent_engine.api_resource.name,
28+
poll_interval_seconds=1,
2829
spec={
2930
"code_execution_environment": {
3031
"machineConfig": "MACHINE_CONFIG_VCPU4_RAM4GIB"

vertexai/_genai/sandboxes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,7 @@ def create(
540540
self,
541541
*,
542542
name: str,
543+
poll_interval_seconds: float = 0.1,
543544
spec: Optional[types.SandboxEnvironmentSpecOrDict] = None,
544545
config: Optional[types.CreateAgentEngineSandboxConfigOrDict] = None,
545546
) -> types.AgentEngineSandboxOperation:
@@ -549,6 +550,9 @@ def create(
549550
name (str):
550551
Required. The name of the agent engine to create sandbox for.
551552
projects/{project}/locations/{location}/reasoningEngines/{resource_id}
553+
poll_interval_seconds (float):
554+
Optional. The interval in seconds to poll for sandbox creation
555+
completion.
552556
spec (SandboxEnvironmentSpec):
553557
Optional. The specification for the sandbox to create.
554558
config (CreateAgentEngineSandboxConfigOrDict):
@@ -582,7 +586,7 @@ def create(
582586
operation = _agent_engines_utils._await_operation(
583587
operation_name=operation.name,
584588
get_operation_fn=self._get_sandbox_operation,
585-
poll_interval_seconds=0.1,
589+
poll_interval_seconds=poll_interval_seconds,
586590
)
587591
# We need to make a call to get the sandbox because the operation
588592
# response might not contain the relevant fields.

0 commit comments

Comments
 (0)