developing-genkit-python
Qué hace
Esta skill ayuda a los desarrolladores a crear funciones con IA en Python usando el SDK de Genkit. Es para equipos de Python que quieren añadir llamadas a modelos, herramientas o agentes a sus apps.
Cuándo usarla
- ✓Cuando quieres crear una función, un flujo o una herramienta de IA en Python con Genkit.
- ✓Cuando necesitas conversaciones de agente de varios turnos con historial en una app de Python.
- ✓Cuando estás corrigiendo errores de importación o de API de Genkit en código de Python.
Link de la skill
https://github.com/google/skills/blob/main/skills/cloud/developing-genkit-python/SKILL.mdCópialo y pégalo en tu IA (Claude, ChatGPT o Cursor) pidiéndole que siga las instrucciones.
Cómo usar
La forma más fácil: copia el mensaje y pégalo en tu IA. Ella lee la skill y sigue las instrucciones.
Mensaje listo para pegar
Para Claude Code, Codex o Cursor: ejecútalo en la carpeta del proyecto y la skill queda instalada.
Descarga el SKILL.md y ponlo en la carpeta de skills de tu agente.
Ejemplo de qué pedirle a la IA
“Escribe un script de Python con Genkit que envíe un prompt a Gemini e imprima la respuesta.”
5 skills nuevas por semana. 1 minuto de lectura.
Cómo funciona
Escribe código Python usando la API de Genkit con un plugin de Google GenAI, y señala las guías de referencia para la configuración y los ejemplos. Usa la configuración de la herramienta uv que describe la skill.
Contenido técnico (SKILL.md original)
Texto original del autor, en inglés, directo de GitHub.
Genkit Python
Build AI features in Python — generate, stream, tools, flows, and multi-turn agents — with one SDK.
Prerequisites
- Python 3.10+ and
uv(install) - Genkit CLI:
npm install -g genkit-cliifgenkit --versionis missing
New app? Setup. Patterns? Examples.
Hello World
from genkit import Genkit
from genkit_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())
Agents (Beta)
Multi-turn chats with history, typed state, human approval, branching, and background work. Start here: Agents.
chat = agent.chat()
res = await chat.send('Hello') # AgentResponse
turn = chat.send_stream('Hello') # AgentTurn — .stream / .response
More: sessions · HITL · branching · background · state · artifacts · custom · HTTP
Imports
- Google AI:
from genkit_google_genai import GoogleAI - Agents:
from genkit.agent import InMemorySessionStore, ... - Middleware:
from genkit_middleware import Middleware, ToolApproval, ... - FastAPI:
from genkit_fastapi import serve_agent, serve_flow - Evals:
from genkit_evaluators import register_genkit_evaluators
Workflow
- Agent or flow? If the task is conversational, multi-turn, or described as
"an agent", "assistant", or "chatbot", build it with
ai.define_agent(see Agents) rather than hand-rolling agenerate+ tools loop inside a flow. Reach for a plain flow only for single-shot, stateless generation. - Set
GEMINI_API_KEY. Use prefixed model ids (googleai/gemini-flash-latest). - Enter via
ai.run_main(main())for Genkit apps (especially undergenkit start). See Common Errors. - Run with Dev Workflow (
genkit start+ Dev UI). - Verify with traces, not a blind run. Running the app directly (
uv run) does not capture dev traces. See Genkit CLI for how to run your app and capture traces. - Stuck? Common Errors first.
Genkit CLI (recommended)
genkit start unintrusively wraps any Python program that uses the Genkit library, running it unchanged while capturing traces from every Genkit action so you can prove tools were actually called and inspect model I/O from the terminal, even for headless checks. It forwards stdio, so interactive CLI tools that rely on stdin/stdout work without issues. Running the app directly (uv run) skips trace capture, so you're debugging blind.
Primary pattern (default): prefix genkit start -- to your normal run command. This collects telemetry from any Genkit code your program runs, whether triggered from the dev UI, your own web server/web UI, or a plain script:
genkit start -- uv run src/main.py
genkit start --noui -- uv run src/main.py # same, without the Dev UI (still a persistent server)
genkit start runs until you stop it with Ctrl+C. That is expected and correct for the common cases: a server your web/mobile app calls, or an interactive CLI you exit yourself. --noui only drops the Dev UI; it is not a one-shot command and will not exit on its own. Do not use genkit start as a blocking step in automated/non-interactive contexts; use flow:run (below) for that.
Non-interactive use (agents/CI): add the global --non-interactive flag before -- so the CLI uses defaults and never blocks on a prompt (e.g. the first-run analytics notice): genkit start --non-interactive -- uv run src/main.py (works with flow:run too).
Run a flow (flow:run): invoke a specific flow by name from the CLI. Append your run command after -- to spin up the runtime just for this run (the command runs as-is to register your flows):
genkit flow:run myFlow '{"data": "input"}' -- uv run src/main.py
This is self-terminating: i
Preguntas frecuentes
¿Qué versión de Python se necesita?
Python 3.10 o posterior, junto con la herramienta uv.
¿Admite agentes?
Sí. Cubre la API beta de agentes de Genkit, incluidas las sesiones y los pasos de aprobación humana.
¿Incluye ejemplos?
Sí. Señala patrones de ejemplo para las tareas habituales.
Detalles
Descripción original del autor
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.
repo: google/skills
Popularidad
- Estrellas en GitHub
- 22 mil
- Posición en el ranking
- #10258
- Licencia
- Apache-2.0
- Actualizada
- 2/11/2026
Comentarios
- …
Más skills de este repositorio
finding-google-skills
22 milAyuda a tu agente a encontrar las guías de Google adecuadas para una tarea de configuración, como alojamiento, bases de datos, almacenamiento, inicio de sesión o servicio de modelos de IA.
gcloud
22 milAyuda a tu agente a escribir y comprobar comandos gcloud de Google Cloud, consultando la sintaxis exacta antes de ejecutar nada para no adivinar los parámetros.
google-cloud-recipe-auth
22 milGuía a tu agente por la identidad y el acceso en Google Cloud, incluido cómo inician sesión las personas y los servicios y qué permisos reciben.
google-cloud-recipe-onboarding
22 milGuía a un desarrollador nuevo en sus primeros pasos en Google Cloud, incluida la elección de un proyecto, la vinculación de la facturación y el despliegue de un primer recurso.
Skills parecidas
api-connector-builder
280 milHace que tu agente cree nuevas conexiones de API siguiendo el patrón existente. Úsalo para añadir una integración más sin inventar otra forma de hacer las cosas.
api-design
280 milAyuda a tu agente a diseñar APIs REST según las buenas prácticas. Es útil para definir cómo se comunican las APIs, cómo se muestran los errores y cómo organizar los datos.
backend-patterns
280 milAyuda a tu agente con patrones de arquitectura del lado del servidor y optimización de bases de datos. Es útil para crear o revisar código que se ejecuta en el servidor.