developing-genkit-go

Build AI applications in Go using Genkit flows, prompts, tools, and model providers.

Updated Aug 17, 2026
One-click install
npx skills add https://github.com/DingJun1028/esggo-kv --skill developing-genkit-go-dingjun1028
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: developing-genkit-go
Source: https://github.com/DingJun1028/esggo-kv/tree/main/.agents/skills/developing-genkit-go
Command: npx skills add https://github.com/DingJun1028/esggo-kv --skill developing-genkit-go-dingjun1028

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building AI features in Go requires wiring together generation, structured output, streaming, tool calling, and multiple model providers with a consistent API. This Skill provides the patterns and references to implement these capabilities correctly with the Genkit Go SDK. ## Core Features & Use Cases - Generation & Structured Output: Use GenerateText, Generate, GenerateData, and streaming variants with typed Go structs and jsonschema tags. - Flows, Prompts & Tools: Wrap AI logic in observable flows, define reusable prompts in code or .prompt files, and build tools with interrupt/resume for human-in-the-loop approval. - Middleware & Providers: Apply built-in Retry, Fallback, ToolApproval, Filesystem, and Skills middleware, and connect Google AI, Vertex AI, Anthropic, OpenAI-compatible, or Ollama models. - Use Case: Create a Go HTTP service that exposes a flow generating structured JSON from Gemini, with retry middleware and tool calling, testable via the Genkit Developer UI. ## Quick Start Ask the AI to create a Genkit Go flow that generates a structured joke about a given topic and serves it over HTTP.

Frequently Asked Questions about developing-genkit-go

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate structured output in Go with Genkit?▼

Use genkit.GenerateData with a typed Go struct as the generic parameter. Add jsonschema description tags to struct fields so the model understands what each field should contain, which significantly improves structured output quality.

How do I add tool calling to a Genkit Go flow?▼

Define a tool with genkit.DefineTool, providing a name, description, and typed function, then pass it via ai.WithTools to Generate. The model calls the tool automatically, and you can limit round trips with ai.WithMaxTurns.

Which model providers does Genkit Go support?▼

Genkit Go supports Google AI and Vertex AI via googlegenai, Anthropic Claude, OpenAI-compatible APIs through compat_oai, and local Ollama models. Multiple provider plugins can be registered in a single genkit.Init call.

Does Genkit Go support streaming responses?▼

Yes, Genkit Go supports streaming via GenerateStream iterators, GenerateDataStream for typed partial objects, and ai.WithStreaming callbacks. Streaming flows can be defined with DefineStreamingFlow and served over HTTP using Server-Sent Events.

How do I add retries and fallback models in Genkit Go?▼

Use the built-in middleware package with ai.WithUse, combining middleware.Retry for exponential backoff and middleware.Fallback for alternative models. Order matters: Retry outside Fallback retries the entire cascade as a unit.

Why should AI logic be wrapped in Genkit flows?▼

Flows provide tracing, observability, and HTTP deployment via genkit.Handler. They also enable testing from the Developer UI and CLI, and support named sub-steps with core.Run for debugging multi-step pipelines.