Skip to content

Conversation

holtskinner
Copy link
Member

@holtskinner holtskinner commented Jul 24, 2025

refactor: Update client code to support multi-transport
refactor: Refactor client into BaseClient + ClientTransport #363

pstephengoogle and others added 2 commits July 24, 2025 20:24
# Adding stand-alone support for RESTful API serving

Though the RESTful API (JSON+HTTP) can be served from an envoy
transcoding of the gRPC service that may not always make sense in all
cases. Instead, this PR also adds the ability to serve the RESTful API
stand-alone, without needing to also setup the gRPC service.

---------

Co-authored-by: Holt Skinner <[email protected]>
Co-authored-by: swapydapy <[email protected]>
…s and simplify client interfaces (#342)

# Description

Refactor the client codebase to support automated, configurable, client
factory to generate a client based on the agent card details. Adds
support for generation of clients based on JSONRPC, gRPC and RESTful
interfaces.

---------

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Holt Skinner <[email protected]>
Co-authored-by: Holt Skinner <[email protected]>
@holtskinner holtskinner requested a review from a team as a code owner July 24, 2025 19:29
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.

Summary of Changes

Hello @holtskinner, 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 client-side architecture to support multiple communication transports (JSON-RPC, gRPC, and a newly introduced RESTful API) for interacting with agents. It also adds the necessary server-side components to enable agents to serve their functionalities via a RESTful interface. These changes enhance the flexibility and interoperability of the system by allowing clients and agents to negotiate and utilize the most suitable communication protocol.

Highlights

  • Multi-Transport Client Refactor: Introduced an abstract Client interface and concrete implementations for JSON-RPC, gRPC, and a new RESTful API, enabling flexible communication with agents. The previous A2AClient is now aliased for backward compatibility.
  • New Client Factory: Added a ClientFactory to dynamically create the appropriate client instance based on the agent's advertised capabilities and the client's configured preferences, simplifying client instantiation and transport negotiation.
  • RESTful API Serving: Implemented a new RESTful API layer for agents, including RESTApplication and A2ARESTFastAPIApplication, allowing agents to expose their functionalities via standard HTTP/JSON endpoints. This new API leverages Protocol Buffers for data consistency.
  • Centralized Task Management: Introduced ClientTaskManager to standardize the handling and updating of Task objects and related events across different client transports, centralizing state management.
  • Transport Enumeration: A new Transports enum has been added to define standard protocol transport labels (GRPC, JSONRPC, RESTful), improving clarity and type safety.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 or fill out our survey to provide feedback.

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.

@holtskinner holtskinner added this to the 0.3.0 Release milestone Jul 24, 2025
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 multi-transport support for the client, including a new RESTful API implementation. The introduction of a ClientFactory and a common Client interface is a great step towards a more maintainable and extensible client library. However, I've identified several critical issues, particularly in the new REST client and server implementations, as well as some regressions and incomplete features in the new transport clients. Please see my detailed comments below.

@aneeshgarg
Copy link
Contributor

/gemini review

Copy link
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@mikeas1
Copy link
Contributor

mikeas1 commented Jul 30, 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 valuable refactoring of the client architecture to support multiple transport protocols, and adds a new RESTful API for the server. The changes are extensive, touching many parts of the codebase, and generally move the project in a good direction by improving modularity and extensibility.

I've identified a few key areas for improvement:

  • Interceptor Implementation: The new RestTransport and GrpcTransport do not seem to apply client-side interceptors, which is a critical feature for functionality like authentication. This needs to be addressed to ensure consistent behavior across all transports.
  • Encapsulation: There's an instance of accessing a "protected" member from outside its class, which could be improved by adjusting the member's visibility.

Overall, this is a great step forward for the project. Addressing the feedback below will help ensure the new architecture is robust, consistent, and secure.

@mikeas1 mikeas1 merged commit 82a6b7c into main Jul 30, 2025
8 checks passed
@mikeas1 mikeas1 deleted the restful branch July 30, 2025 20:54
holtskinner pushed a commit that referenced this pull request Jul 31, 2025
🤖 I have created a release *beep* *boop*
---


##
[0.3.0](v0.2.16...v0.3.0)
(2025-07-31)


### ⚠ BREAKING CHANGES

* **deps:** Make opentelemetry an optional dependency
([#369](#369))
* **spec:** Update Agent Card Well-Known Path to
`/.well-known/agent-card.json`
([#320](#320))
* Remove custom `__getattr__` and `__setattr__` for `camelCase` fields
in `types.py`
([#335](#335))
* Add mTLS to SecuritySchemes, add oauth2 metadata url field, allow
Skills to specify Security
([#362](#362))
* Support for serving agent card at deprecated path
([#352](#352))

### Features

* Add `metadata` as parameter to `TaskUpdater.update_status()`
([#371](#371))
([9444ed6](9444ed6))
* Add mTLS to SecuritySchemes, add oauth2 metadata url field, allow
Skills to specify Security
([#362](#362))
([be6c517](be6c517))
* Add RESTful API Serving
([#348](#348))
([82a6b7c](82a6b7c))
* Add server-side support for plumbing requested and activated
extensions ([#333](#333))
([4d5b92c](4d5b92c))
* Allow agent cards (default and extended) to be dynamic
([#365](#365))
([ee92aab](ee92aab))
* Support for serving agent card at deprecated path
([#352](#352))
([2444034](2444034))
* support non-blocking `sendMessage`
([#349](#349))
([70b4999](70b4999))
* Type update to support fetching extended card
([#361](#361))
([83304bb](83304bb))


### Bug Fixes

* Add Input Validation for Task Context IDs in new_task Function
([#340](#340))
([a7ed7ef](a7ed7ef))
* **deps:** Reduce FastAPI library required version to `0.95.0`
([#372](#372))
([a319334](a319334))
* Remove `DeprecationWarning` for regular properties
([#345](#345))
([2806f3e](2806f3e))
* **spec:** Add `SendMessageRequest.request` `json_name` mapping to
`message` proto
([bc97cba](bc97cba))
* **spec:** Add Transport enum to specification
(a2aproject/A2A#909)
([d9e463c](d9e463c))


### Documentation

* Address typos in docstrings and docs.
([#370](#370))
([ee48d68](ee48d68))


### Miscellaneous Chores

* Add support for authenticated extended card method
([#356](#356))
([b567e80](b567e80))


### Code Refactoring

* **deps:** Make opentelemetry an optional dependency
([#369](#369))
([9ad8b96](9ad8b96))
* Remove custom `__getattr__` and `__setattr__` for `camelCase` fields
in `types.py`
([#335](#335))
([cd94167](cd94167))
* **spec:** Update Agent Card Well-Known Path to
`/.well-known/agent-card.json`
([#320](#320))
([270ea9b](270ea9b))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.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.

5 participants