Skip to content

feat(compat): set a2a-version header to 1.0.0#764

Merged
bartek-w merged 1 commit into1.0-devfrom
bartekw-a2a-version-header
Mar 5, 2026
Merged

feat(compat): set a2a-version header to 1.0.0#764
bartek-w merged 1 commit into1.0-devfrom
bartekw-a2a-version-header

Conversation

@bartek-w
Copy link
Collaborator

@bartek-w bartek-w commented Mar 4, 2026

Description

Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Follow the CONTRIBUTING Guide.
  • Make your Pull Request title in the https://www.conventionalcommits.org/ specification.
    • Important Prefixes for release-please:
      • fix: which represents bug fixes, and correlates to a SemVer patch.
      • feat: represents a new feature, and correlates to a SemVer minor.
      • feat!:, or fix!:, refactor!:, etc., which represent a breaking change (indicated by the !) and will result in a SemVer major.
  • Ensure the tests and linter pass (Run bash scripts/format.sh from the repository root to format)
  • Appropriate docs were updated (if necessary)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 enhances the client's communication by automatically including a protocol version header in all requests. This change standardizes how the client identifies its protocol version to services, which is crucial for maintaining compatibility and enabling future API evolution. It ensures that both HTTPX and gRPC clients consistently send this version information, improving robustness and clarity in client-server interactions.

Highlights

  • Protocol Versioning: Introduced a new X-A2A-Version header, set to 1.0.0, to explicitly communicate the protocol version in all outgoing HTTPX and gRPC requests.
  • Client Initialization: Ensured that an httpx.AsyncClient is always initialized within the ClientFactory and its headers are configured with the protocol version, preventing potential None references.
  • gRPC Metadata: Modified the gRPC transport layer to automatically include the X-A2A-Version header in all gRPC metadata, standardizing version communication across different transport protocols.
  • Constant Definitions: Defined new constants (VERSION_HEADER, PROTOCOL_VERSION_1_0, PROTOCOL_VERSION_CURRENT) to centralize and manage protocol version information.
  • Test Coverage: Updated existing gRPC client tests and added new constant tests to verify the correct application and assertion of the X-A2A-Version header in various scenarios.
Changelog
  • src/a2a/client/client_factory.py
    • Imported PROTOCOL_VERSION_CURRENT and VERSION_HEADER constants.
    • Modified __init__ to ensure config.httpx_client is initialized and sets the X-A2A-Version header.
    • Updated _register_defaults to consistently use the configured httpx_client.
    • Modified connect to set the X-A2A-Version header when resolving agent cards.
  • src/a2a/client/transports/grpc.py
    • Imported PROTOCOL_VERSION_CURRENT and VERSION_HEADER constants.
    • Modified _get_grpc_metadata to include the X-A2A-Version header in gRPC request metadata.
  • src/a2a/utils/constants.py
    • Added VERSION_HEADER, PROTOCOL_VERSION_1_0, and PROTOCOL_VERSION_CURRENT constants.
  • tests/client/transports/test_grpc_client.py
    • Imported VERSION_HEADER and PROTOCOL_VERSION_CURRENT constants.
    • Removed unused imports a2a_pb2_grpc and ListTaskPushNotificationConfigsResponse.
    • Removed unused import proto_utils.
    • Updated various gRPC client tests to assert the presence and value of the X-A2A-Version header in request metadata.
    • Modified test_get_grpc_metadata to include the version header in expected metadata.
  • tests/utils/test_constants.py
    • Added test_version_header to verify the VERSION_HEADER constant.
    • Added test_protocol_versions to verify the PROTOCOL_VERSION_1_0 and PROTOCOL_VERSION_CURRENT constants.
Activity
  • The author has confirmed adherence to the CONTRIBUTING guide.
  • The pull request title follows the conventional commits specification, indicating a new feature (feat).
  • The author has ensured that tests and linter checks pass.
  • The author has confirmed that appropriate documentation updates were considered (if necessary).
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 the X-A2A-Version header to outgoing requests, which is a good step for protocol compatibility. The implementation looks mostly correct, with changes across HTTP and gRPC transports. I've left a couple of suggestions: one to improve code clarity by removing a redundant operation in the ClientFactory, and another to correct a type hint in the gRPC transport to align with the new logic and repository style guide.

@bartek-w bartek-w force-pushed the bartekw-a2a-version-header branch 2 times, most recently from a872513 to a680105 Compare March 4, 2026 14:07
@bartek-w bartek-w marked this pull request as ready for review March 4, 2026 14:09
@bartek-w bartek-w requested a review from a team as a code owner March 4, 2026 14:09
@bartek-w bartek-w requested a review from ishymko March 4, 2026 14:09
@bartek-w bartek-w force-pushed the bartekw-a2a-version-header branch from a680105 to 77c1c99 Compare March 5, 2026 10:05
@bartek-w bartek-w force-pushed the bartekw-a2a-version-header branch from 77c1c99 to b8da2ed Compare March 5, 2026 10:11
@bartek-w bartek-w merged commit 4cb68aa into 1.0-dev Mar 5, 2026
9 checks passed
@bartek-w bartek-w deleted the bartekw-a2a-version-header branch March 5, 2026 10:13
@ishymko ishymko linked an issue Mar 6, 2026 that may be closed by this pull request
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]: 0.3 compatibility

2 participants