Skip to content
Skillpedia
APIs & servers (backend)22k · #10256

developing-genkit-go

What it does

This skill helps developers build AI-powered features in Go using the Genkit SDK. It is for teams that run their backend in Go and want to add model calls or agents.

When to use it

  • ✓When you want to build an AI feature, agent or flow in Go using Genkit.
  • ✓When you need text generation, streaming or tool calling in a Go service.
  • ✓When you want to set up Genkit plugins and HTTP handlers for a Go server.

Skill link

https://github.com/google/skills/blob/main/skills/cloud/developing-genkit-go/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/google/skills/blob/main/skills/cloud/developing-genkit-go/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute →

Example of what to ask your AI

“Build a Go server with a Genkit flow that tells a joke about any topic a user sends.”

5 new skills a week. 1 minute to read.

How it works

It writes Go code that uses Genkit's init, flow and generation functions, and it includes a sample server. It loads reference guides for each feature as needed.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Genkit Go

Genkit Go is an AI SDK for Go that provides generation, structured output, streaming, tool calling, prompts, and flows with a unified interface across model providers.

Hello World

package main

import (
	"context"
	"fmt"
	"log"
	"net/http"

	"github.com/firebase/genkit/go/ai"
	"github.com/firebase/genkit/go/genkit"
	"github.com/firebase/genkit/go/plugins/googlegenai"
	"github.com/firebase/genkit/go/plugins/server"
)

func main() {
	ctx := context.Background()
	g := genkit.Init(ctx, genkit.WithPlugins(&googlegenai.GoogleAI{}))

	genkit.DefineFlow(g, "jokeFlow", func(ctx context.Context, topic string) (string, error) {
		return genkit.GenerateText(ctx, g,
			ai.WithModelName("googleai/gemini-flash-latest"),
			ai.WithPrompt("Tell me a joke about %s", topic),
		)
	})

	mux := http.NewServeMux()
	for _, f := range genkit.ListFlows(g) {
		mux.HandleFunc("POST /"+f.Name(), genkit.Handler(f))
	}
	log.Fatal(server.Start(ctx, "127.0.0.1:8080", mux))
}

Core Features

Load the appropriate reference based on what you need:

Feature Reference When to load
Initialization references/getting-started.md Setting up genkit.Init, plugins, the *Genkit instance pattern
Generation references/generation.md Generate, GenerateText, GenerateData, streaming, output formats
Prompts references/prompts.md DefinePrompt, DefineDataPrompt, .prompt files, schemas
Tools references/tools.md DefineTool, DefineResumableTool interrupts (Interrupted claim, Restart/Respond, WithResume), ai/tool helpers (tool.Interrupt, tool.Fail, tool.AttachParts)
Middleware references/middleware.md ai.Middleware, ai.WithUse, Hooks (Generate/Model/Tool), built-ins (Retry, Fallback, ToolApproval, Filesystem, Skills, SoftToolErrors, ContextCompression, Budget)
Observability references/observability.md OpenTelemetry export (otelgenai), tracing.SetInstrumentation, aix.Observer, reflection API outside dev
Flows & HTTP references/flows-and-http.md DefineFlow, DefineStreamingFlow, genkit.Handler, HTTP serving
Model Providers references/providers.md Google AI, Vertex AI, Anthropic, OpenAI-compatible, Ollama setup

Agents (Experimental)

Genkit Go has an experimental agent API for persistent, multi-turn conversations (sessions, snapshots, interrupts, branching, background execution). It is gated: initialize with genkit.Init(ctx, genkit.WithExperimental()) or the constructors panic. Server constructors come from genkit/exp (aliased genkitx); types and options from ai/exp (aliased aix); session stores from ai/exp/localstore.

  • Agent or flow? If the task is conversational, multi-turn, or described as "an agent", "assistant", or "chatbot", build it with genkitx.DefineAgent rather than hand-rolling a Generate + tools loop in a flow. Reach for a plain flow only for single-shot, stateless generation.

For details see:

Generative UI (A2UI)

Genkit

FAQ

Which model providers does it support?

It uses one interface across model providers, with Google AI as one example plugin.

Does it include an example?

Yes. It includes a hello-world flow served over HTTP.

Does it cover structured output?

Yes. It covers structured output and prompts along with generation.

Details

Original description by the author

Develop AI-powered applications using Genkit in Go. Use when the user asks to build AI features, agents, flows, or tools in Go using Genkit, or when working with Genkit Go code involving generation, prompts, streaming, tool calling, or model providers.

repo: google/skills

Popularity

GitHub stars
22k
Ranking position
#10256
License
Apache-2.0
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills