Skip to content

feat: Add --extra_packages option to adk deploy agent_engine #2536

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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/google/adk/cli/cli_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ def to_agent_engine(
description: Optional[str] = None,
requirements_file: Optional[str] = None,
env_file: Optional[str] = None,
extra_packages: Optional[list[str]] = None,
):
"""Deploys an agent to Vertex AI Agent Engine.

Expand Down Expand Up @@ -306,6 +307,8 @@ def to_agent_engine(
If not specified, the `.env` file in the `agent_folder` will be used. The
values of `GOOGLE_CLOUD_PROJECT` and `GOOGLE_CLOUD_LOCATION` will be
overridden by `project` and `region` if they are specified.
extra_packages (list[str]): Any additional packages to install. Default is
None.
"""
app_name = os.path.basename(agent_folder)
agent_src_path = os.path.join(temp_folder, app_name)
Expand Down Expand Up @@ -435,13 +438,18 @@ def to_agent_engine(
sys_paths=[temp_folder[1:]],
agent_framework='google-adk',
)
if extra_packages:
extra_packages = list(extra_packages)
extra_packages.append(temp_folder)
else:
extra_packages = [temp_folder]
agent_config = dict(
agent_engine=agent_engine,
requirements=requirements_file,
display_name=display_name,
description=description,
env_vars=env_vars,
extra_packages=[temp_folder],
extra_packages=extra_packages,
)

if not agent_engine_id:
Expand Down
7 changes: 7 additions & 0 deletions src/google/adk/cli/cli_tools_click.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,6 +1141,11 @@ def cli_deploy_cloud_run(
" NOTE: This flag is temporary and will be removed in the future."
),
)
@click.option(
"--extra_packages",
help="Optional. Any additional packages to install.",
multiple=True,
)
@click.argument(
"agent",
type=click.Path(
Expand All @@ -1161,6 +1166,7 @@ def cli_deploy_agent_engine(
env_file: str,
requirements_file: str,
absolutize_imports: bool,
extra_packages: Optional[list[str]],
):
"""Deploys an agent to Agent Engine.

Expand All @@ -1184,6 +1190,7 @@ def cli_deploy_agent_engine(
env_file=env_file,
requirements_file=requirements_file,
absolutize_imports=absolutize_imports,
extra_packages=extra_packages,
)
except Exception as e:
click.secho(f"Deploy failed: {e}", fg="red", err=True)
Expand Down