Skip to content

Conversation

@sokoliva
Copy link
Contributor

feat(rest, jsonrpc): Add client-side extension support
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.

Fixes #504 🦕

…" 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`.
@sokoliva sokoliva requested a review from a team as a code owner October 28, 2025 16:22
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @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

  • Client Configuration: Introduced an "extensions" field in "ClientConfig" to allow clients to declare supported extensions.
  • Transport Integration: Updated "ClientFactory" to pass these extensions to both "JsonRpcTransport" and "RestTransport" during their initialization.
  • Header Management: Implemented a new "_update_extension_header" method in both transport classes to populate the "X-A2A-Extensions" HTTP header with the declared extensions.
  • Message Sending: Modified "send_message" and "send_message_streaming" methods in both JSON-RPC and REST transports to include the "X-A2A-Extensions" header in outgoing requests.
  • Comprehensive Testing: Added extensive unit tests for the new extension header logic in both "JsonRpcTransport" and "RestTransport", including a new test file for REST client tests.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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.

@holtskinner holtskinner changed the title Extension support for client feat(rest, jsonrpc): Add client-side extension support Oct 28, 2025
@sokoliva sokoliva requested a review from lkawka October 29, 2025 13:21
…d RestTransport tests.

Remove redundant code from client_factory.py
Copy link
Member

@lkawka lkawka left a 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 Client interface.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feat]: Extension support for Client

2 participants