Skip to content
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
4 changes: 4 additions & 0 deletions src/google/adk/integrations/agent_registry/agent_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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"],
)
Expand Down
23 changes: 23 additions & 0 deletions tests/unittests/integrations/agent_registry/test_agent_registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down