Index of every page on this site: llms.txt
All skills
genkit-ai avatar

/developing-genkit-python

@d12c988
by Genkitgenkit-ai/skills40 stars
13
Run it yourself

Provides guidance on developing AI-powered applications using Genkit Python (0.13) and migrating Genkit Python 0.12 projects to 0.13. Use when building AI agents, flows, tools, structured outputs, or FastAPI routes in Python, upgrading from Genkit 0.12, or debugging Genkit imports, config errors, or traces. Don't use for Genkit in JavaScript/TypeScript, Go, or Dart.

Use this Skill: https://skilld.dev/gh/genkit-ai/skills/developing-genkit-python

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

referencessetup.md

≈941 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Setup — Genkit Python

New project

Always use a virtual environment — never install Genkit into the system interpreter. With uv, uv add and uv run manage .venv automatically.

mkdir my-app && cd my-app
uv init
# Genkit requires Python 3.10+. If `uv init` pins a newer interpreter in
# pyproject.toml or .python-version than you have installed, adjust it first.
uv venv --python 3.12 .venv
uv add 'genkit==0.13.*' 'genkit-google-genai==0.13.*'

export GEMINI_API_KEY=your_key_here

Keep genkit and every genkit-* package on the same 0.13.* release. pydantic is installed automatically with genkit, though adding pydantic directly to pyproject.toml is fine when defining your own BaseModel schemas.

Place your entrypoint at src/main.py (or match the file generated by uv init) and run it under genkit start -- uv run src/main.py.

pyproject.toml

[project]
name = "my-app"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = [
    "genkit==0.13.*",
    "genkit-google-genai==0.13.*",
]

Packages and Imports

PyPI distribution names use hyphens (genkit-*); Python import modules use underscores (genkit_*). Import everything from each package's top-level module (or .exp for experimental agent integrations):

  • genkit-google-genai: from genkit_google_genai import GoogleAI, VertexAI, GeminiConfig (Gemini API via GEMINI_API_KEY, or Google Cloud Vertex AI via ADC).
  • genkit-vertexai: from genkit_vertexai import ModelGarden (third-party models on Vertex AI Model Garden). Install the extra matching the models you call:
    • uv add 'genkit-vertexai[anthropic]' for Claude models
    • uv add 'genkit-vertexai[openai]' for Llama, Mistral, and OpenAI-compatible models
  • genkit-anthropic: from genkit_anthropic import Anthropic, AnthropicConfig (ANTHROPIC_API_KEY).
  • genkit-openai: from genkit_openai import OpenAI, OpenAIConfig (OPENAI_API_KEY or custom base_url=).
  • genkit-ollama: from genkit_ollama import Ollama, OllamaConfig (local Ollama server; auto-discovers pulled models).
  • genkit-amazon-bedrock: from genkit_amazon_bedrock import Bedrock, BedrockConfig, StabilityImageConfig.
  • genkit-middleware: from genkit_middleware import Middleware, Retry, Fallback, ToolApproval, Skills, Filesystem (plus from genkit_middleware.exp import Artifacts for agent sessions).
  • genkit-fastapi: from genkit_fastapi import serve_flow, genkit_fastapi_handler, handle_genkit_request (plus from genkit_fastapi.exp import serve_agent).
  • genkit-flask: from genkit_flask import genkit_flask_handler (requires flask[async]; does not install genkit-google-genai automatically; add your model plugin explicitly).
  • genkit-django: from genkit_django import genkit_django_handler.
  • genkit-mcp: from genkit_mcp import McpClient, McpHost, define_mcp_client, define_mcp_host (Model Context Protocol clients and tool hosts).
  • genkit-google-cloud: from genkit_google_cloud import enable_google_cloud_telemetry (plus from genkit_google_cloud.exp import FirestoreSessionStore).
  • genkit-otel: from genkit_otel import GenAiInstrumentation, ContentCapturingMode, OtelEventLogger (OpenTelemetry GenAI spans and metrics).
  • genkit-evaluators: from genkit_evaluators import register_genkit_evaluators. Last release with evaluators; Genkit 1.0 cuts evaluators from the 1.0 release (evaluation will return as an additive feature in a later release). Requires genkit<1 (see Evals).

Python version

Python 3.10+. Upgrading an existing 0.12 app? Follow Migrating from 0.12 to 0.13.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

No alerts14d3 checks · Risk SAFE
  • Gen Agent Trust Hub14d

    The skill provides comprehensive documentation and code examples for developing AI applications with Genkit Python. It includes instructions for setting up environment variables and installing packages from trusted registries (NPM, PyPI). While it describes building agents that process untrusted user data, which creates a potential surface for indirect prompt injection, this is inherent to the technology described and is documented alongside safety features like human-in-the-loop approval.

  • Socket14d

    No alerts

  • Snyk14d

    Risk: LOW · No issues

Signed by skilld at d12c988. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 5 days ago.

Activeupdated 2 weeks ago
metadata
{
  "version": "1.0.0",
  "category": "AiAndMachineLearning"
}

README badge

README badge for genkit-ai/skills/developing-genkit-python