From 939bbfd3fe4c062394c38c77d1ad8a2a27fe0602 Mon Sep 17 00:00:00 2001 From: Anas Khan <83116240+anxkhn@users.noreply.github.com> Date: Sat, 4 Jul 2026 11:08:24 +0530 Subject: [PATCH] fix(a2a): pass documentation_url to AgentCard in AgentCardBuilder AgentCardBuilder.build() passed the builder's doc_url value to AgentCard using the keyword doc_url, but the a2a-sdk AgentCard model has no such field (it exposes documentation_url, alias documentationUrl). Because AgentCard ignores unknown keyword arguments, the value was silently dropped and generated cards never advertised their documentation URL. Pass the value as documentation_url so the AgentCardBuilder doc_url argument is honored. Update the unit test to assert the URL now round-trips onto AgentCard.documentation_url. Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com> --- src/google/adk/a2a/utils/agent_card_builder.py | 2 +- tests/unittests/a2a/utils/test_agent_card_builder.py | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/google/adk/a2a/utils/agent_card_builder.py b/src/google/adk/a2a/utils/agent_card_builder.py index 58ed8865442..781529d8a81 100644 --- a/src/google/adk/a2a/utils/agent_card_builder.py +++ b/src/google/adk/a2a/utils/agent_card_builder.py @@ -86,7 +86,7 @@ async def build(self) -> AgentCard: return AgentCard( name=self._agent.name, description=self._agent.description or 'An ADK Agent', - doc_url=self._doc_url, + documentation_url=self._doc_url, url=f"{self._rpc_url.rstrip('/')}", version=self._agent_version, capabilities=self._capabilities, diff --git a/tests/unittests/a2a/utils/test_agent_card_builder.py b/tests/unittests/a2a/utils/test_agent_card_builder.py index dc4dddd4ce1..781f6a24a98 100644 --- a/tests/unittests/a2a/utils/test_agent_card_builder.py +++ b/tests/unittests/a2a/utils/test_agent_card_builder.py @@ -209,9 +209,8 @@ async def test_build_with_custom_parameters( # Assert assert result.name == "test_agent" assert result.description == "An ADK Agent" # Default description - # The source code uses doc_url parameter but AgentCard expects documentation_url - # Since the source code doesn't map doc_url to documentation_url, it will be None - assert result.documentation_url is None + # The doc_url parameter is mapped to the AgentCard.documentation_url field. + assert result.documentation_url == "https://docs.example.com" assert ( result.url == "https://example.com/a2a" ) # Should strip trailing slash