Skip to content

refactor(server)!: remove jsonrpc server support for Starlette and FastApi#873

Draft
guglielmo-san wants to merge 3 commits intoa2aproject:1.0-devfrom
guglielmo-san:guglielmoc/refactor_json_rpc_server
Draft

refactor(server)!: remove jsonrpc server support for Starlette and FastApi#873
guglielmo-san wants to merge 3 commits intoa2aproject:1.0-devfrom
guglielmo-san:guglielmoc/refactor_json_rpc_server

Conversation

@guglielmo-san
Copy link
Member

Description

Ref #797 🦕

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, 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 server-side implementation for handling JSON-RPC and agent card endpoints. Instead of providing framework-specific application classes, the system now offers granular routing components (JsonRpcRoutes and AgentCardRoutes). This change enhances the modularity and flexibility of the server, allowing developers to integrate these functionalities more seamlessly into existing Starlette or FastAPI applications by composing routes, rather than relying on pre-built application wrappers.

Highlights

  • Modularization of JSON-RPC and Agent Card Endpoints: The previous monolithic A2AFastAPIApplication and A2AStarletteApplication classes have been removed. Their functionalities are now split into dedicated JsonRpcRoutes and AgentCardRoutes classes, promoting better separation of concerns and reusability.
  • Refactoring of JSONRPCApplication to JsonRpcDispatcher: The core logic for handling JSON-RPC requests, previously encapsulated in JSONRPCApplication, has been refactored into a new class named JsonRpcDispatcher. This dispatcher focuses solely on processing JSON-RPC messages, decoupling it from the web framework routing specifics.
  • Simplified Application Setup: Sample and test files have been updated to reflect the new modular structure, demonstrating how to integrate JsonRpcRoutes and AgentCardRoutes directly with Starlette and FastAPI applications by extending their route lists.
  • Removal of Redundant Application Classes: The fastapi_app.py and starlette_app.py modules within a2a.server.apps.jsonrpc have been removed, along with their corresponding imports and __all__ entries, as their functionality is now handled by the new routing system.
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.

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.

@github-actions
Copy link

github-actions bot commented Mar 19, 2026

🧪 Code Coverage (vs 1.0-dev)

⬇️ Download Full Report

Base PR Delta
src/a2a/server/routes/agent_card_routes.py (new) 69.57%
src/a2a/server/routes/jsonrpc_dispatcher.py (new) 85.78%
src/a2a/server/routes/jsonrpc_routes.py (new) 61.54%
Total 90.72% 90.63% 🔴 -0.09%

Generated by coverage-comment.yml

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 refactoring that removes the framework-specific A2AFastAPIApplication and A2AStarletteApplication in favor of a more modular approach using JsonRpcRoutes and AgentCardRoutes. This improves decoupling from web frameworks and increases flexibility. The changes are well-executed across the application and test suite. However, I've found a critical issue where a test file seems to have been missed in the refactoring, causing it to break. I've also noted some areas where test coverage might have been unintentionally reduced. Additionally, there are a few minor suggestions for improving code style and clarity.

guglielmo-san and others added 2 commits March 19, 2026 21:10
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[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.

1 participant