Skip to content

refactor(server)!: remove Starlette and FastAPI utilities and rely only on routes#867

Draft
guglielmo-san wants to merge 18 commits intoa2aproject:1.0-devfrom
guglielmo-san:guglielmoc/improve_server_implementation
Draft

refactor(server)!: remove Starlette and FastAPI utilities and rely only on routes#867
guglielmo-san wants to merge 18 commits intoa2aproject:1.0-devfrom
guglielmo-san:guglielmoc/improve_server_implementation

Conversation

@guglielmo-san
Copy link
Member

Description

Thank you for opening a Pull Request!
Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

@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 streamlines the server's architecture by decoupling it from specific web frameworks like Starlette and FastAPI. It introduces a new, modular routing system that centralizes the definition and handling of A2A protocol endpoints. This change enhances maintainability, improves flexibility for integrating with various ASGI frameworks, and simplifies the overall server implementation by consolidating request dispatching logic.

Highlights

  • Architectural Refactoring: The server's HTTP handling has been significantly refactored to remove direct dependencies on Starlette and FastAPI application classes, moving towards a more modular, framework-agnostic approach.
  • New Routing Module: A new routes module has been introduced, containing dedicated classes (AgentCardRoutes, JsonRpcRoutes, RestRoutes) that encapsulate the logic for handling specific A2A protocol endpoints.
  • Centralized Request Dispatching: The JSONRPCApplication has been renamed to JsonRpcDispatcher and its responsibilities shifted to directly handle request processing, eliminating the need for separate JSONRPCHandler and RESTHandler classes.
  • Simplified Application Integration: The new route classes can be easily integrated into any ASGI framework (like Starlette or FastAPI) by providing a list of routes, promoting greater flexibility and reducing framework coupling.
  • Removal of Old Application Structures: All files related to the previous a2a.server.apps module, including jsonrpc_app.py, fastapi_app.py, starlette_app.py, and rest_adapter.py, have been removed.
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.

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

The pull request successfully refactors the server's HTTP application components, moving from dedicated FastAPI/Starlette application classes to a more modular route-based structure. This change streamlines the architecture by centralizing route definitions and dispatching logic. Several application and handler files were removed, and new route-specific modules were introduced, along with corresponding updates in imports and test fixtures across the codebase. Overall, the refactor improves modularity and simplifies the integration of HTTP frameworks by relying solely on route definitions.

However, I've identified a few minor issues related to consistency in __all__ exports, error messages, and a potential oversight in passing modifiers to a compatibility adapter. There are also a couple of bugs in the new test files that need to be addressed.

guglielmo-san and others added 10 commits March 19, 2026 14:13
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>
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>
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