refactor(client)!: reorganize ClientFactory API#947
Merged
Conversation
🧪 Code Coverage (vs
|
| Base | PR | Delta | |
|---|---|---|---|
| src/a2a/client/client_factory.py | 89.31% | 88.67% | 🔴 -0.64% |
| Total | 92.49% | 92.48% | 🔴 -0.01% |
Generated by coverage-comment.yml
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the client creation logic by replacing the ClientFactory.connect class method with a standalone create_client convenience function and expanding the ClientFactory class with create and create_from_url methods. Corresponding updates were made across the codebase and test suites to adopt these changes. A minor improvement was suggested to optimize the ClientFactory.create method by caching the conversion of supported interfaces to a list, thereby avoiding redundant operations.
0f010ba to
c452192
Compare
guglielmo-san
approved these changes
Apr 8, 2026
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.
Replace
connectclass method withcreate_from_urlinstance methodconnectimplies some persistent connection, in fact the only difference withcreateis I/O during agent card resolution (also optional, as it accepted both URL or agent card itself).asyncmethod andcreateis kept without I/O.Added a utility
create_clientmodule functionOne-line entry point similar to the former
connectto simplify migration, but doesn't contain any domain logic and just does dispatching between URL and agent card.