Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions agentplatform/_genai/runtimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1913,6 +1913,7 @@ def create(
build_config=config.build_config,
)
operation = self._create(config=api_config)
logger.info(f"Create Agent Runtime backing LRO: {operation.name}")
reasoning_engine_id = _runtimes_utils._get_reasoning_engine_id(
operation_name=operation.name
)
Expand Down Expand Up @@ -1943,7 +1944,9 @@ def create(
f"runtime=client.runtimes.get(name='{runtime.api_resource.name}')"
)
elif operation.error:
raise RuntimeError(f"Failed to create Agent Runtime: {operation.error}")
raise RuntimeError(
f"Operation {operation.name} failed to create Agent Runtime: {operation.error}"
)
else:
logger.warning("The operation returned an empty response.")
if not self._is_lightweight_creation(agent, config):
Expand Down Expand Up @@ -2719,6 +2722,7 @@ def update(
build_config=config.build_config,
)
operation = self._update(name=name, config=api_config)
logger.info(f"Update Agent Runtime backing LRO: {operation.name}")
reasoning_engine_id = _runtimes_utils._get_reasoning_engine_id(
resource_name=name
)
Expand All @@ -2743,7 +2747,9 @@ def update(
f"runtime=client.runtimes.get(name='{runtime.api_resource.name}')"
)
elif operation.error:
raise RuntimeError(f"Failed to update Agent Runtime: {operation.error}")
raise RuntimeError(
f"Operation {operation.name} failed to update Agent Runtime: {operation.error}"
)
if runtime.api_resource.spec:
self._register_api_methods(runtime=runtime)
return runtime # type: ignore[no-any-return]
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/agentplatform/genai/test_agent_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -4167,7 +4167,7 @@ def test_create_runtime_error(
env_vars=_TEST_AGENT_ENGINE_ENV_VARS_INPUT,
),
)
assert "Failed to create agent engine" in str(excinfo.value)
assert "failed to create Agent Runtime" in str(excinfo.value)

@mock.patch.object(_runtimes_utils, "_await_operation")
def test_update_runtime_description(self, mock_await_operation):
Expand All @@ -4185,7 +4185,7 @@ def test_update_runtime_description(self, mock_await_operation):
description=_TEST_AGENT_ENGINE_DESCRIPTION,
),
)
assert "Failed to update agent engine" in str(excinfo.value)
assert "failed to update Agent Runtime" in str(excinfo.value)

@pytest.mark.parametrize(
"test_case_name, test_operation_schemas, want_log_output",
Expand Down
10 changes: 8 additions & 2 deletions vertexai/_genai/agent_engines.py
Original file line number Diff line number Diff line change
Expand Up @@ -2008,6 +2008,7 @@ def create(
build_config=config.build_config,
)
operation = self._create(config=api_config)
logger.info(f"Create Agent Engine backing LRO: {operation.name}")
reasoning_engine_id = _agent_engines_utils._get_reasoning_engine_id(
operation_name=operation.name
)
Expand Down Expand Up @@ -2038,7 +2039,9 @@ def create(
f"agent_engine=client.agent_engines.get(name='{agent_engine.api_resource.name}')"
)
elif operation.error:
raise RuntimeError(f"Failed to create Agent Engine: {operation.error}")
raise RuntimeError(
f"Operation {operation.name} failed to create Agent Engine: {operation.error}"
)
else:
logger.warning("The operation returned an empty response.")
if not self._is_lightweight_creation(agent, config):
Expand Down Expand Up @@ -2820,6 +2823,7 @@ def update(
build_config=config.build_config,
)
operation = self._update(name=name, config=api_config)
logger.info(f"Update Agent Engine backing LRO: {operation.name}")
reasoning_engine_id = _agent_engines_utils._get_reasoning_engine_id(
resource_name=name
)
Expand All @@ -2844,7 +2848,9 @@ def update(
f"agent_engine=client.agent_engines.get(name='{agent_engine.api_resource.name}')"
)
elif operation.error:
raise RuntimeError(f"Failed to update Agent Engine: {operation.error}")
raise RuntimeError(
f"Operation {operation.name} failed to update Agent Engine: {operation.error}"
)
if agent_engine.api_resource.spec:
self._register_api_methods(agent_engine=agent_engine)
return agent_engine # type: ignore[no-any-return]
Expand Down
Loading