Skip to content

vertex ai agent engine create throws an error when passing env_vars #5278

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jordi-ydteam opened this issue Apr 29, 2025 · 0 comments
Open
Labels
api: vertex-ai Issues related to the googleapis/python-aiplatform API.

Comments

@jordi-ydteam
Copy link

jordi-ydteam commented Apr 29, 2025

Environment details

  • OS type and version: Linux (Docker container with python:3.12-slim)
  • Python version: 3.12
  • pip version: 25.0.1
  • google-cloud-aiplatform version: 1.90.0

Steps to reproduce

  1. Create a basic Agent Engine
  2. Try to add environment variables using the env_vars parameter
  3. Receive a 500 error with no additional details in the logs

Code example

from google.cloud import aiplatform
from vertexai.agent_engines import Agent, AgentEngine, create
from vertexai.agent_engines import AgentLibrary

# Basic initialization
aiplatform.init(project='example-project-123456', location='europe-southwest1')

# Create a basic agent
root_agent = Agent()

# Create a library reference


# Working version (without env_vars)
remote_app = agent_engines.create(
    display_name="data_science",
    agent_engine=root_agent,
    requirements=["google-cloud-aiplatform[adk,agent_engines]"],
)

# Version that FAILS with 500 error
env_vars = {
    "GOOGLE_GENAI_USE_VERTEXAI": "1",
    "GOOGLE_CLOUD_PROJECT": "example-project-123456",
    "GOOGLE_CLOUD_LOCATION": "us-central1",
    "BQML_RAG_CORPUS_NAME": "default_corpus",
    "BQ_PROJECT_ID": "example-project-123456",
    "BQ_DATASET_ID": "cuvo_platform"
}

remote_app_with_env = agent_engines.create(
    display_name="data_science_with_env",
    agent_engine=root_agent,
    requirements=["google-cloud-aiplatform[adk,agent_engines]"],
    env_vars=env_vars
)

Stack trace

InternalServerError: 500 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. 13: 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.

Additional information

I have tried checking the logs in Google Cloud Console, but there is no useful information available about the error.

I have also tried several alternatives for the format of env_vars:

  1. using a simple dictionary (as shown above).
  2. Using a list of strings with the variable names that exist in the environment.
  3. Using SecretRef for sensitive values

Error 500 persists without providing details on the actual cause.

The documentation indicates that the env_vars parameter should accept both lists and dictionaries:

env_vars (Union[Sequence[str], Dict[str, Union[str, SecretRef]]])

But in practice, neither format seems to work properly.

@product-auto-label product-auto-label bot added the api: vertex-ai Issues related to the googleapis/python-aiplatform API. label Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: vertex-ai Issues related to the googleapis/python-aiplatform API.
Projects
None yet
Development

No branches or pull requests

1 participant