Skip to content

Comments

feat: PluginV2 refactor#4132

Merged
huangjeff5 merged 26 commits intomainfrom
jh-plugin-refactor
Jan 22, 2026
Merged

feat: PluginV2 refactor#4132
huangjeff5 merged 26 commits intomainfrom
jh-plugin-refactor

Conversation

@huangjeff5
Copy link
Contributor

No description provided.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @huangjeff5, 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 fundamental refactoring of the plugin system, transitioning to an asynchronous, lazy-loading architecture. This change streamlines how external functionalities are integrated and managed within the framework, improving efficiency and flexibility by resolving actions on demand rather than during initial setup. The update impacts the core registry, reflection mechanisms, and all existing plugins, ensuring a consistent and modern approach to extensibility.

Highlights

  • Asynchronous Plugin API (PluginV2): The core plugin system has been refactored to introduce a new asynchronous API. The old synchronous genkit.ai._plugin.Plugin class has been removed and replaced with genkit.core.plugin.Plugin, which defines asynchronous init, resolve, and list_actions methods. This enables lazy loading and dynamic resolution of plugin actions.
  • Registry Updates for Async Resolution: The genkit.core.registry.Registry class has been significantly updated to support the new asynchronous plugin model. Old synchronous methods like lookup_action and lookup_action_by_key have been replaced with async resolve_action and async resolve_action_by_key. Plugin registration now uses register_plugin instead of separate resolver registrations, and includes mechanisms for ensuring plugins are initialized only once.
  • Migration of Existing Plugins: All existing plugins (Anthropic, OpenAI-Compat, DeepSeek, Dev Local Vector Store, Evaluators, Firebase, Google GenAI, Ollama, Vertex AI, xAI) have been updated to conform to the new asynchronous PluginV2 API. This involves changing their initialize and resolve_action methods to async init and async resolve, respectively, and updating internal action resolution calls to use the new await registry.resolve_action pattern.
  • Reflection Server Enhancements: The reflection server (genkit.core.reflection.py) has been updated to leverage the new asynchronous plugin API for listing and running actions. Streaming responses have been enhanced with asyncio.Queue for better chunk handling and now use text/plain media type with Transfer-Encoding: chunked to match the Go implementation.
  • Runtime File Naming and Metadata: Runtime files now include the process ID (PID) and a more precise timestamp (milliseconds) in their names to ensure uniqueness across restarts. Additionally, the Genkit version is now included in the runtime metadata.
  • Code Cleanup and Type Hinting: Various files across the codebase have undergone minor cleanup, including removal of unused imports (sys, asyncio, typing.Type, Awaitable, etc.), simplification of StrEnum imports, and updates to type hints for consistency (e.g., Type[BaseModel] to type[BaseModel]). Docstrings have also been refined in several places.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

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 major refactoring of the plugin system to a new asynchronous "V2" API. The changes are extensive, touching core registry logic, all existing plugins, and tests. The new plugin interface is cleaner and async-first. Most of the changes correctly adapt the codebase to this new model, including significant improvements to streaming logic in the reflection server and bug fixes in request handling. However, the refactoring appears to be incomplete for the VertexAIVectorSearch plugin, as its new init method is empty, effectively disabling its functionality. This is a critical issue that needs to be addressed.

@MengqinShen
Copy link
Contributor

@huangjeff5 The GenkitEvaluators plugin (in py/plugins/evaluators) needs to be refactored with this new refactor. Since it requires access to the ai (Genkit) instance to run flows, it might need a different initialization pattern or the Plugin.init method needs to be able to access the registry/instance.Probably we can update it in another pr.

Copy link
Contributor

@zarinn3pal zarinn3pal left a comment

Choose a reason for hiding this comment

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

@huangjeff5 The samples run fine. Some devui components are not properly displayed. Can be fixed in next PR.
image

@huangjeff5 huangjeff5 marked this pull request as ready for review January 22, 2026 00:27
@huangjeff5 huangjeff5 merged commit ba9c5c7 into main Jan 22, 2026
10 checks passed
@huangjeff5 huangjeff5 deleted the jh-plugin-refactor branch January 22, 2026 00:28
This was referenced Feb 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config docs Improvements or additions to documentation python Python refactor

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants