From c3591e805c11eaa31c31e584117513a3f1603e72 Mon Sep 17 00:00:00 2001 From: Google Team Member Date: Tue, 16 Jun 2026 17:51:13 -0700 Subject: [PATCH] fix: implement bidi_stream_query in AdkApp register_operations The bidi_stream_query method was documented but not implemented in the GA version of AdkApp. This change ports the bidi_stream_query method from the preview reasoning_engines template to the GA agent_engines template in both vertexai and agentplatform namespaces, and registers it in register_operations. It also adds the method schema to the deployment class methods in ADK. Close #5611 PiperOrigin-RevId: 933396959 --- src/google/adk/cli/cli_deploy.py | 12 ++++++++++++ tests/unittests/cli/utils/test_cli_deploy.py | 11 +++++++++++ 2 files changed, 23 insertions(+) diff --git a/src/google/adk/cli/cli_deploy.py b/src/google/adk/cli/cli_deploy.py index 664209b15fd..57124dcd2a4 100644 --- a/src/google/adk/cli/cli_deploy.py +++ b/src/google/adk/cli/cli_deploy.py @@ -380,6 +380,18 @@ def _ensure_agent_engine_dependency(requirements_txt_path: str) -> None: }, 'api_mode': 'async_stream', }, + { + 'name': 'bidi_stream_query', + 'description': 'Bidi streaming query the ADK application.', + 'parameters': { + 'properties': { + 'request_queue': {}, + }, + 'required': ['request_queue'], + 'type': 'object', + }, + 'api_mode': 'bidi_stream', + }, ] diff --git a/tests/unittests/cli/utils/test_cli_deploy.py b/tests/unittests/cli/utils/test_cli_deploy.py index b5e40dd5a80..abc5e57295d 100644 --- a/tests/unittests/cli/utils/test_cli_deploy.py +++ b/tests/unittests/cli/utils/test_cli_deploy.py @@ -682,3 +682,14 @@ def test_cli_deploy_agent_engine_artifact_service_uri(tmp_path: Path): mock_to_agent_engine.assert_called_once() _, kwargs = mock_to_agent_engine.call_args assert kwargs["artifact_service_uri"] == "gs://my-bucket" + + +def test_bidi_stream_query_in_class_methods(): + """Tests that bidi_stream_query is in _AGENT_ENGINE_CLASS_METHODS.""" + methods = cli_deploy._AGENT_ENGINE_CLASS_METHODS + bidi_method = next( + (m for m in methods if m["name"] == "bidi_stream_query"), None + ) + assert bidi_method is not None + assert bidi_method["api_mode"] == "bidi_stream" + assert "request_queue" in bidi_method["parameters"]["required"]