developing-genkit-python
यह क्या करती है
यह स्किल डेवलपर्स को Genkit SDK से Python में AI-आधारित फ़ीचर बनाने में मदद करती है। यह उन Python टीमों के लिए है जो अपने ऐप में मॉडल कॉल, tools या एजेंट जोड़ना चाहती हैं।
कब इस्तेमाल करें
- ✓जब आप Genkit से Python में AI फ़ीचर, flow या tool बनाना चाहें।
- ✓जब आपको Python ऐप में इतिहास के साथ बहु-चरणीय एजेंट चैट चाहिए।
- ✓जब आप Python कोड में Genkit की import त्रुटियाँ या API समस्याएँ ठीक कर रहे हों।
Skill का लिंक
https://github.com/google/skills/blob/main/skills/cloud/developing-genkit-python/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“Genkit के साथ एक Python स्क्रिप्ट लिखिए जो Gemini को एक प्रॉम्प्ट भेजे और जवाब प्रिंट करे।”
हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।
यह कैसे काम करती है
यह Google GenAI plugin के साथ Genkit API का इस्तेमाल करते हुए Python कोड लिखती है, और सेटअप व उदाहरणों के लिए संदर्भ गाइड की ओर इशारा करती है। यह स्किल में बताए गए uv टूल सेटअप का इस्तेमाल करती है।
तकनीकी सामग्री (मूल SKILL.md)
लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे 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
अक्सर पूछे जाने वाले सवाल
कौन सा Python संस्करण चाहिए?
Python 3.10 या उससे नया, uv टूल के साथ।
क्या यह एजेंट सपोर्ट करती है?
हाँ। यह Genkit का beta agent API कवर करती है, जिसमें sessions और human approval चरण शामिल हैं।
क्या इसमें उदाहरण हैं?
हाँ। यह आम कामों के उदाहरण पैटर्न की ओर इशारा करती है।
जानकारी
लेखक का मूल विवरण
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
लोकप्रियता
- GitHub स्टार
- 22k
- रैंकिंग में स्थान
- #10258
- लाइसेंस
- Apache-2.0
- अपडेट की गई
- 2/11/2026
कमेंट
- …
इस repository की और skills
finding-google-skills
22kआपके एजेंट को किसी सेटअप काम के लिए सही Google गाइड खोजने में मदद करती है, जैसे hosting, databases, storage, sign-in या AI model serving।
gcloud
22kयह आपके एजेंट को Google Cloud gcloud कमांड लिखने और जाँचने में मदद करती है, कुछ भी चलाने से पहले सटीक सिंटैक्स देखकर, ताकि फ़्लैग का अंदाज़ा न लगे।
google-cloud-recipe-auth
22kआपके एजेंट को Google Cloud की पहचान और पहुँच समझाती है, जिसमें यह शामिल है कि लोग और सेवाएँ कैसे साइन इन करते हैं और उन्हें कौन सी अनुमतियाँ मिलती हैं।
google-cloud-recipe-onboarding
22kएक नए डेवलपर को Google Cloud पर पहले कदमों में मदद करती है, जिसमें प्रोजेक्ट चुनना, बिलिंग जोड़ना और पहला संसाधन डिप्लॉय करना शामिल है।
मिलती-जुलती skills
api-connector-builder
280kयह आपके एजेंट को मौजूदा pattern के हिसाब से नए API connections बनाने देता है। जब बिना कोई नया तरीका बनाए एक और integration जोड़ना हो, तब इसका इस्तेमाल करें।
api-design
280kयह आपके एजेंट को best practices के हिसाब से REST APIs डिज़ाइन करने में मदद करता है। यह तय करने में काम आता है कि APIs आपस में कैसे बात करें, errors कैसे दिखें, और data को कैसे व्यवस्थित करें।
backend-patterns
280kआपके एजेंट को server-side architecture patterns और database optimization में मदद करता है। server पर चलने वाला code बनाने या review करने के लिए उपयोगी है।