Skip to content

feat: Keep only 0.3 compatible endpoints in compat version of AgentCard #847

Merged
bartek-w merged 1 commit into1.0-devfrom
bartekw-agent-card-v03
Mar 17, 2026
Merged

feat: Keep only 0.3 compatible endpoints in compat version of AgentCard #847
bartek-w merged 1 commit into1.0-devfrom
bartekw-agent-card-v03

Conversation

@bartek-w
Copy link
Copy Markdown
Collaborator

When generating backward compatible AgentCard format, keep only 0.3 compatible endpoints.
This affects /.well-known/agent-card.json and AgentCard generation in 0.3 compat layer.

Fixes #742

@gemini-code-assist
Copy link
Copy Markdown
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 refines the generation of backward-compatible AgentCard formats, specifically ensuring that only endpoints compatible with protocol version 0.3 are included. This change is crucial for maintaining proper functionality when interacting with older systems, particularly for the /.well-known/agent-card.json endpoint and the 0.3 compatibility layer. It centralizes version checking logic and introduces robust error handling for scenarios where no compatible interfaces are found.

Highlights

  • Version Compatibility Logic Extraction: The logic for determining legacy protocol versions (0.3.x) has been extracted from ClientFactory into a new, dedicated utility module a2a.compat.v0_3.versions for better modularity and reusability.
  • AgentCard Interface Filtering for 0.3 Compatibility: When generating backward-compatible AgentCard formats, the system now explicitly filters supported_interfaces to include only those compatible with protocol version 0.3, ensuring that only relevant endpoints are exposed.
  • Robust Error Handling for AgentCard Conversion: Error handling has been introduced in the AgentCard conversion process. If an AgentCard lacks any 0.3 compatible interfaces, a VersionNotSupportedError is raised, which is then gracefully handled by setting an empty compatibility dictionary.
  • Updated Client Factory Usage: The client factory has been updated to utilize the newly extracted is_legacy_version utility function, centralizing version checks across the codebase.
  • Comprehensive Unit Test Coverage: Extensive unit tests have been added and updated across various modules to cover the new version compatibility logic, AgentCard conversion filtering, and error handling scenarios, ensuring the robustness of these changes.
Changelog
  • src/a2a/client/client_factory.py
    • Moved version compatibility logic to a shared utility.
    • Updated transport producers to use the new is_legacy_version function.
  • src/a2a/compat/v0_3/conversions.py
    • Imported version utility functions and error types.
    • Standardized protocol version constants.
    • Implemented filtering of AgentCard interfaces to retain only 0.3 compatible ones during conversion.
    • Added error handling for AgentCard conversions lacking compatible interfaces.
  • src/a2a/compat/v0_3/versions.py
    • Added a new module to centralize protocol version compatibility checks.
  • src/a2a/server/request_handlers/response_helpers.py
    • Implemented error handling for VersionNotSupportedError during AgentCard to dictionary conversion.
  • tests/client/transports/test_rest_client.py
    • Refactored imports for ClientCallContext.
    • Cleaned up test code by removing redundant local imports and comments.
  • tests/compat/v0_3/test_conversions.py
    • Imported VersionNotSupportedError for testing.
    • Adjusted expected protocol version strings in tests.
    • Added a test case for unsupported AgentCard versions during conversion.
  • tests/compat/v0_3/test_grpc_handler.py
    • Updated sample_agent_card fixture to include a 0.3 compatible interface.
    • Adjusted expected AgentCard structure and protocol version in gRPC handler tests.
  • tests/compat/v0_3/test_rest_transport.py
    • Simplified conditional logic in mock_stream test helper.
  • tests/compat/v0_3/test_versions.py
    • Added comprehensive unit tests for the new is_legacy_version utility function.
  • tests/server/request_handlers/test_response_helpers.py
    • Imported AgentInterface for new test cases.
    • Expanded test coverage for agent_card_to_dict to include various interface compatibility scenarios.
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.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 17, 2026

🧪 Code Coverage (vs 1.0-dev)

⬇️ Download Full Report

Base PR Delta
src/a2a/client/client_factory.py 88.89% 89.35% 🟢 +0.46%
src/a2a/server/apps/rest/fastapi_app.py 81.25% 85.42% 🟢 +4.17%
src/a2a/server/apps/rest/rest_adapter.py 77.22% 82.28% 🟢 +5.06%
src/a2a/server/request_handlers/response_helpers.py 95.52% 95.71% 🟢 +0.19%
src/a2a/compat/v0_3/versions.py (new) 100.00%
Total 89.98% 90.10% 🟢 +0.11%

Generated by coverage-comment.yml

Copy link
Copy Markdown
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 refactors the legacy version checking into a centralized is_legacy_version utility function and uses it to filter for v0.3 compatible interfaces when creating a backward-compatible AgentCard. This correctly prevents non-compatible interfaces from being included. The change is well-supported by new and updated tests that cover various scenarios, including cases where no compatible interfaces exist. The overall implementation is solid. I've added one minor suggestion for a micro-optimization.

@bartek-w bartek-w force-pushed the bartekw-agent-card-v03 branch from 2768904 to 50d9676 Compare March 17, 2026 11:51
@bartek-w bartek-w requested a review from ishymko March 17, 2026 11:51
@bartek-w bartek-w marked this pull request as ready for review March 17, 2026 11:53
@bartek-w bartek-w requested a review from a team as a code owner March 17, 2026 11:53
@bartek-w bartek-w force-pushed the bartekw-agent-card-v03 branch from 50d9676 to 067a675 Compare March 17, 2026 12:30
@bartek-w bartek-w merged commit 115fa4e into 1.0-dev Mar 17, 2026
9 checks passed
@bartek-w bartek-w deleted the bartekw-agent-card-v03 branch March 17, 2026 13:12
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