Skip to content

Conversation

racinmat
Copy link

@racinmat racinmat commented Aug 20, 2025

Fixes #2535.
Fixes #2624. Technically it's not on the same swagger page, but it introduces new endpoint /a2a/{agent name}/docs which has the swagger which is sufficient.

I know the contribution guide tells to make 1 PR for 1 issue, but this PR fixes 2 issues, so I hope that's ok and I won't have to make 2 PRs with the same code.

testing plan

The tests can be seen in the PR.
I removed the mock to actually exercise the A2A-related code which was just silently crashing until now.

Now both old and new agent card work, and the a2a has its own swagger.
For the example from #2624, it's on page http://localhost:8082/a2a/check_prime_agent/docs.

All relevant tests passed:

 pytest .\tests\unittests\cli\test_fast_api.py
===================================================================================================================================================================== test session starts =====================================================================================================================================================================
platform win32 -- Python 3.12.8, pytest-8.4.1, pluggy-1.6.0
rootdir: C:\Projects\others\adk-python
configfile: pyproject.toml
plugins: anyio-4.9.0, langsmith-0.3.45, asyncio-1.1.0, mock-3.14.1, xdist-3.8.0
asyncio: mode=Mode.AUTO, asyncio_default_fixture_loop_scope=function, asyncio_default_test_loop_scope=function
collected 32 items                                                                                                                                                                                                                                                                                                                                             

tests\unittests\cli\test_fast_api.py ................................                                                                                                                                                                                                                                                                                    [100%]

Copy link

@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 @racinmat, 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 addresses issues with A2A (Agent-to-Agent) URL handling and swagger documentation by updating the underlying framework for A2A application integration. It ensures that both existing and new agent card URLs function correctly and introduces a dedicated endpoint for OpenAPI documentation for A2A agents. The changes involve migrating to a new FastAPI-based application structure for A2A and enhancing the test suite to validate these improvements and ensure backward compatibility.

Highlights

  • A2A Application Migration: The core A2A application integration has been migrated from A2AStarletteApplication to A2AFastAPIApplication, leveraging FastAPI's capabilities for better API management and documentation.
  • New OpenAPI Documentation Endpoint: A new dedicated OpenAPI documentation endpoint is now available for A2A agents at /a2a/{agent name}/docs, providing clear and interactive API specifications.
  • Improved Test Coverage and Realism: The testing suite has been significantly enhanced by updating the A2A agent card schema in mock data and removing previous mocks, allowing tests to exercise the real A2A code paths.
  • Enhanced A2A Agent Discovery and Compatibility Tests: Comprehensive tests have been added to verify A2A agent discovery, the functionality of the new OpenAPI endpoint, and backward compatibility for both current and previous agent card URLs.
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. 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.

@adk-bot adk-bot added bot triaged [Bot] This issue is triaged by ADK bot core [Component] This issue is related to the core interface and implementation labels Aug 20, 2025
@adk-bot adk-bot requested a review from Jacksunwei August 20, 2025 10:35
Copy link

@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 effectively addresses the issue of old A2A URLs and the lack of a dedicated Swagger page by refactoring the A2A integration to use A2AFastAPIApplication and mounting it as a sub-application. This is a solid improvement that leverages FastAPI's features correctly. The tests have also been improved by removing mocks and testing the actual A2A application setup, which increases confidence in the changes. I have one suggestion to improve the readability of the updated test case.

@racinmat
Copy link
Author

@Jacksunwei Hi, would you be so kind and review this PR?

@Jacksunwei
Copy link
Collaborator

Thanks for the contribution! I'll let @seanzhou1023 to teak a look first.

In the meanwhile, you could take a look the failing checks, as well.

@racinmat
Copy link
Author

@Jacksunwei Thanks for the feedback, I addressed them. Can the tests be reran automatically so I could verify the code is ok without having to wait for human to run them?
Is it good to merge now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bot triaged [Bot] This issue is triaged by ADK bot core [Component] This issue is related to the core interface and implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Swagger docs don't show a2a Agent Card inaccessible via legacy path after a2a-sdk upgrade
5 participants