developing-genkit-python
firebase/agent-skills
Develop AI-powered applications using Genkit in Python with flows, tools, and multi-model support.
What is developing-genkit-python?
Genkit is a framework for building AI-powered applications in Python. Use it when developing agents, flows, tools, or when troubleshooting Genkit errors, imports, or API issues.
- Generate text and structured output using multiple AI models
- Define and execute flows and tools for complex AI workflows
- Stream responses for real-time AI interactions
- Integrate embeddings and evaluators for advanced AI features
- Run local development server with interactive Dev UI
- Support FastAPI integration for HTTP-based AI services
How to install developing-genkit-python
npx skills add https://github.com/firebase/agent-skills --skill developing-genkit-python- Python 3.14 or later
- uv package manager (install via https://docs.astral.sh/uv/getting-started/installation/)
- genkit-cli (install via npm install -g genkit-cli)
- GEMINI_API_KEY environment variable for Google AI provider
How to use developing-genkit-python
- 1.Install dependencies using uv and set up your project with genkit bootstrap
- 2.Configure your AI provider (default: Google AI) and set GEMINI_API_KEY
- 3.Create a Python file with Genkit initialization and define your main async function
- 4.Use ai.generate() for text generation or define flows and tools for complex workflows
- 5.Run genkit start to launch the development server and access the Dev UI
- 6.Test your flows and tools in the Dev UI before deploying
Use cases
- Building chatbots and conversational AI agents
- Creating multi-step workflows that chain AI calls with tools
- Generating structured data from unstructured prompts
- Evaluating AI model outputs with custom evaluators
- Deploying AI services as HTTP endpoints with FastAPI
- Python developers building AI applications
- AI engineers creating agents and workflows
- Backend developers integrating AI into services
- Teams evaluating and benchmarking AI models
developing-genkit-python FAQ
Python 3.14 or later is required. Use uv for dependency management.
Google AI (googleai/gemini-flash-latest) is the default. Other providers can be added via plugins. Always use prefixed model IDs.
Use ai.run_main(main()) as your entrypoint, not asyncio.run(). For long-lived servers, use genkit start with the Dev UI.
Always check Common Errors first. The Python SDK changes frequently, so verify imports and APIs against the provided references.
Yes. Use genkit_fastapi_handler for HTTP integration and see the FastAPI reference for parallel flows and request handling.
Full instructions (SKILL.md)
Source of truth, from firebase/agent-skills.
name: developing-genkit-python description: Develop AI-powered applications using Genkit in Python. Use when the user asks about Genkit, AI agents, flows, or tools in Python, or when encountering Genkit errors, import issues, or API problems. metadata: genkit-managed: true
Genkit Python
Prerequisites
- Runtime: Python 3.14+,
uvfor deps (install). - CLI:
genkit --version— install vianpm install -g genkit-cliif missing.
New projects: Setup (bootstrap + env). Patterns and code samples: Examples.
Hello World
from genkit import Genkit
from genkit.plugins.google_genai import GoogleAI
ai = Genkit(
plugins=[GoogleAI()],
model='googleai/gemini-flash-latest',
)
async def main():
response = await ai.generate(prompt='Tell me a joke about Python.')
print(response.text)
if __name__ == '__main__':
ai.run_main(main())
Critical: Do Not Trust Internal Knowledge
The Python SDK changes often — verify imports and APIs against the references here or upstream docs. On any error, read Common Errors first.
Development Workflow
- Default provider: Google AI (
GoogleAI()),GEMINI_API_KEYin the environment. - Model IDs: always prefixed, e.g.
googleai/gemini-flash-latest(always-on-latest Flash alias; same pattern as other skills). - Entrypoint:
ai.run_main(main())for Genkit-driven apps (notasyncio.run()for long-lived servers started withgenkit start— see Common Errors). - After generating code, follow Dev Workflow for
genkit startand the Dev UI. - On errors: step 1 is always Common Errors.
References
- Examples: Structured output, streaming, flows, tools, embeddings.
- Setup: New project bootstrap and plugins.
- Common Errors: Read first when something breaks.
- FastAPI: HTTP,
genkit_fastapi_handler, parallel flows. - Dotprompt:
.promptfiles and helpers. - Evals: Evaluators and datasets.
- Dev Workflow:
genkit start, Dev UI, checklist.
Related skills
More from firebase/agent-skills and the wider catalog.
firebase-basics
Firebase CLI setup, authentication, and project management for agent workflows
firebase-auth-basics
Set up Firebase Authentication for user sign-in, management, and secure data access.
firebase-hosting-basics
Deploy static web apps, SPAs, and microservices to Firebase Hosting with a single command.
firebase-app-hosting-basics
Deploy full-stack Next.js and Angular apps with Firebase App Hosting.
firebase-data-connect
Build and deploy PostgreSQL-backed Firebase backends with GraphQL, auto-generated queries, and type-safe SDKs.
developing-genkit-js
Develop AI-powered applications using Genkit in Node.js/TypeScript with flows, tools, and multi-provider support.