Skip to content

Presence of .env file causes errors in adk deploy agent_engine #1185

Closed
@andrewlarimer

Description

@andrewlarimer

Describe the bug

adk deploy agent_engine forces you to add arguments for project and region even when they are present in an agent's .env file, but then returns an error due to those env variables being reserved, forcing you to remove them from the .env file (where they serve a good purpose for dev and testing).

To Reproduce
Steps to reproduce the behavior:

  1. Create an agent with a .env file that includes GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION (so also GOOGLE_GENAI_USE_VERTEXAI=TRUE).
  2. try to deploy with just adk deploy agent_engine --staging_bucket=gs://YOUR_BUCKET path/to/agent to see that it does not respect the values already present in the .env file
  3. deploy with providing those values with:
adk deploy agent_engine --project=YOUR_PROJECT_ID --region=us-central1 --staging_bucket=gs://YOUR_BUCKET path/to/agent
  1. See errors that the GOOGLE_CLOUD_PROJECT and then GOOGLE_CLOUD_LOCATION are reserved:
Deploy failed: 400 Environment variable name 'GOOGLE_CLOUD_PROJECT' is reserved. Please rename the variable in `spec.deployment_spec.env`.

Expected behavior
Ideally you wouldn't need to provide the --project and --region flags if those env values are set in the .env file of the agent.

However if it has been decided that you must provide those values, then if there is no conflict between the provided values and the values in the .env file, you should be able to keep them in your .env file (as they are useful for testing, development, etc.)

Metadata

Metadata

Assignees

Labels

coreIssues related to the core interface and implementation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions