inehemiasm/AiAssistant / .agents/skills/developing-genkit-python
developing-genkit-python
UnverifiedDevelop 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.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 2.4 KB |
| references/common-errors.md | markdown | 2.1 KB |
| references/dev-workflow.md | markdown | 2.5 KB |
| references/dotprompt.md | markdown | 2.7 KB |
| references/evals.md | markdown | 2.8 KB |
| references/examples.md | markdown | 3.8 KB |
| references/fastapi.md | markdown | 7.4 KB |
| references/setup.md | markdown | 1.2 KB |
references/common-errors.md
View on GitHub# Common Errors — Genkit Python
## Before anything else: read this file when you hit any error.
---
## ModuleNotFoundError: No module named 'genkit.plugins.google_genai'
**Cause:** Plugin package not installed.
**Fix:** Add dependencies from PyPI:
```bash
uv add genkit genkit-plugin-google-genai
```
---
## 400 INVALID_ARGUMENT: functionDeclaration parameters schema should be of type OBJECT
**Cause:** Tool function has bare scalar parameters (e.g. `city: str`). Gemini requires object schema.
**Fix:** Wrap parameters in a Pydantic BaseModel:
```python
from pydantic import BaseModel
# Wrong
@ai.tool()
async def get_weather(city: str) -> str: ...
# Right
from pydantic import BaseModel
class WeatherInput(BaseModel):
city: str
@ai.tool()
async def get_weather(input: WeatherInput) -> str: ...
```
---
## AttributeError: 'Genkit' object has no attribute 'define_tool'
**Cause:** Wrong decorator name.
**Fix:** Use `@ai.tool()`, not `@ai.define_tool()`.
---
## RuntimeError / event loop errors when using asyncio.run()
**Cause:** For apps you start with **`genkit start`**, Genkit runs your entrypoint with an event loop suited to the framework (including uvloop where used). There is no “default” loop for you to manage in that mode.
**Fix:** For long-running Genkit apps (servers, flows served under `genkit start`), use **`ai.run_main(main())`** as your entrypoint instead of `asyncio.run(main())`. For one-off scripts that exit when done, using `asyncio.run()` can still be appropriate when you are not using `genkit start`.
---
## Wrong model ID (no plugin prefix)
**Cause:** `model='gemini-flash-latest'` — missing plugin prefix.
**Fix:** `model='googleai/gemini-flash-latest'`
---
## response.json / response.message AttributeError
- Use `response.text` for plain text output
- Use `response.output` for structured (JSON) output
---
## await ai.generate_stream(...) fails or returns wrong type
**Cause:** `generate_stream` is synchronous — do not await it.
**Fix:**
```python
sr = ai.generate_stream(prompt='...') # no await
async for chunk in sr.stream: ...
final = await sr.response
```
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 464k | Updated | Claude CodeCodex | Verified | Install |
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 464k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 318k | Updated | Claude CodeCodex | Unverified | Install |