Skip to content

Conversation

@pstephengoogle
Copy link
Contributor

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.

@pstephengoogle pstephengoogle requested a review from a team as a code owner July 24, 2025 04:34
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 @pstephengoogle, 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 and server architecture to support multiple communication protocols (JSONRPC, gRPC, RESTful) seamlessly. It introduces a unified Client interface, a ClientFactory for dynamic client creation based on agent capabilities, and a ClientTaskManager for improved task lifecycle management. Additionally, it adds comprehensive server-side support for RESTful API interactions, ensuring consistency with the gRPC definitions.

Highlights

  • Multi-Transport Client Architecture: Introduced a new abstract Client interface and implemented concrete clients for JSONRPC, gRPC, and RESTful transports, enabling flexible communication with agents.
  • Client Factory: Added a ClientFactory to automatically generate appropriate client instances based on agent card details and configurable transport preferences.
  • Client-Side Task Management: Implemented ClientTaskManager to streamline the handling and tracking of task lifecycle events received from agents.
  • Server-Side REST API: Introduced new server-side components (RESTApplication, A2ARESTFastAPIApplication, RESTHandler) to support RESTful interactions, mirroring gRPC functionality via protobuf definitions.
  • Simplified Client Interfaces: Refactored existing client methods to align with the new abstract Client interface, simplifying the overall client-side API.
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.

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 major and well-architected refactoring of the client-side code to support multiple transport protocols (JSON-RPC, gRPC, REST) via a factory pattern. This is a great improvement for modularity and extensibility.

However, the current state of the PR includes several critical issues that must be addressed. There are unresolved git conflict markers in the new REST-related server files, which will prevent the code from running. Additionally, I've found numerous bugs, including NameErrors, AttributeErrors, and TypeErrors in the new client implementations, mostly due to typos, incorrect variable/function names, and misuse of classes.

I've provided detailed comments and suggestions to fix these critical and high-severity issues. Once these are resolved, this will be a solid contribution to the codebase.

pstephengoogle and others added 8 commits July 24, 2025 04: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>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@holtskinner holtskinner changed the title feat: Refactor client code to support multi-transport interactions and simplify client interfaces refactor: Refactor client code to support multi-transport interactions and simplify client interfaces Jul 24, 2025
@holtskinner
Copy link
Member

/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 major and well-architected refactoring of the client-side code to support multiple transport protocols (JSON-RPC, gRPC, REST) through a factory pattern. The introduction of a common Client abstract base class and a ClientConfig dataclass greatly improves the architecture, making it more modular and extensible. However, the implementation has several areas that need attention, including critical bugs that could lead to runtime errors, missing features, and incomplete work. Addressing these points will help ensure the new client architecture is robust, complete, and ready for use.

Comment on lines 5 to 11
from collections.abc import AsyncGenerator
from typing import Any, TYPE_CHECKING, Callable

import httpx

from httpx_sse import SSEError, aconnect_sse
from pydantic import ValidationError
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

This file contains a number of unused imports. To improve code cleanliness and maintainability, it's best to remove them.

Suggested change
from collections.abc import AsyncGenerator
from typing import Any, TYPE_CHECKING, Callable
import httpx
from httpx_sse import SSEError, aconnect_sse
from pydantic import ValidationError
from __future__ import annotations
import logging
from typing import Callable
from a2a.utils import Transports
from a2a.client.client import Client, ClientConfig, Consumer
from a2a.client.jsonrpc_client import NewJsonRpcClient
from a2a.client.grpc_client import NewGrpcClient
from a2a.client.rest_client import NewRestfulClient
from a2a.client.middleware import ClientCallInterceptor
from a2a.types import (
AgentCapabilities,
AgentCard,
)

'JSONRPCHandler',
'RESTHandler',
'RequestHandler',
'RESTHandler',
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

RESTHandler is listed twice in the __all__ list. The duplicate should be removed.

pstephengoogle and others added 3 commits July 24, 2025 10:46
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@pstephengoogle pstephengoogle merged commit 2a7343e into restful Jul 24, 2025
2 checks passed
@pstephengoogle pstephengoogle deleted the rest_client branch July 24, 2025 18:52
holtskinner added a commit that referenced this pull request Jul 24, 2025
…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]>
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