fix(a2a): pass documentation_url to AgentCard in AgentCardBuilder#6326
Open
anxkhn wants to merge 1 commit into
Open
fix(a2a): pass documentation_url to AgentCard in AgentCardBuilder#6326anxkhn wants to merge 1 commit into
anxkhn wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Please ensure you have read the contribution guide before creating a pull request.
Link to Issue or Description of Change
1. Link to an existing issue (if applicable):
2. Or, if no issue exists, describe the change:
Problem:
AgentCardBuilderaccepts adoc_urlargument and stores it, but itsbuild()method passes that value to
AgentCardusing a keyword nameddoc_url:The
a2a-sdkAgentCardmodel has nodoc_urlfield. The documentation URL isexposed as
documentation_url(serialization aliasdocumentationUrl). BecauseAgentCardignores unknown keyword arguments, the value passed asdoc_urlissilently dropped, so
AgentCardBuilder'sdoc_urlargument has no effect andgenerated agent cards never advertise their documentation URL.
Reproduction against the pinned
a2a-sdk(>=0.3.4,<0.4; verified on 0.3.26):Solution:
Pass the stored value to the correct
AgentCardkeyword,documentation_url, sothe builder's
doc_urlargument is honored and the card advertises its docs URL:The public
AgentCardBuilder(..., doc_url=...)argument is intentionally kept asis, so this is a non-breaking, one-line behavior fix (only the internal keyword
passed to
AgentCardchanges).The existing unit test
test_build_with_custom_parametersdocumented the bug byasserting
result.documentation_url is None(with a comment noting the mismatch).It is updated to assert the URL now round-trips onto
AgentCard.documentation_url.Testing Plan
Unit Tests:
Updated
test_build_with_custom_parametersintests/unittests/a2a/utils/test_agent_card_builder.py: it builds a card withdoc_url="https://docs.example.com"and now assertsresult.documentation_url == "https://docs.example.com".This is a genuine regression test: reverting only the production line back to
doc_url=self._doc_urlmakes the assertion fail withAssertionError: assert None == 'https://docs.example.com'; with the fix it passes.pytestsummary:Manual End-to-End (E2E) Tests:
AgentCardBuilderis experimental and building a card does not require a runningagent, so the behavior is demonstrated directly against
a2a-sdk(0.3.26):Checklist
Additional context
AgentCardBuilderis marked experimental (@a2a_experimental). The publicdoc_urlargument is deliberately left unchanged to avoid an API break; only theinternal keyword handed to
AgentCardis corrected.