feat: Add Google Gemini plugin for Flyte#632
Open
andreahlert wants to merge 2 commits intoflyteorg:mainfrom
Open
feat: Add Google Gemini plugin for Flyte#632andreahlert wants to merge 2 commits intoflyteorg:mainfrom
andreahlert wants to merge 2 commits intoflyteorg:mainfrom
Conversation
9aa8a7e to
9e56006
Compare
kumare3
reviewed
Feb 8, 2026
plugins/gemini/src/flyteplugins/gemini/agents/_function_tools.py
Outdated
Show resolved
Hide resolved
kumare3
reviewed
Feb 8, 2026
plugins/gemini/src/flyteplugins/gemini/agents/_function_tools.py
Outdated
Show resolved
Hide resolved
kumare3
reviewed
Feb 8, 2026
plugins/gemini/src/flyteplugins/gemini/agents/_function_tools.py
Outdated
Show resolved
Hide resolved
Contributor
|
I dont think this is right, i have not looked at the anthropic plugin, but this will result in bugs and instability |
Contributor
|
@andreahlert here is the updated anthropic plugin - do you want to update your google gemini plugin using this model - https://github.com/flyteorg/flyte-sdk/tree/main/plugins/anthropic |
Add a new plugin that integrates Google's Gemini API with Flyte, enabling Flyte tasks to be used as tools for Gemini agents. The plugin provides: - FunctionTool: wraps Flyte tasks or regular callables as Gemini function declarations with automatic JSON schema generation - function_tool: decorator/converter for creating tools from functions and Flyte tasks - Agent: configuration dataclass for Gemini agent settings - run_agent: async agent loop that handles function calling, error handling, and conversation state management Includes comprehensive test coverage (19 tests) and a sandwich-making example that demonstrates multi-tool orchestration. Signed-off-by: André Ahlert <andre@aex.partners>
0e6ac00 to
36d1d03
Compare
- Use Flyte type engine for schema: func.json_schema for tasks, NativeInterface.from_callable().json_schema for callables - Remove custom TYPE_MAP and _get_function_schema helpers - Execute: use task.aio() for async tasks, to_thread(self.func) for sync - Fix GenerateContentConfig: use automatic_function_calling (not _config) - Replace schema unit tests with NativeInterface/type-engine tests - Add docstring note on type engine for input_schema Signed-off-by: André Ahlert <andre@aex.partners>
36d1d03 to
5ab9247
Compare
Contributor
Author
|
Hi @kumare3! LGTM I’ve aligned the Gemini plugin with the Anthropic one. Let me know if you’d like any other changes. |
kumare3
reviewed
Mar 6, 2026
| thread executor to avoid blocking the event loop. | ||
| """ | ||
| if self.task is not None: | ||
| if self.is_async: |
Contributor
There was a problem hiding this comment.
.aio is available on non async tasks too
Contributor
There was a problem hiding this comment.
We updated the anthropic plugin, sorry for the confusion, can you change like that and we can merge this
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new plugin for integrating Google's Gemini API with Flyte, following the same patterns as the existing OpenAI and Anthropic plugins.
Features
function_tooldecorator: Convert Flyte tasks to Gemini function declarations automaticallyAgentclass: Configure Gemini agents with model, instructions, and toolsrun_agentfunction: Execute agent loops that handle function calling and responsesUsage Example
Files Added
plugins/gemini/- Plugin packagepyproject.toml- Package configurationREADME.md- Documentationsrc/flyteplugins/gemini/agents/_function_tools.py- Core implementationtests/test_agents.py- Test suite (19 tests)examples/genai/gemini_agent.py- Example workflowTest Plan
Why Gemini?
Google Gemini is one of the leading LLM providers alongside OpenAI and Anthropic. Having first-class support enables users to:
This plugin mirrors the Anthropic plugin's API design, making it easy to switch between providers.