mcpField
D
developing-genkit-python

developing-genkit-python

github.com/firebaseDevelopment49133.6k installsUpdated 1d ago
Repository

About developing-genkit-python

A development skill for building Genkit applications with Python. It guides setup, Google AI configuration, common patterns, error handling, and workflows for running and testing projects.

Key features

  1. 01Python project setup guidance
  2. 02Google AI plugin configuration
  3. 03Model ID and entrypoint patterns
  4. 04Examples for flows and tools
  5. 05FastAPI and Dotprompt references
  6. 06Dev UI and evaluation workflow

Use cases

  1. 01Bootstrapping a Genkit Python project
  2. 02Adding structured output or streaming
  3. 03Connecting flows to FastAPI
  4. 04Troubleshooting SDK and runtime errors

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/firebase/agent-skills --skill developing-genkit-python

After installing, type/developing-genkit-pythonin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

references/
common-errors.md
dotprompt.md
dev-workflow.md
setup.md
fastapi.md
examples.md
evals.md

Details

From the project README

Genkit Python

Prerequisites

  • Runtime: Python 3.14+, uv for deps (install).
  • CLI: genkit --version — install via npm install -g genkit-cli if 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

  1. Default provider: Google AI (GoogleAI()), GEMINI_API_KEY in the environment.
  2. Model IDs: always prefixed, e.g. googleai/gemini-flash-latest (always-on-latest Flash alias; same pattern as other skills).
  3. Entrypoint: ai.run_main(main()) for Genkit-driven apps (not asyncio.run() for long-lived servers started with genkit start — see Common Errors).
  4. After generating code, follow Dev Workflow for genkit start and the Dev UI.
  5. 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: .prompt files and helpers.
  • Evals: Evaluators and datasets.
  • Dev Workflow: genkit start, Dev UI, checklist.

Comments

Markdown supported