- 
                Notifications
    You must be signed in to change notification settings 
- Fork 486
feat: add A2A Card to Agent builder #2165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| Pull Request Review: Add A2A Card to Agent BuilderOverviewThis PR adds a convenient  ✅ Strengths
 🔍 Potential Issues & Suggestions1. Missing PR Description (Critical)The PR template asks for: Why are these changes needed? and Related issue number. These sections are empty. Please add the motivation/use case for this feature and any related issue numbers. Location: PR description 2. Incomplete Test Coverage (Important)The current test only validates basic construction. The main benefit of  Location:  3. Attribute Visibility Change Lacks Justification (Minor)The change from  Location:  4. Missing Docstring (Minor)The  Location:  🔒 Security & Performance
 🎯 RecommendationApprove with minor revisions. This is a useful addition, but please address: 
 Great work on this feature! | 
| Code Review for PR #2165: Add A2A Card to Agent builderOverviewThis PR adds a new from_card() classmethod to A2aRemoteAgent that allows instantiating agents directly from an existing AgentCard, avoiding redundant card fetching. The implementation is clean and well-documented. Strengths
 Issues & Suggestions1. Potential Bug: Card Resolver with UNKNOWN URL (BLOCKING)Location: autogen/a2a/client.py:62-65, :117 When using from_card(), the URL is set to UNKNOWN, but the card resolver is still initialized with this invalid URL. If _get_agent_card() is called later, it will try to fetch from an invalid UNKNOWN base URL, causing errors. Recommendation: Use card.url when creating instance in from_card(), or defer card resolver initialization, or add validation to ensure _get_agent_card() is never called when created via from_card(). 2. Test Coverage GapsLocation: test/a2a/test_client.py:115-131 The test only validates basic initialization but does not test: 
 3. Documentation ClarityLocation: autogen/a2a/client.py:102 The docstring mentions registryURL but there is no registryURL attribute—only url. 4. Error Handling Edge CaseLocation: autogen/a2a/client.py:145-146 If _agent_card is None when created via from_card(), the code will call _get_agent_card() with the invalid UNKNOWN URL, causing cryptic errors. Add defensive validation. Security & Performance
 Test Coverage Summary
 Recommendations SummaryMust Fix (Blocking): Fix the card resolver URL issue when using from_card() with UNKNOWN URL Should Fix: Add integration tests, add error handling for edge case where _agent_card is None Nice to Have: Update docstring clarity, document typing_extensions requirement Overall AssessmentWell-structured PR with useful functionality. Main concern is the potential bug with UNKNOWN URL being passed to card resolver. Once addressed with better test coverage, this will be ready to merge. | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @Lancetnik!
| Codecov Report❌ Patch coverage is  
 
 ... and 20 files with indirect coverage changes 🚀 New features to boost your workflow:
 | 
Why are these changes needed?
Introduces a
from_cardclassmethod toA2aRemoteAgentinautogen/a2a/client.py, allowing users to create remote agent instances directly from an existingAgentCard(e.g., from discovery services or external sources). This bypasses redundant card fetching. The agent's name is derived from the card's name field.Checks