-
Notifications
You must be signed in to change notification settings - Fork 271
feat(rest, jsonrpc): Add client-side extension support #525
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
base: main
Are you sure you want to change the base?
Conversation
…" in Running the tests instructions. "client/test_client_factory.py" no longer exists.
This commit introduces support for clients to declare the extensions they support. - Adds an `extensions` list to `ClientConfig`. - Updates `ClientFactory` to pass `client_extensions` to `JsonRpcTransport` and `RestTransport`. - Adds `_update_extension_header` method to both transports to update the `X-A2A-Extensions` header. - Modifies `send_message` and `send_message_streaming` in `JsonRpcTransport` to include the extension headers. - Modifies `_prepare_send_message` in `RestTransport` to include the extension headers. - Adds tests for the extension header logic in both JSON-RPC and REST transports, including a new test file `test_rest_client.py`.
Summary of ChangesHello @sokoliva, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a new feature that allows clients to explicitly declare the extensions they support. By adding an "extensions" field to the client configuration and propagating this information through a dedicated HTTP header ("X-A2A-Extensions") in both JSON-RPC and REST communications, the system gains a standardized mechanism for clients to signal their capabilities to the server. This enhancement improves interoperability and enables more sophisticated client-server interactions based on supported extensions. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request adds support for clients to declare supported extensions, which are then sent in the X-A2A-Extensions header. The implementation is straightforward, adding the necessary logic to ClientConfig, ClientFactory, and both JsonRpcTransport and RestTransport. The changes are well-tested. My review includes a few suggestions to improve robustness and maintainability. Specifically, I've identified a minor bug in the header parsing logic and an opportunity to reduce code duplication between the two transport implementations. I've also suggested improvements to the tests to cover more edge cases.
…in JsonRpc and Rest transports
…nstructors for compatability with legacy.py
…nstructors for compatability with legacy.py
…oliva/a2a-python into Extension-support-for-Client
…oliva/a2a-python into Extension-support-for-Client
…d RestTransport tests. Remove redundant code from client_factory.py
lkawka
left a comment
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.
Two things:
- gRPC implementation seems to be missing.
- We would like to have per-method overrides on the
Clientinterface.
…and RestTransport
…ility.py Add extensions feature to grpc.
…nsport methods to handle extensions
…ader function and remove set to list transformation.
…rt. Add helper __merge_extensions method in utils.py
… method "update_extension_metadata" to tansports/utils.py.
feat(rest, jsonrpc): Add client-side extension support
This commit introduces support for clients to declare the extensions they support.
extensionslist toClientConfig.ClientFactoryto passclient_extensionstoJsonRpcTransportandRestTransport._update_extension_headermethod to both transports to update theX-A2A-Extensionsheader.send_messageandsend_message_streaminginJsonRpcTransportto include the extension headers._prepare_send_messageinRestTransportto include the extension headers.test_rest_client.py.Fixes #504 🦕