Skip to content

Conversation

@kabir
Copy link
Collaborator

@kabir kabir commented Dec 19, 2025

Introduce a new jsonrpc-common module, and move the io.a2a.spec Request and Response classes there since they are internal use now.

The jsonrpc-common module also gets the JsonUtil and the various MappingExceptions.

The spec package exceptions were tied to JSON-RPC. We decided to keep the code and data fields, which could be useful even when JSON-RPC is not used. But we got rid of the JSONRPCError class, and repurposes the A2AError interface to take its role.
Also renamed JSONRPCRequest and JSONRPCResponse to be A2ARequest/-Response.

Make A2AError extend RuntimeException rather than Error.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kabir, 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 undertakes a significant refactoring effort within the A2A Java SDK. The primary goal is to enhance modularity and clarify the separation between public API specifications and internal implementation details. By creating a dedicated jsonrpc-common module, all internal JSON-RPC related utilities, request/response wrappers, and exception handling are consolidated. This change not only trims down the io.a2a.spec package but also standardizes the naming conventions for core A2A entities and centralizes error management under the A2AError class, leading to a cleaner and more maintainable codebase.

Highlights

  • New Module Introduction: A new jsonrpc-common module has been introduced to centralize internal JSON-RPC related classes, separating them from the public API specification.
  • Class Relocation and Renaming: Key classes such as Request, Response, JsonUtil, and various MappingExceptions have been moved from io.a2a.spec to the new jsonrpc-common module. Additionally, JSONRPCRequest and JSONRPCResponse have been renamed to A2ARequest and A2AResponse respectively for broader applicability.
  • Error Handling Refinement: The JSONRPCError class has been removed, and the existing A2AError interface has been repurposed to serve as the primary error representation, streamlining error handling across the SDK.
  • Dependency Updates: Numerous pom.xml files across various modules have been updated to include the new a2a-java-sdk-jsonrpc-common dependency, reflecting the architectural changes.
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 introduces a new jsonrpc-common module and refactors the codebase to move JSON-RPC related classes into it, improving modularity. The renaming of JSONRPCRequest/Response to A2ARequest/Response and the replacement of JSONRPCError with A2AError are consistent and well-executed across the project. The changes are extensive but applied consistently. I have one critical comment regarding the class hierarchy of A2AError and one medium-severity comment about a small inconsistency in a utility class.

@kabir kabir changed the title feat: Trim io.a2a.apec package feat!: Trim io.a2a.apec package Dec 19, 2025
ehsavoie and others added 2 commits December 19, 2025 16:24
- Create A2AMethods interface with constants for all A2A protocol methods
- Replace hardcoded method strings across all transport implementations
- Update gRPC, JSONRPC, and REST transports to use centralized constants
- Remove duplicate METHOD constants from individual request wrapper classes
- Update all test files to use new method name constants
- Clean up POM dependencies and update protobuf-maven-plugin to 4.0.3

This refactoring improves maintainability by having a single source of truth
for method names and reduces the risk of typos or inconsistencies.

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
refactor: centralize A2A method names in A2AMethods interface
@kabir
Copy link
Collaborator Author

kabir commented Dec 19, 2025

/gemini review

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 significant and beneficial refactoring by creating a new jsonrpc-common module. This improves modularity by separating the JSON-RPC specific classes from the core spec module. The renaming of JSONRPCRequest/Response to A2ARequest/Response and replacing JSONRPCError with a more general A2AError that extends RuntimeException are excellent changes that clarify the codebase.

I've found a couple of minor issues related to this refactoring that I've commented on. One is an unused variable, and the other is a likely copy-paste error where an incorrect method constant is being used, which could affect interceptor logic.

Overall, this is a great set of changes that improves the project structure.

Comment on lines 303 to 305
GetAuthenticatedExtendedCardRequest getExtendedAgentCardRequest = GetAuthenticatedExtendedCardRequest.builder()
.jsonrpc(JSONRPCMessage.JSONRPC_VERSION)
.jsonrpc(A2AMessage.JSONRPC_VERSION)
.build(); // id will be randomly generated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The getExtendedAgentCardRequest variable is created but never used. The subsequent call to applyInterceptors uses ProtoUtils.ToProto.extendedAgentCard() which doesn't take any arguments. This unused variable should be removed to improve code clarity and avoid confusion.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not introduced with this PR, and whatever :-)

@ehsavoie ehsavoie merged commit a14fd2e into a2aproject:main Dec 19, 2025
11 of 14 checks passed
kabir added a commit to kabir/a2a-java that referenced this pull request Dec 23, 2025
Introduce a new jsonrpc-common module, and move the io.a2a.spec Request
and Response classes there since they are internal use now.

The jsonrpc-common module also gets the JsonUtil and the various
MappingExceptions.

The spec package exceptions were tied to JSON-RPC. We decided to keep
the `code` and `data` fields, which could be useful even when JSON-RPC
is not used. But we got rid of the JSONRPCError class, and repurposes
the A2AError interface to take its role.
Also renamed JSONRPCRequest and JSONRPCResponse to be
A2ARequest/-Response.

Make A2AError extend RuntimeException rather than Error.

---------

Signed-off-by: Emmanuel Hugonnet <ehugonne@redhat.com>
Co-authored-by: Emmanuel Hugonnet <ehugonne@redhat.com>
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