Skip to content

fix: Update adk_app handling to use custom module without .py extension #2374

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
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

vinodseshadri
Copy link

@vinodseshadri vinodseshadri commented Aug 6, 2025

Pull Request Description

This pull request addresses a critical issue in the cli_deploy.py module -where in the adk_app was ignored

Issues fixed

fixes #2298

Changes done

  • Added code to check if adk_app is set and if it is then copy the py file from agent source folder instead of creating
  • Moved the hardcoded add_app to a constant so that it can be revisited later easily
  • Added test cases to ensure custom file for add_app works
  • library built and command line tested

@adk-bot adk-bot added bot triaged [Bot] This issue is triaged by ADK bot tools [Component] This issue is related to tools labels Aug 6, 2025
@adk-bot adk-bot requested a review from seanzhou1023 August 6, 2025 03:12
@adk-bot
Copy link
Collaborator

adk-bot commented Aug 6, 2025

Response from ADK Triaging Agent

Hello @vinodseshadri, thank you for creating this PR!

This PR is a bug fix, could you please provide the command line output after the fix is applied?

This information will help reviewers to review your PR more efficiently. Thanks!

@vinodseshadri
Copy link
Author

Response from ADK Triaging Agent

Hello @vinodseshadri, thank you for creating this PR!

This PR is a bug fix, could you please provide the command line output after the fix is applied?

This information will help reviewers to review your PR more efficiently. Thanks!

Here is execution with no adk_app added

adk deploy agent_engine --project=xxx --region=us-east4 --staging_bucket="gs://xxxx" --display_name="test_adk" '/Users/xxx/Code/adk-python/downloads/test_agent'
/Users/vinodseshadri/venvs/adk-quickstart/lib/python3.9/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
  warnings.warn(
/Users/vinodseshadri/venvs/adk-quickstart/lib/python3.9/site-packages/pydantic/_internal/_fields.py:198: UserWarning: Field name "config_type" in "SequentialAgent" shadows an attribute in parent "BaseAgent"
  warnings.warn(
Copying agent source code...
Copying agent source code complete.
Initializing Vertex AI...
Resolving files and dependencies...
Creating /var/folders/6j/966cqj6d24xbnzp9lfrp4_b00000gn/T/agent_engine_deploy_src/20250806_122802/test_agent/requirements.txt...
Created /var/folders/6j/966cqj6d24xbnzp9lfrp4_b00000gn/T/agent_engine_deploy_src/20250806_122802/test_agent/requirements.txt
Vertex AI initialized.
Using adk_app: agent_engine_app
Created /var/folders/6j/966cqj6d24xbnzp9lfrp4_b00000gn/T/agent_engine_deploy_src/20250806_122802/agent_engine_app.py
Files and dependencies resolved
Running `absolufy-imports /var/folders/6j/966cqj6d24xbnzp9lfrp4_b00000gn/T/agent_engine_deploy_src/20250806_122802/test_agent/__init__.py`
Running `absolufy-imports /var/folders/6j/966cqj6d24xbnzp9lfrp4_b00000gn/T/agent_engine_deploy_src/20250806_122802/test_agent/agent.py`
Deploying to agent engine...
Reading requirements from requirements='/var/folders/6j/966cqj6d24xbnzp9lfrp4_b00000gn/T/agent_engine_deploy_src/20250806_122802/test_agent/requirements.txt'
Read the following lines: ['google-cloud-aiplatform[adk,agent_engines]']
Identified the following requirements: {'cloudpickle': '3.1.1', 'pydantic': '2.11.7'}
The following requirements are missing: {'cloudpickle', 'pydantic'}
The following requirements are appended: {'cloudpickle==3.1.1', 'pydantic==2.11.7'}
The final list of requirements: ['google-cloud-aiplatform[adk,agent_engines]', 'cloudpickle==3.1.1', 'pydantic==2.11.7']
/Users/vinodseshadri/venvs/adk-quickstart/lib/python3.9/site-packages/google/auth/_default.py:76: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a "quota exceeded" or "API not enabled" error. See the following page for troubleshooting: https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds. 
  warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
/Users/vinodseshadri/venvs/adk-quickstart/lib/python3.9/site-packages/google/auth/_default.py:76: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a "quota exceeded" or "API not enabled" error. See the following page for troubleshooting: https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds. 
  warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Using bucket xxx
Wrote to gs://xxx/agent_engine/agent_engine.pkl
Writing to gs://xxx/agent_engine/requirements.txt
Creating in-memory tarfile of extra_packages
Writing to gs://xxx/agent_engine/dependencies.tar.gz
Cleaning up the temp folder: /var/folders/6j/966cqj6d24xbnzp9lfrp4_b00000gn/T/agent_engine_deploy_src/20250806_122802

Below example with a test_adk.py file in the agent folder with adk_app as test_adk.py

adk deploy agent_engine --project=xxxx --region=us-east4 --staging_bucket="gs://xxx" --display_name="test_adk" '/Users/xxx/Code/adk-python/downloads/test_agent' --adk_app test_adk
/Users/vinodseshadri/venvs/adk-quickstart/lib/python3.9/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
  warnings.warn(
/Users/vinodseshadri/venvs/adk-quickstart/lib/python3.9/site-packages/pydantic/_internal/_fields.py:198: UserWarning: Field name "config_type" in "SequentialAgent" shadows an attribute in parent "BaseAgent"
  warnings.warn(
Copying agent source code...
Copying agent source code complete.
Initializing Vertex AI...
Resolving files and dependencies...
Creating /var/folders/6j/966cqj6d24xbnzp9lfrp4_b00000gn/T/agent_engine_deploy_src/20250806_123303/test_agent/requirements.txt...
Created /var/folders/6j/966cqj6d24xbnzp9lfrp4_b00000gn/T/agent_engine_deploy_src/20250806_123303/test_agent/requirements.txt
Vertex AI initialized.
Using adk_app: test_adk
Using existing test_adk.py
Files and dependencies resolved
Running `absolufy-imports /var/folders/6j/966cqj6d24xbnzp9lfrp4_b00000gn/T/agent_engine_deploy_src/20250806_123303/test_agent/test_adk.py`
Running `absolufy-imports /var/folders/6j/966cqj6d24xbnzp9lfrp4_b00000gn/T/agent_engine_deploy_src/20250806_123303/test_agent/__init__.py`
Running `absolufy-imports /var/folders/6j/966cqj6d24xbnzp9lfrp4_b00000gn/T/agent_engine_deploy_src/20250806_123303/test_agent/agent.py`
Deploying to agent engine...
Reading requirements from requirements='/var/folders/6j/966cqj6d24xbnzp9lfrp4_b00000gn/T/agent_engine_deploy_src/20250806_123303/test_agent/requirements.txt'
Read the following lines: ['google-cloud-aiplatform[adk,agent_engines]']
Identified the following requirements: {'cloudpickle': '3.1.1', 'pydantic': '2.11.7'}
The following requirements are missing: {'cloudpickle', 'pydantic'}
The following requirements are appended: {'cloudpickle==3.1.1', 'pydantic==2.11.7'}
The final list of requirements: ['google-cloud-aiplatform[adk,agent_engines]', 'cloudpickle==3.1.1', 'pydantic==2.11.7']
/Users/vinodseshadri/venvs/adk-quickstart/lib/python3.9/site-packages/google/auth/_default.py:76: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a "quota exceeded" or "API not enabled" error. See the following page for troubleshooting: https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds. 
  warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
/Users/vinodseshadri/venvs/adk-quickstart/lib/python3.9/site-packages/google/auth/_default.py:76: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a "quota exceeded" or "API not enabled" error. See the following page for troubleshooting: https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds. 
  warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Using bucket xxx
Wrote to gs://xxx/agent_engine/agent_engine.pkl
Writing to gs://xxx/agent_engine/requirements.txt
Creating in-memory tarfile of extra_packages
Writing to gs://xxx/agent_engine/dependencies.tar.gz
/Users/vinodseshadri/venvs/adk-quickstart/lib/python3.9/site-packages/google/auth/_default.py:76: UserWarning: Your application has authenticated using end user credentials from Google Cloud SDK without a quota project. You might receive a "quota exceeded" or "API not enabled" error. See the following page for troubleshooting: https://cloud.google.com/docs/authentication/adc-troubleshooting/user-creds. 
  warnings.warn(_CLOUD_SDK_CREDENTIALS_WARNING)
Cleaning up the temp folder: /var/folders/6j/966cqj6d24xbnzp9lfrp4_b00000gn/T/agent_engine_deploy_src/20250806_123303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot triaged [Bot] This issue is triaged by ADK bot tools [Component] This issue is related to tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Agent Engine Deployment with GCSArtifact via custom adk_app.py not working as expected
2 participants