Skip to content

feat: A2A Version Header validation on server side.#865

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

feat: A2A Version Header validation on server side.#865
bartek-w merged 1 commit into1.0-devfrom
bartekw-a2a-header

Conversation

@bartek-w
Copy link
Collaborator

No description provided.

@bartek-w bartek-w changed the base branch from main to 1.0-dev March 19, 2026 08:39
@bartek-w bartek-w force-pushed the bartekw-a2a-header branch from 97903c4 to 027637d Compare March 19, 2026 08:41
@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 represents a major architectural upgrade for the A2A Python SDK, focusing on full adoption of A2A Protocol v1.0. It introduces direct Protobuf usage for improved type safety and performance, alongside a robust backward compatibility layer for v0.3. Key enhancements include a standardized error handling mechanism, integration of Alembic for database migrations, and a flexible client-side interceptor pattern. These changes modernize the SDK's foundation, ensuring future extensibility and interoperability while maintaining support for existing deployments.

Highlights

  • A2A Protocol v1.0 Adoption: The SDK has undergone a significant refactoring to align with A2A Protocol v1.0, transitioning from Pydantic models to direct usage of Protobuf types for core data structures across client and server components.
  • Backward Compatibility for v0.3: A comprehensive compatibility layer has been introduced under src/a2a/compat/v0_3 to enable seamless interaction between v1.0 clients/servers and legacy v0.3 systems. This includes dedicated adapters and conversion utilities for gRPC, JSON-RPC, and REST transports.
  • Enhanced Error Handling: The client and server error hierarchies have been refactored to introduce specific A2AError types, which are now consistently mapped to standard HTTP, gRPC, and JSON-RPC error codes for more robust and predictable error management.
  • Database Migration Integration: Alembic has been integrated to manage database schema changes, including a new CLI tool (a2a-db) and initial migration scripts. This adds owner, last_updated, and protocol_version columns to task and push notification configuration tables, ensuring proper data versioning and ownership tracking.
  • Client Interceptor Pattern: The client architecture now supports an interceptor pattern (ClientCallInterceptor) allowing for flexible modification of requests and responses, which is crucial for features like authentication and custom headers.
  • Updated Code Generation Workflow: The protobuf code generation process has been updated with new buf.gen.yaml configurations and shell scripts (gen_proto.sh, gen_proto_compat.sh) to support the new v1.0 structure and generate compatibility layers for v0.3.
Ignored Files
  • Ignored by pattern: .github/workflows/** (4)
    • .github/workflows/linter.yaml
    • .github/workflows/release-please.yml
    • .github/workflows/unit-tests.yml
    • .github/workflows/update-a2a-types.yml
  • Ignored by pattern: CHANGELOG.md (1)
    • CHANGELOG.md
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.

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.

@github-actions
Copy link

github-actions bot commented Mar 19, 2026

🧪 Code Coverage (vs 1.0-dev)

⬇️ Download Full Report

Base PR Delta
src/a2a/compat/v0_3/jsonrpc_adapter.py 31.06% 47.01% 🟢 +15.95%
src/a2a/compat/v0_3/rest_adapter.py 36.62% 50.70% 🟢 +14.08%
src/a2a/compat/v0_3/rest_handler.py 96.30% 96.67% 🟢 +0.37%
src/a2a/server/apps/jsonrpc/jsonrpc_app.py 87.07% 87.18% 🟢 +0.11%
src/a2a/server/request_handlers/jsonrpc_handler.py 92.00% 92.50% 🟢 +0.50%
src/a2a/server/request_handlers/rest_handler.py 93.02% 93.75% 🟢 +0.73%
src/a2a/utils/error_handlers.py 93.33% 95.65% 🟢 +2.32%
src/a2a/utils/helpers.py 100.00% 97.42% 🔴 -2.58%
Total 90.29% 90.77% 🟢 +0.48%

Generated by coverage-comment.yml

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 introduces a new validate_version decorator to enforce API versioning based on the A2A-Version header, applying it to various JSONRPC and REST handler methods for both v0.3 compatibility and v1.0 protocols. It also significantly improves error handling for streaming responses by refactoring the rest_stream_error_handler to catch exceptions that occur during the asynchronous generation of stream content, rather than just during the initial request. Accompanying these changes are updated imports, standardized test context creation, and comprehensive new test cases to validate the versioning logic and the enhanced streaming error handling.

@bartek-w bartek-w force-pushed the bartekw-a2a-header branch from 027637d to 9f0928b Compare March 19, 2026 08:47
@bartek-w bartek-w requested a review from ishymko March 19, 2026 08:47
@bartek-w bartek-w marked this pull request as ready for review March 19, 2026 08:51
@bartek-w bartek-w requested a review from a team as a code owner March 19, 2026 08:51
@bartek-w bartek-w force-pushed the bartekw-a2a-header branch 2 times, most recently from dde1c21 to 808b923 Compare March 19, 2026 12:39
@bartek-w bartek-w force-pushed the bartekw-a2a-header branch from 808b923 to ba89677 Compare March 19, 2026 13:29
@bartek-w bartek-w merged commit b261ceb into 1.0-dev Mar 19, 2026
9 checks passed
@bartek-w bartek-w deleted the bartekw-a2a-header branch March 19, 2026 13:36
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.

2 participants