Skip to content

Commit ad5b2bb

Browse files
shawn-yang-googlecopybara-github
authored andcommitted
chore: Reduce polling interval for lightweight agent engine creation.
PiperOrigin-RevId: 778200996
1 parent 9ca9545 commit ad5b2bb

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

tests/unit/vertexai/genai/test_agent_engines.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,10 @@ def test_create_agent_engine(self, mock_await_operation, mock_prepare):
983983
env_vars=_TEST_AGENT_ENGINE_ENV_VARS_INPUT,
984984
),
985985
)
986+
mock_await_operation.assert_called_once_with(
987+
operation_name=None,
988+
poll_interval_seconds=10,
989+
)
986990
request_mock.assert_called_with(
987991
"post",
988992
"reasoningEngines",
@@ -1023,6 +1027,10 @@ def test_create_agent_engine_lightweight(
10231027
description=_TEST_AGENT_ENGINE_DESCRIPTION,
10241028
)
10251029
)
1030+
mock_await_operation.assert_called_once_with(
1031+
operation_name=None,
1032+
poll_interval_seconds=1,
1033+
)
10261034
request_mock.assert_called_with(
10271035
"post",
10281036
"reasoningEngines",

vertexai/_genai/agent_engines.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1988,7 +1988,15 @@ def create(
19881988
env_vars=config.env_vars,
19891989
)
19901990
operation = self._create(config=api_config)
1991-
operation = self._await_operation(operation_name=operation.name)
1991+
if agent_engine is None:
1992+
poll_interval_seconds = 1 # Lightweight agent engine resource creation.
1993+
else:
1994+
poll_interval_seconds = 10
1995+
operation = self._await_operation(
1996+
operation_name=operation.name,
1997+
poll_interval_seconds=poll_interval_seconds,
1998+
)
1999+
19922000
agent = types.AgentEngine(
19932001
api_client=self,
19942002
api_async_client=AsyncAgentEngines(api_client_=self._api_client),

0 commit comments

Comments
 (0)