-
Notifications
You must be signed in to change notification settings - Fork 390
Description
Environment details
- n2-standard-8
- Python version: 3.11.13
- pip version: 25.2
google-cloud-aiplatform
version: 1.110.0
Steps to reproduce
I followed the instructions at https://github.com/google/adk-samples/tree/main/python/agents/personalized-shopping
and then tried to deploy the agent. When attempting to deploy, I see
google.api_core.exceptions.InvalidArgument: 400 Reasoning Engine resource [projects/255909145646/locations/us-central1/reasoningEngines/7620517180022456320] failed to start and cannot serve traffic. Please refer to our documentation (https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/troubleshooting/deploy) for checking logs and other troubleshooting tips. 3: Reasoning Engine resource [projects/255909145646/locations/us-central1/reasoningEngines/7620517180022456320] failed to start and cannot serve traffic. Please refer to our documentation (https://cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/troubleshooting/deploy) for checking logs and other troubleshooting tips.
My organisation does not use VPC-SC.
Code example
# Copyright 2025 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import vertexai
from vertexai.preview.reasoning_engines import AdkApp
from vertexai import agent_engines
from dotenv import load_dotenv
import os
# Import the polling object to modify the timeout
from google.api_core.future import polling
from personalized_shopping.agent import root_agent
load_dotenv()
cloud_project = os.getenv("GOOGLE_CLOUD_PROJECT")
cloud_location = os.getenv("GOOGLE_CLOUD_LOCATION")
storage_bucket = os.getenv("GOOGLE_CLOUD_STORAGE_BUCKET")
print(f"cloud_project={cloud_project}")
print(f"cloud_location={cloud_location}")
print(f"storage_bucket={storage_bucket}")
vertexai.init(
project=cloud_project,
location=cloud_location,
staging_bucket=f"gs://{storage_bucket}",
)
print("-" * 50)
print("Deploying app begin...")
app = AdkApp(
agent=root_agent,
enable_tracing=True,
)
AGENT_WHL_FILE = "./personalized_shopping-0.1.0-py3-none-any.whl"
print("Deploying agent to agent engine...")
remote_app = agent_engines.create(
app,
requirements=[
AGENT_WHL_FILE,
],
extra_packages=[
AGENT_WHL_FILE,
],
)
print("Deploying agent to agent engine finished.")
print("-" * 50)
print("Testing deployment:")
# Note: The following test might not work immediately as the endpoint needs time to initialize.
try:
session = remote_app.create_session(user_id="123")
for event in remote_app.stream_query(
user_id="123",
session_id=session["id"],
message="Hello!",
):
print(event)
print("Testing deployment finished!")
except Exception as e:
print(f"Testing failed. The endpoint might still be initializing. Error: {e}")
print("-" * 50)
Could it be related to a timeout? The model is large.