feat: Add an option to use gcs artifact service in adk web.

Resolves https://github.com/google/adk-python/issues/309

PiperOrigin-RevId: 765772763
This commit is contained in:
Shangjie Chen
2025-06-01 00:28:49 -07:00
committed by Copybara-Service
parent 0e72efb439
commit 8d36dbda52
4 changed files with 49 additions and 5 deletions
+24
View File
@@ -430,6 +430,15 @@ def fast_api_common_options():
- See https://docs.sqlalchemy.org/en/20/core/engines.html#backend-specific-urls for more details on supported DB URLs."""
),
)
@click.option(
"--artifact_storage_uri",
type=str,
help=(
"Optional. The artifact storage URI to store the artifacts,"
" supported URIs: gs://<bucket name> for GCS artifact service."
),
default=None,
)
@click.option(
"--host",
type=str,
@@ -490,6 +499,7 @@ def fast_api_common_options():
def cli_web(
agents_dir: str,
session_db_url: str = "",
artifact_storage_uri: Optional[str] = None,
log_level: str = "INFO",
allow_origins: Optional[list[str]] = None,
host: str = "127.0.0.1",
@@ -533,6 +543,7 @@ def cli_web(
app = get_fast_api_app(
agents_dir=agents_dir,
session_db_url=session_db_url,
artifact_storage_uri=artifact_storage_uri,
allow_origins=allow_origins,
web=True,
trace_to_cloud=trace_to_cloud,
@@ -563,6 +574,7 @@ def cli_web(
def cli_api_server(
agents_dir: str,
session_db_url: str = "",
artifact_storage_uri: Optional[str] = None,
log_level: str = "INFO",
allow_origins: Optional[list[str]] = None,
host: str = "127.0.0.1",
@@ -585,6 +597,7 @@ def cli_api_server(
get_fast_api_app(
agents_dir=agents_dir,
session_db_url=session_db_url,
artifact_storage_uri=artifact_storage_uri,
allow_origins=allow_origins,
web=False,
trace_to_cloud=trace_to_cloud,
@@ -688,6 +701,15 @@ def cli_api_server(
- See https://docs.sqlalchemy.org/en/20/core/engines.html#backend-specific-urls for more details on supported DB URLs."""
),
)
@click.option(
"--artifact_storage_uri",
type=str,
help=(
"Optional. The artifact storage URI to store the artifacts, supported"
" URIs: gs://<bucket name> for GCS artifact service."
),
default=None,
)
@click.argument(
"agent",
type=click.Path(
@@ -716,6 +738,7 @@ def cli_deploy_cloud_run(
with_ui: bool,
verbosity: str,
session_db_url: str,
artifact_storage_uri: Optional[str],
adk_version: str,
):
"""Deploys an agent to Cloud Run.
@@ -739,6 +762,7 @@ def cli_deploy_cloud_run(
with_ui=with_ui,
verbosity=verbosity,
session_db_url=session_db_url,
artifact_storage_uri=artifact_storage_uri,
adk_version=adk_version,
)
except Exception as e: