From 4dd5434847d8e53bf09cfaa4e747c679d1d486b9 Mon Sep 17 00:00:00 2001 From: "Xiang (Sean) Zhou" Date: Fri, 9 Jan 2026 00:04:41 -0800 Subject: [PATCH 1/2] chore: Make live request queue required Co-authored-by: Xiang (Sean) Zhou PiperOrigin-RevId: 854058723 --- src/google/adk/runners.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/google/adk/runners.py b/src/google/adk/runners.py index 620477ce44..730216e0b0 100644 --- a/src/google/adk/runners.py +++ b/src/google/adk/runners.py @@ -952,6 +952,8 @@ async def run_live( raise ValueError( 'Either session or user_id and session_id must be provided.' ) + if live_request_queue is None: + raise ValueError('live_request_queue is required for run_live.') if session is not None: warnings.warn( 'The `session` parameter is deprecated. Please use `user_id` and' @@ -1380,7 +1382,7 @@ def _new_invocation_context_for_live( self, session: Session, *, - live_request_queue: Optional[LiveRequestQueue] = None, + live_request_queue: LiveRequestQueue, run_config: Optional[RunConfig] = None, ) -> InvocationContext: """Creates a new invocation context for live multi-agent.""" @@ -1388,7 +1390,7 @@ def _new_invocation_context_for_live( # For live multi-agents system, we need model's text transcription as # context for the transferred agent. - if self.agent.sub_agents and live_request_queue: + if self.agent.sub_agents: if 'AUDIO' in run_config.response_modalities: if not run_config.output_audio_transcription: run_config.output_audio_transcription = ( From 62fa4e513c30bdd084358f6a6e5738ee680deafc Mon Sep 17 00:00:00 2001 From: Wiktoria Walczak Date: Fri, 9 Jan 2026 01:42:48 -0800 Subject: [PATCH 2/2] feat(cli): add `otel_to_cloud` flag to adk deploy cloud_run and adk deploy gke command Co-authored-by: Wiktoria Walczak PiperOrigin-RevId: 854087382 --- src/google/adk/cli/cli_deploy.py | 10 +++++++++- src/google/adk/cli/cli_tools_click.py | 18 ++++++++++++++++++ tests/unittests/cli/utils/test_cli_deploy.py | 1 + .../cli/utils/test_cli_deploy_to_cloud_run.py | 5 +++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/google/adk/cli/cli_deploy.py b/src/google/adk/cli/cli_deploy.py index d36febdc98..d6ef019adc 100644 --- a/src/google/adk/cli/cli_deploy.py +++ b/src/google/adk/cli/cli_deploy.py @@ -64,7 +64,7 @@ EXPOSE {port} -CMD adk {command} --port={port} {host_option} {service_option} {trace_to_cloud_option} {allow_origins_option} {a2a_option} "/app/agents" +CMD adk {command} --port={port} {host_option} {service_option} {trace_to_cloud_option} {otel_to_cloud_option} {allow_origins_option} {a2a_option} "/app/agents" """ _AGENT_ENGINE_APP_TEMPLATE: Final[str] = """ @@ -487,6 +487,7 @@ def to_cloud_run( temp_folder: str, port: int, trace_to_cloud: bool, + otel_to_cloud: bool, with_ui: bool, log_level: str, verbosity: str, @@ -523,6 +524,8 @@ def to_cloud_run( temp_folder: The temp folder for the generated Cloud Run source files. port: The port of the ADK api server. trace_to_cloud: Whether to enable Cloud Trace. + otel_to_cloud: Whether to enable exporting OpenTelemetry signals + to Google Cloud. with_ui: Whether to deploy with UI. verbosity: The verbosity level of the CLI. adk_version: The ADK version to use in Cloud Run. @@ -580,6 +583,7 @@ def to_cloud_run( use_local_storage, ), trace_to_cloud_option='--trace_to_cloud' if trace_to_cloud else '', + otel_to_cloud_option='--otel_to_cloud' if otel_to_cloud else '', allow_origins_option=allow_origins_option, adk_version=adk_version, host_option=host_option, @@ -956,6 +960,7 @@ def to_gke( temp_folder: str, port: int, trace_to_cloud: bool, + otel_to_cloud: bool, with_ui: bool, log_level: str, adk_version: str, @@ -981,6 +986,8 @@ def to_gke( Dockerfile and deployment.yaml. port: The port of the ADK api server. trace_to_cloud: Whether to enable Cloud Trace. + otel_to_cloud: Whether to enable exporting OpenTelemetry signals + to Google Cloud. with_ui: Whether to deploy with UI. log_level: The logging level. adk_version: The ADK version to use in GKE. @@ -1051,6 +1058,7 @@ def to_gke( use_local_storage, ), trace_to_cloud_option='--trace_to_cloud' if trace_to_cloud else '', + otel_to_cloud_option='--otel_to_cloud' if otel_to_cloud else '', allow_origins_option=allow_origins_option, adk_version=adk_version, host_option=host_option, diff --git a/src/google/adk/cli/cli_tools_click.py b/src/google/adk/cli/cli_tools_click.py index b974dad753..fdc83b1557 100644 --- a/src/google/adk/cli/cli_tools_click.py +++ b/src/google/adk/cli/cli_tools_click.py @@ -1370,6 +1370,13 @@ def cli_api_server( default=False, help="Optional. Whether to enable Cloud Trace for cloud run.", ) +@click.option( + "--otel_to_cloud", + is_flag=True, + show_default=True, + default=False, + help="Optional. Whether to enable OpenTelemetry for Agent Engine.", +) @click.option( "--with_ui", is_flag=True, @@ -1450,6 +1457,7 @@ def cli_deploy_cloud_run( temp_folder: str, port: int, trace_to_cloud: bool, + otel_to_cloud: bool, with_ui: bool, adk_version: str, log_level: str, @@ -1528,6 +1536,7 @@ def cli_deploy_cloud_run( temp_folder=temp_folder, port=port, trace_to_cloud=trace_to_cloud, + otel_to_cloud=otel_to_cloud, allow_origins=allow_origins, with_ui=with_ui, log_level=log_level, @@ -1799,6 +1808,13 @@ def cli_deploy_agent_engine( default=False, help="Optional. Whether to enable Cloud Trace for GKE.", ) +@click.option( + "--otel_to_cloud", + is_flag=True, + show_default=True, + default=False, + help="Optional. Whether to enable OpenTelemetry for GKE.", +) @click.option( "--with_ui", is_flag=True, @@ -1855,6 +1871,7 @@ def cli_deploy_gke( temp_folder: str, port: int, trace_to_cloud: bool, + otel_to_cloud: bool, with_ui: bool, adk_version: str, log_level: Optional[str] = None, @@ -1884,6 +1901,7 @@ def cli_deploy_gke( temp_folder=temp_folder, port=port, trace_to_cloud=trace_to_cloud, + otel_to_cloud=otel_to_cloud, with_ui=with_ui, log_level=log_level, adk_version=adk_version, diff --git a/tests/unittests/cli/utils/test_cli_deploy.py b/tests/unittests/cli/utils/test_cli_deploy.py index 7dd6d263a9..9a2ebcfac2 100644 --- a/tests/unittests/cli/utils/test_cli_deploy.py +++ b/tests/unittests/cli/utils/test_cli_deploy.py @@ -262,6 +262,7 @@ def mock_subprocess_run(*args, **kwargs): temp_folder=str(tmp_path), port=9090, trace_to_cloud=False, + otel_to_cloud=False, with_ui=True, log_level="debug", adk_version="1.2.0", diff --git a/tests/unittests/cli/utils/test_cli_deploy_to_cloud_run.py b/tests/unittests/cli/utils/test_cli_deploy_to_cloud_run.py index 17e91e988f..51367d2b84 100644 --- a/tests/unittests/cli/utils/test_cli_deploy_to_cloud_run.py +++ b/tests/unittests/cli/utils/test_cli_deploy_to_cloud_run.py @@ -122,6 +122,7 @@ def test_to_cloud_run_happy_path( temp_folder=str(tmp_path), port=8080, trace_to_cloud=True, + otel_to_cloud=True, with_ui=with_ui, log_level="info", verbosity="info", @@ -154,6 +155,7 @@ def test_to_cloud_run_happy_path( assert "ENV GOOGLE_CLOUD_LOCATION=asia-northeast1" in dockerfile_content assert "RUN pip install google-adk==1.3.0" in dockerfile_content assert "--trace_to_cloud" in dockerfile_content + assert "--otel_to_cloud" in dockerfile_content # Check agent dependencies installation based on include_requirements if include_requirements: @@ -220,6 +222,7 @@ def _fake_rmtree(path: str | Path, *_a: Any, **_k: Any) -> None: temp_folder=str(tmp_dir), port=8080, trace_to_cloud=False, + otel_to_cloud=False, with_ui=False, log_level="info", verbosity="info", @@ -258,6 +261,7 @@ def test_to_cloud_run_cleans_temp_dir_on_failure( temp_folder=str(tmp_dir), port=8080, trace_to_cloud=False, + otel_to_cloud=False, with_ui=False, log_level="info", verbosity="info", @@ -326,6 +330,7 @@ def test_cloud_run_label_merging( temp_folder=str(tmp_path), port=8080, trace_to_cloud=False, + otel_to_cloud=False, with_ui=False, log_level="info", verbosity="info",