From 752e257100b4389d4bf6ba229a1cdc04b0b33e53 Mon Sep 17 00:00:00 2001 From: lllakshit Date: Sat, 29 Aug 2026 01:14:46 +0530 Subject: [PATCH] fix(a2a): advertise streaming on agent_registry agent cards agent_registry called build_agent_card without capabilities, so constructed cards advertised streaming:false. Pass an explicit AgentCapabilities(streaming=True) on that convenience path. Fixes #6778 --- .../agent_registry/agent_registry.py | 4 ++++ .../agent_registry/test_agent_registry.py | 23 +++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/google/adk/integrations/agent_registry/agent_registry.py b/src/google/adk/integrations/agent_registry/agent_registry.py index 3198493e807..abd0c0b2f62 100644 --- a/src/google/adk/integrations/agent_registry/agent_registry.py +++ b/src/google/adk/integrations/agent_registry/agent_registry.py @@ -51,6 +51,7 @@ # pylint: disable=g-import-not-at-top try: + from a2a.types import AgentCapabilities from a2a.types import AgentSkill from google.adk.a2a import _compat from google.adk.agents.remote_a2a_agent import RemoteA2aAgent @@ -666,6 +667,8 @@ def get_remote_a2a_agent( ) binding = protocol_binding or _compat.TP_HTTP_JSON + # Registry metadata has no capability details. Pass streaming explicitly so + # constructed cards do not advertise streaming:false. agent_card = _compat.build_agent_card( name=name, description=description, @@ -674,6 +677,7 @@ def get_remote_a2a_agent( protocol_binding=getattr(binding, "value", binding), protocol_version=protocol_version, skills=skills, + capabilities=AgentCapabilities(streaming=True), default_input_modes=["text"], default_output_modes=["text"], ) diff --git a/tests/unittests/integrations/agent_registry/test_agent_registry.py b/tests/unittests/integrations/agent_registry/test_agent_registry.py index b178b1b8b79..b2797bfba7e 100644 --- a/tests/unittests/integrations/agent_registry/test_agent_registry.py +++ b/tests/unittests/integrations/agent_registry/test_agent_registry.py @@ -615,6 +615,29 @@ def test_get_remote_a2a_agent_defaults(self, registry): agent._agent_card, "1.0" if _compat.IS_A2A_V1 else "0.3.0" ) + def test_get_remote_a2a_agent_advertises_streaming(self, registry): + """Constructed registry cards advertise streaming when no card is supplied.""" + mock_response = MagicMock() + mock_response.json.return_value = { + "displayName": "TestAgent", + "description": "Test Desc", + "version": "1.0", + "protocols": [{ + "type": _ProtocolType.A2A_AGENT, + "interfaces": [{ + "url": "https://my-agent.com", + }], + }], + } + mock_response.raise_for_status = MagicMock() + registry._session.get.return_value = mock_response + + registry._credentials.token = "token" + registry._credentials.refresh = MagicMock() + + agent = registry.get_remote_a2a_agent("test-agent") + assert agent._agent_card.capabilities.streaming is True + def test_get_remote_a2a_agent_with_card(self, registry): mock_response = MagicMock() mock_response.json.return_value = {