<#632 feat: Add Google Gemini plugin for Flyte> Pu...
# flyte-github
a
#632 feat: Add Google Gemini plugin for Flyte Pull request opened by andreahlert 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_tool
decorator
: Convert Flyte tasks to Gemini function declarations automatically • Automatic type conversion: Python type hints to JSON schema for tool input validation •
Agent
class
: Configure Gemini agents with model, instructions, and tools •
run_agent
function
: Execute agent loops that handle function calling and responses • Support for sync and async tasks • Manual function calling control: Uses AFC (Automatic Function Calling) disabled mode for explicit tool execution management Usage Example import flyte from flyteplugins.gemini import function_tool, run_agent env = flyte.TaskEnvironment("gemini-agent") @env.task async def get_weather(city: str) -> str: """Get the current weather for a city.""" return f"Weather in {city}: sunny, 72F" @env.task async def agent_task(prompt: str) -> str: tools = [function_tool(get_weather)] return await run_agent( prompt=prompt, tools=tools, model="gemini-2.5-flash", ) Files Added •
plugins/gemini/
- Plugin package •
pyproject.toml
- Package configuration •
README.md
- Documentation •
src/flyteplugins/gemini/agents/_function_tools.py
- Core implementation •
tests/test_agents.py
- Test suite (19 tests) •
examples/genai/gemini_agent.py
- Example workflow Test Plan • All 19 unit tests pass • Type conversion tests (string, int, float, bool, list, dict, Optional) • Function schema extraction tests • FunctionTool creation tests (regular functions, Flyte tasks, async) • Agent configuration tests • Tool execution tests (sync and async) • run_agent tests (tool calls, errors, max iterations, finish reasons) Why Gemini? Google Gemini is one of the leading LLM providers alongside OpenAI and Anthropic. Having first-class support enables users to: • Choose the best model for their use case • Easily switch between providers • Use Gemini's unique capabilities (multimodal, large context windows, cost efficiency) This plugin mirrors the Anthropic plugin's API design, making it easy to switch between providers. flyteorg/flyte-sdk