Skip to content

Conversation

@guglielmo-san
Copy link
Member

@guglielmo-san guglielmo-san commented Oct 21, 2025

The goal of this PR is to propose a solution to this open task (#1150)
The current issue in the A2A project is the presence of src/types/types.ts as second source of truth other than the a2a.proto.
To fix this, the original a2a.proto has been splitted into two files:

  1. a2a_grpc.proto: contains the gRPC Service definitions
  2. a2a_types.proto: contains the message data defintion, common to gRPC ans JSONRpc

The a2a_types.proto is used to generate the a2a_types.ts, using the generate-types script command. a2a_types.ts will be generated in the folder data\types, which already hosts the predefined types_jsonrpc.ts. This file contains the message structure used by the JSONRpc, and will reference the types defined in the a2a_types.ts, generated from a2a_types.proto.
This structure will guarantee that the messages used by JSONRpc and gRPC transports are coming from a single source of truth.

The a2a_types.ts and types_jsonrpc.ts are then used to generate the a2a.json schema with the generate script command, used within the A2A language specific repositories.

The new folder structure will be:

src/
  data/
    a2a_types.proto -- Contains A2A message definitions.
    types/
       a2a_types.ts -- Contains Typescript definitions, generated from a2a_types.proto
       types_jsonrpc.ts -- Contains Typescript definitions for JSONRpc Request/Response/Error, referencing `a2a_types.ts`
  transports/
    json-rpc/
      a2a.json -- Contains JSON Schema representations of JSON-RPC objects.
    grpc/
      a2a_grpc.proto -- Contains A2A service definition, referencing `a2a_types.proto` values.

guglielmo-san and others added 15 commits October 13, 2025 14:54
…ly source of truth, as a2a.ts is automatically generated from it
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@guglielmo-san guglielmo-san requested a review from a team as a code owner October 21, 2025 13:37
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @guglielmo-san, 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 significantly refactors the A2A project's type definition and generation system. The primary goal is to establish a single, authoritative source for all protocol types using Protocol Buffers, thereby eliminating redundancy and ensuring consistency across different communication protocols like gRPC and JSON-RPC. The changes involve splitting core definitions from service definitions, automating type generation, and streamlining the overall development workflow for protocol updates.

Highlights

  • Single Source of Truth: The project's type definitions are now consolidated, making a2a.proto the single source of truth. This resolves the previous issue of having duplicate type definitions in a2a.proto and src/types/types.ts.
  • Protocol Buffer Split: The original a2a.proto file has been logically split into two distinct files: a2a_grpc.proto for gRPC service definitions and a2a_core.proto for core message data definitions, which are common to both gRPC and JSON-RPC.
  • Automated Type Generation: TypeScript types (a2a_core.ts) are now automatically generated from a2a_core.proto. The a2a_jsonrpc.ts file, which defines JSON-RPC message structures, will reference these generated core types, ensuring consistency.
  • JSON Schema Generation: The a2a.json schema is now generated from the combined a2a_core.ts and a2a_jsonrpc.ts files, standardizing the JSON-RPC schema generation process.
  • File Structure and Cleanup: The pull request introduces a new, clearer folder structure (src/data, src/transports) and removes deprecated specification files and READMEs, along with updating package dependencies and scripts.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/generate-a2a-json.yml
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 is a significant and well-executed refactoring to establish Protobuf as the single source of truth for A2A data models, which is a fantastic improvement for maintainability and consistency between the gRPC and JSON-RPC implementations. The splitting of the proto files into core data definitions and service definitions is a clean approach. I've identified a few minor issues, including a duplicated type, incorrect paths in documentation and scripts, and a field name that could be clearer. These are detailed in the specific comments below. Overall, this is a very strong and beneficial change for the project.

@@ -220,7 +122,7 @@ message Part {
message FilePart {
oneof file {
string file_with_uri = 1;
bytes file_with_bytes = 2;
string file_with_bytes = 2;
Copy link
Contributor

Choose a reason for hiding this comment

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

low

The type of this field has been changed to string, presumably to hold base64-encoded data. The name file_with_bytes is now potentially confusing. To improve clarity, I suggest renaming it to better reflect that it contains a string-encoded representation of the file bytes, for example file_content_base64.

Suggested change
string file_with_bytes = 2;
string file_content_base64 = 2;

guglielmo-san and others added 2 commits October 21, 2025 15:41
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@lkawka
Copy link
Member

lkawka commented Oct 21, 2025

A few observations and suggestions:

  1. Regarding the file structure, I recommend consolidating the two protobuf files into a single directory. Given that messages are integral to the gRPC specification, a unified location would improve clarity and ease comprehension.
  2. It appears that documentation is generated from these definitions, and the new a2a_core.ts file currently lacks any documentation annotations.
  3. The buf configurations seem to have been completely removed. Was this an intentional change? These configurations are likely beneficial to users experimenting with the repository.

@guglielmo-san guglielmo-san changed the title Make a2a source of truth Make a2a.proto the unique source of truth for Schema Oct 21, 2025
@guglielmo-san guglielmo-san changed the title Make a2a.proto the unique source of truth for Schema fix: make a2a.proto the unique source of truth for Schema Oct 29, 2025
@darrelmiller
Copy link
Contributor

This is addressed in #1160 a2a.proto is now the source of truth for data definitions

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