Skip to content

Commit d2ebacb

Browse files
yeesiancopybara-github
authored andcommitted
fix: add a2a as a required dependency for agent_engine deployment
Co-authored-by: Yeesian Ng <ysian@google.com> PiperOrigin-RevId: 930046871
1 parent 1f2e59b commit d2ebacb

3 files changed

Lines changed: 6 additions & 9 deletions

File tree

src/google/adk/cli/cli_deploy.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@
3535
_IS_WINDOWS = os.name == 'nt'
3636
_GCLOUD_CMD = 'gcloud.cmd' if _IS_WINDOWS else 'gcloud'
3737
_LOCAL_STORAGE_FLAG_MIN_VERSION: Final[str] = '1.21.0'
38-
_AGENT_ENGINE_REQUIREMENT: Final[str] = (
39-
'google-cloud-aiplatform[adk,agent_engines]'
40-
)
4138

4239

4340
def _ensure_agent_engine_dependency(requirements_txt_path: str) -> None:
@@ -64,7 +61,7 @@ def _ensure_agent_engine_dependency(requirements_txt_path: str) -> None:
6461
if requirements and not requirements.endswith('\n'):
6562
f.write('\n')
6663
f.write('google-cloud-aiplatform[agent_engines]\n')
67-
f.write(f'google-adk=={__version__}\n')
64+
f.write(f'google-adk[a2a]=={__version__}\n')
6865

6966

7067
_DOCKERFILE_TEMPLATE: Final[str] = """
@@ -87,7 +84,7 @@ def _ensure_agent_engine_dependency(requirements_txt_path: str) -> None:
8784
# Set up environment variables - End
8885
8986
# Install ADK - Start
90-
RUN pip install google-adk=={adk_version}
87+
RUN pip install "google-adk[a2a]=={adk_version}"
9188
# Install ADK - End
9289
9390
# Copy agent - Start
@@ -1017,8 +1014,8 @@ def to_agent_engine(
10171014
click.echo(f'Creating {requirements_txt_path}...')
10181015
with open(requirements_txt_path, 'w', encoding='utf-8') as f:
10191016
f.write('google-cloud-aiplatform[agent_engines]\n')
1020-
f.write(f'google-adk=={__version__}\n')
1021-
click.echo(f'Using google-adk=={__version__} in requirements')
1017+
f.write(f'google-adk[a2a]=={__version__}\n')
1018+
click.echo(f'Using google-adk[a2a]=={__version__} in requirements')
10221019
click.echo(f'Created {requirements_txt_path}')
10231020
_ensure_agent_engine_dependency(requirements_txt_path)
10241021

tests/unittests/cli/utils/test_cli_deploy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ def mock_subprocess_run(*args, **kwargs):
379379
assert dockerfile_path.is_file()
380380
dockerfile_content = dockerfile_path.read_text()
381381
assert "CMD adk api_server --with_ui --port=9090" in dockerfile_content
382-
assert "RUN pip install google-adk==1.2.0" in dockerfile_content
382+
assert 'RUN pip install "google-adk[a2a]==1.2.0"' in dockerfile_content
383383

384384
assert len(run_recorder.calls) == 3, "Expected 3 subprocess calls"
385385

tests/unittests/cli/utils/test_cli_deploy_to_cloud_run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def test_to_cloud_run_happy_path(
152152
assert "USER myuser" in dockerfile_content
153153
assert "ENV GOOGLE_CLOUD_PROJECT=proj" in dockerfile_content
154154
assert "ENV GOOGLE_CLOUD_LOCATION=asia-northeast1" in dockerfile_content
155-
assert "RUN pip install google-adk==1.3.0" in dockerfile_content
155+
assert 'RUN pip install "google-adk[a2a]==1.3.0"' in dockerfile_content
156156
assert "--trace_to_cloud" in dockerfile_content
157157
assert "--otel_to_cloud" in dockerfile_content
158158

0 commit comments

Comments
 (0)