Skip to content

fix: support proto-based AgentCard in AgentCardResolver#344

Merged
ishymko merged 3 commits intomainfrom
ishymko/card-resolver-proto-compat
Mar 10, 2026
Merged

fix: support proto-based AgentCard in AgentCardResolver#344
ishymko merged 3 commits intomainfrom
ishymko/card-resolver-proto-compat

Conversation

@ishymko
Copy link
Copy Markdown
Member

@ishymko ishymko commented Mar 9, 2026

Description

Fixes an issue where the SDK fails to resolve Agent Cards served in Protobuf JSON format.

In the v0.3.0 specification, there was a structural drift between the JSON Schema data model and the Protobuf data model:

  • JSON Schema: Uses a "type" discriminator (e.g., {"type": "openIdConnect"}). Source
  • Protobuf: Uses the oneof field name as the discriminator (e.g., {"oauth2SecurityScheme": {...}}). Source

@ishymko ishymko requested a review from a team as a code owner March 9, 2026 12:07
@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 resolves a critical compatibility issue within the SDK's AgentCardResolver by enabling it to seamlessly handle Agent Cards formatted according to the Protobuf JSON specification. Previously, the SDK would fail to resolve these cards due to structural differences in their security scheme definitions compared to the expected JSON Schema. The changes introduce robust detection and normalization logic, ensuring that all valid Agent Card formats are correctly parsed and integrated into the SDK's internal data model, thereby enhancing the SDK's resilience and interoperability with diverse A2A implementations.

Highlights

  • Support for Protobuf JSON Agent Cards: The AgentCardResolver now correctly processes Agent Cards served in Protobuf JSON format, addressing a previous failure due to structural differences.
  • Normalization Logic Implemented: A new normalizeAgentCard method was added to convert Protobuf JSON structures into the SDK's expected JSON Schema format, ensuring consistent internal representation.
  • Robust Detection Mechanism: Introduced isProtoAgentCard and hasProtoSecurity helper methods to intelligently detect Protobuf JSON based on the structure of security schemes and skills within the card.
Changelog
  • src/client/card-resolver.ts
    • Implemented normalizeAgentCard to convert Protobuf JSON Agent Cards to the internal JSON Schema format.
    • Added isProtoAgentCard and hasProtoSecurity methods for detecting Protobuf JSON structures.
    • Modified resolve method to use the new normalization logic.
  • test/client/card-resolver.spec.ts
    • Introduced new test cases to validate the AgentCardResolver's ability to correctly parse and normalize both JSON Schema and Protobuf JSON formatted Agent Cards.
    • Defined expectedAgentCard, v03AgentCard, and v1ProtoAgentCard test data for comprehensive testing.
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 9, 2026

🧪 Code Coverage

⬇️ Download Full Report

Main PR Delta
src/client/card-resolver.ts 95.23% 96.82% 🟢 +1.59%
src/types/converters/from_proto.ts 64.08% 71.59% 🟢 +7.51%
Total 80.2% 80.99% 🟢 +0.79%

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 introduces support for resolving Agent Cards that are served in Protobuf JSON format, which has a different structure from the JSON Schema format the SDK internally uses. The changes correctly detect the protobuf format and normalize it. The implementation is clean and is accompanied by good tests covering both formats. I have one suggestion to enhance the error handling within the new normalization logic to make it more robust against potential detection errors.

Comment thread src/client/card-resolver.ts
@ishymko ishymko force-pushed the ishymko/card-resolver-proto-compat branch from ee3422a to 6da5373 Compare March 9, 2026 12:22
@ishymko ishymko force-pushed the ishymko/card-resolver-proto-compat branch from 6da5373 to 21e64d3 Compare March 9, 2026 13:53
@ishymko ishymko merged commit e71221c into main Mar 10, 2026
14 checks passed
@ishymko ishymko deleted the ishymko/card-resolver-proto-compat branch March 10, 2026 08:50
ishymko pushed a commit that referenced this pull request Mar 10, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.3.11](v0.3.10...v0.3.11)
(2026-03-10)


### Bug Fixes

* support proto-based AgentCard in AgentCardResolver
([#344](#344))
([e71221c](e71221c))
* throw on JSON-RPC response id mismatch
([#318](#318))
([5ea1c94](5ea1c94))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
ishymko added a commit that referenced this pull request Mar 10, 2026
ishymko added a commit that referenced this pull request Mar 10, 2026
ishymko added a commit that referenced this pull request Mar 10, 2026
It had nothing to do with 0.3 and 1.0.

Re #344
ikubicki pushed a commit to ikubicki/a2a-js that referenced this pull request Mar 19, 2026
## Description

Fixes an issue where the SDK fails to resolve Agent Cards served in
Protobuf JSON format.

In the v0.3.0 specification, there was a structural drift between the
JSON Schema data model and the Protobuf data model:
- **JSON Schema:** Uses a `"type"` discriminator (e.g., `{"type":
"openIdConnect"}`).
[Source](https://github.com/a2aproject/A2A/blob/8d57eba286de756176892518a8fc39b0ac2ccefb/specification/json/a2a.json#L1757-L1782)
- **Protobuf:** Uses the `oneof` field name as the discriminator (e.g.,
`{"oauth2SecurityScheme": {...}}`).
[Source](https://github.com/a2aproject/A2A/blob/8d57eba286de756176892518a8fc39b0ac2ccefb/specification/grpc/a2a.proto#L502-L510)
ikubicki pushed a commit to ikubicki/a2a-js that referenced this pull request Mar 19, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.3.11](a2aproject/a2a-js@v0.3.10...v0.3.11)
(2026-03-10)


### Bug Fixes

* support proto-based AgentCard in AgentCardResolver
([a2aproject#344](a2aproject#344))
([e71221c](a2aproject@e71221c))
* throw on JSON-RPC response id mismatch
([a2aproject#318](a2aproject#318))
([5ea1c94](a2aproject@5ea1c94))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
ikubicki pushed a commit to ikubicki/a2a-js that referenced this pull request Mar 19, 2026
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.

3 participants