Skip to content

Conversation

@martimfasantos
Copy link
Contributor

@martimfasantos martimfasantos commented Oct 31, 2025

This pull request improves the way transport protocols are used by some of the classes in A2A agent types by updating relevant fields to use it instead of plain strings.

Transport protocol type safety improvements:

  • Updated the transport field in the AgentInterface class to use the new TransportProtocol enum instead of a string, including updating example values.
  • Updated the preferred_transport field in the AgentCard class to use the new TransportProtocol enum, set its default to TransportProtocol.jsonrpc, and updated example values.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @martimfasantos, 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 improves the type safety and consistency of transport protocol definitions within the A2A agent types. By refactoring relevant fields to use a newly introduced TransportProtocol enum instead of plain strings, the changes ensure that all supported protocols are standardized and validated across the codebase, leading to more robust and maintainable agent configurations.

Highlights

  • New Enum for Transport Protocols: A new TransportProtocol enum has been introduced to standardize the representation of supported A2A transport protocols, including JSONRPC, GRPC, and HTTP+JSON.
  • Type Safety for AgentInterface: The transport field within the AgentInterface class has been updated to use the new TransportProtocol enum, replacing the previous string type, thereby enhancing type safety and validation.
  • Type Safety and Default for AgentCard: The preferred_transport field in the AgentCard class now also utilizes the TransportProtocol enum, with its default value explicitly set to TransportProtocol.jsonrpc.
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 great step towards improving type safety by introducing the TransportProtocol enum and using it in AgentInterface and AgentCard instead of raw strings. The refactoring to move the enum definition to a more logical place is also a good cleanup.

I've added a few low-severity suggestions to align the new enum member names with common Python conventions for constants (UPPER_SNAKE_CASE), which should improve readability.

One thing to consider is that the tests in tests/test_types.py don't seem to be updated to reflect these type changes. While the existing tests might still pass due to Pydantic's type coercion, it would be beneficial to add or update tests to explicitly validate the new TransportProtocol enum usage, including default values and handling of invalid inputs.

Overall, this is a solid improvement.

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.

1 participant