Skip to content

Conversation

@secprog
Copy link

@secprog secprog commented Nov 20, 2025

This update introduces an optional task_store parameter to the to_a2a function, allowing users to provide a custom task store instance. If not specified, the function defaults to using InMemoryTaskStore. Additionally, unit tests have been added to verify the functionality with a custom task store.

This update introduces an optional `task_store` parameter to the `to_a2a` function, allowing users to provide a custom task store instance. If not specified, the function defaults to using `InMemoryTaskStore`. Additionally, unit tests have been added to verify the functionality with a custom task store.
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @secprog, 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 introduces a significant enhancement to the to_a2a function by allowing for the injection of custom task store instances. This change promotes greater flexibility and extensibility, enabling developers to tailor task management to specific application needs beyond the default in-memory solution. The update includes necessary code modifications to support this new parameter and is thoroughly validated with new unit tests.

Highlights

  • Custom Task Store Support: The to_a2a function now accepts an optional task_store parameter, enabling users to provide their own task store implementation.
  • Default Behavior: If no custom task_store is specified, the function gracefully falls back to using the InMemoryTaskStore.
  • Unit Test Coverage: Comprehensive unit tests have been added to validate the correct functionality and integration of custom task stores.
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.

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 the core [Component] This issue is related to the core interface and implementation label Nov 20, 2025
@adk-bot
Copy link
Collaborator

adk-bot commented Nov 20, 2025

Response from ADK Triaging Agent

Hello @secprog, thank you for creating this PR!

To help reviewers better understand the context and purpose of your contribution, could you please associate a GitHub issue with this PR? If there is no existing issue, you can create one.

In addition, could you please add a testing plan section to your PR description to detail how you've tested these changes?

This information will help reviewers to review your PR more efficiently. Thanks!

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 task_store parameter to the to_a2a function, allowing for custom task store implementations, with InMemoryTaskStore as the default. The changes are well-implemented and include corresponding unit tests. My main feedback is to improve the type hinting for the new task_store parameter by replacing Any with a more specific type, such as InMemoryTaskStore or a Protocol, to enhance type safety and code clarity.

secprog and others added 2 commits November 20, 2025 13:56
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Removed unused import of 'Any' from typing.
@secprog
Copy link
Author

secprog commented Nov 20, 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 valuable feature by allowing a custom task_store to be passed to the to_a2a function, defaulting to InMemoryTaskStore if none is provided. The implementation is clean and follows the description. The addition of a unit test ensures the new functionality is working as expected. I have one suggestion regarding the type hint for the new parameter to improve API clarity and maintainability.

@secprog
Copy link
Author

secprog commented Nov 20, 2025

/gemini review

@secprog
Copy link
Author

secprog commented Nov 20, 2025

/gemini summary

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 an optional task_store parameter to the to_a2a function, allowing for more flexible task management by enabling the use of custom task stores. The implementation correctly defaults to InMemoryTaskStore when no custom store is provided. The accompanying unit test is well-written and effectively validates the new functionality by ensuring a custom task store is utilized when passed and that the default store is not instantiated in this case. The changes are clear, well-scoped, and improve the utility's extensibility.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

This pull request significantly enhances the to_a2a function by introducing a new task_store parameter, allowing for greater flexibility in managing tasks within the A2A application. This change enables developers to integrate custom task store implementations, moving beyond the default in-memory solution, and is supported by updated type hints and dedicated unit tests to ensure robust functionality.

Highlights

  • Custom Task Store Integration: The to_a2a function now accepts an optional task_store parameter, enabling users to provide their own custom task store implementation.
  • Default Fallback: If no custom task_store is provided, the function gracefully defaults to using the InMemoryTaskStore.
  • Enhanced Type Hinting: The TaskStore type is now imported and used for the task_store parameter, improving type safety and clarity.
  • Comprehensive Unit Tests: New unit tests have been added to verify the correct functionality and integration of custom task stores, ensuring the default InMemoryTaskStore is not instantiated when a custom one is provided.
Changelog
  • src/google/adk/a2a/utils/agent_to_a2a.py
    • Imported TaskStore alongside InMemoryTaskStore for type hinting.
    • Added task_store: Optional[TaskStore] = None as a new parameter to the to_a2a function.
    • Updated the to_a2a function's docstring to describe the new task_store parameter and its usage.
    • Included a code example in the docstring demonstrating how to use a custom task_store.
    • Modified the task_store initialization logic to conditionally use the provided task_store parameter or fall back to InMemoryTaskStore if none is supplied.
  • tests/unittests/a2a/utils/test_agent_to_a2a.py
    • Introduced test_to_a2a_with_custom_task_store, a new unit test.
    • This test verifies that when a custom task_store is passed to to_a2a, it is correctly utilized, and the default InMemoryTaskStore is not instantiated.
Activity
  • gemini-code-assist[bot] provided an initial summary of the PR.
  • adk-bot requested associating a GitHub issue and adding a testing plan to the PR description.
  • secprog invoked /gemini review twice and /gemini summary once.
  • gemini-code-assist[bot] suggested removing an unused Any import.
  • gemini-code-assist[bot] recommended using InMemoryTaskStore or a typing.Protocol for the task_store type hint for better type safety and clarity.
  • gemini-code-assist[bot] further advised using a more abstract type like BaseTaskStore or a typing.Protocol for the task_store parameter to allow for greater flexibility.
  • gemini-code-assist[bot] suggested using TaskStore as the spec for the mock in the new unit test to align with the function's type hint.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@secprog
Copy link
Author

secprog commented Nov 20, 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 successfully adds support for a custom task_store to the to_a2a function, with a sensible default to InMemoryTaskStore. The implementation and documentation changes are clear. A new unit test is added to cover this functionality. However, the new test is missing an import for TaskStore, which will cause it to fail. Please address this issue.

Refactor the test to replace the mock of InMemoryTaskStore with TaskStore, ensuring consistency with the updated type hint for task_store. This change enhances the clarity and accuracy of the unit tests.
@secprog
Copy link
Author

secprog commented Nov 20, 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 adds support for a custom task store in the to_a2a function, which is a great enhancement for flexibility. The implementation is straightforward and correct. I've added a comment to improve the clarity of the docstring example.

However, I found a critical issue in the new unit test. The order of mock arguments is incorrect due to how @patch decorators work, which makes the test invalid. I've provided a suggestion to fix this. Please ensure the test passes with the corrected argument order.

secprog and others added 2 commits November 20, 2025 14:25
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>
@secprog
Copy link
Author

secprog commented Nov 20, 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 adds support for a custom task_store in the to_a2a function, defaulting to InMemoryTaskStore if none is provided. The change is well-documented and includes a new unit test to verify the functionality. My review has identified a critical issue in the new unit test where the mocked arguments are in the wrong order, which will cause the test to fail. I've also provided a medium-severity suggestion to improve the clarity of the code example in the docstring to avoid misleading users about the implementation of a custom TaskStore.

secprog and others added 2 commits November 20, 2025 14:29
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>
@secprog
Copy link
Author

secprog commented Nov 20, 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 effectively adds support for a custom task_store to the to_a2a function, defaulting to InMemoryTaskStore when one isn't provided. The changes are clear, the documentation is updated with a helpful example, and a new unit test correctly validates the new functionality. I have one minor suggestion to improve the conciseness of the new test.

@secprog
Copy link
Author

secprog commented Nov 20, 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 successfully adds support for a custom task_store in the to_a2a function, increasing its flexibility. The implementation is straightforward, and the default behavior of using InMemoryTaskStore is preserved. The new functionality is well-documented with updates to the docstring and a clear example.

The accompanying unit test correctly verifies that a custom task store is used when provided and that the default is not instantiated in that case. I've left one suggestion in the test file to refactor some duplicated test setup code using a pytest fixture, which would improve the overall maintainability of the test suite.

Overall, this is a solid contribution that enhances the utility of the to_a2a function.

@secprog
Copy link
Author

secprog commented Nov 20, 2025

/gemini summary

@gemini-code-assist
Copy link
Contributor

Summary of Changes

This pull request introduces a significant enhancement to the to_a2a function by allowing for the injection of custom task store instances. This change promotes greater flexibility and extensibility, enabling developers to tailor task management to specific application needs beyond the default in-memory solution. The update includes necessary code modifications to support this new parameter, updated documentation, and is thoroughly validated with new unit tests.

Highlights

  • Custom Task Store Support: The to_a2a function now accepts an optional task_store parameter, allowing users to provide their own TaskStore implementation.
  • Default Behavior: If no custom task_store is provided, the function defaults to using InMemoryTaskStore.
  • Unit Test Coverage: New unit tests have been added to verify the correct functionality and integration of custom task stores, ensuring the default InMemoryTaskStore is not instantiated when a custom one is provided.
Changelog
  • src/google/adk/a2a/utils/agent_to_a2a.py
    • Imported TaskStore alongside InMemoryTaskStore for type hinting.
    • Added task_store: Optional[TaskStore] = None as a new parameter to the to_a2a function.
    • Updated the to_a2a function's docstring to describe the new task_store parameter and its usage, including a clearer code example for a custom TaskStore implementation.
    • Modified the task_store initialization logic to conditionally use the provided task_store parameter or fall back to InMemoryTaskStore if none is supplied.
  • tests/unittests/a2a/utils/test_agent_to_a2a.py
    • Imported TaskStore for use in test mocks.
    • Introduced test_to_a2a_with_custom_task_store, a new unit test.
    • This test verifies that when a custom task_store is passed to to_a2a, it is correctly utilized, and the default InMemoryTaskStore is not instantiated.
    • Corrected the order of mock arguments in the test_to_a2a_with_custom_task_store function signature.
    • Removed unused mock instances within the test_to_a2a_with_custom_task_store test.
Activity
  • An initial summary of the PR was provided by gemini-code-assist[bot].
  • adk-bot requested associating a GitHub issue and adding a testing plan to the PR description.
  • secprog made multiple requests for /gemini review and /gemini summary.
  • gemini-code-assist[bot] provided several review comments, including suggestions for type hinting, import corrections, mock argument order, docstring clarity, and test refactoring.
  • secprog addressed some of the review comments, specifically fixing the missing TaskStore import and removing unused mock instances.

@ryanaiagent ryanaiagent self-assigned this Nov 21, 2025
@ryanaiagent
Copy link
Collaborator

Hi @secprog Thank you for your contribution! We appreciate you taking the time to submit this pull request.
Before we proceed with the review can you fix the lint errors

@ryanaiagent ryanaiagent added request clarification [Status] The maintainer need clarification or more information from the author a2a [Component] This issue is related a2a support inside ADK. and removed core [Component] This issue is related to the core interface and implementation labels Nov 21, 2025
… modules

Removed unnecessary blank lines and organized imports for better readability in `experiment.py` and `run_experiment.py`.

Also, updated import statements in `agent_to_a2a.py` and its corresponding test file to maintain consistency and clarity.
@secprog
Copy link
Author

secprog commented Nov 21, 2025

Hi @secprog Thank you for your contribution! We appreciate you taking the time to submit this pull request. Before we proceed with the review can you fix the lint errors

@ryanaiagent Done :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a2a [Component] This issue is related a2a support inside ADK. request clarification [Status] The maintainer need clarification or more information from the author

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants