Skip to content
An open-source framework for building full-stack, AI-powered and agentic applications, built and used in production by Google

Genkit is Google’s open-source framework for building full-stack, AI-powered and agentic applications.

It offers a unified interface for integrating AI models from many model providers, so you can use the best models for your needs. Rapidly build and deploy production-ready AI-powered and agentic applications—chatbots, automations, recommendation systems, and more—using streamlined APIs for multimodal content, structured outputs, tool calling, and agentic workflows.

Get started with just a few lines of code:

Each tab is a complete program. Add Genkit to a module with go get github.com/firebase/genkit/go, then go mod tidy after you paste the code so the provider plugin and any provider SDK it needs are resolved. Each plugin reads its credential from the environment: GEMINI_API_KEY for Google AI, OPENAI_API_KEY for OpenAI, ANTHROPIC_API_KEY for Anthropic. Ollama runs locally and needs no key.

package main
import (
"context"
"log"
"github.com/firebase/genkit/go/ai"
"github.com/firebase/genkit/go/genkit"
"github.com/firebase/genkit/go/plugins/googlegenai"
)
func main() {
ctx := context.Background()
g := genkit.Init(ctx, genkit.WithPlugins(&googlegenai.GoogleAI{}))
resp, err := genkit.Generate(ctx, g,
ai.WithPrompt("Why is the sky blue?"),
ai.WithModelName("googleai/gemini-flash-latest"),
)
if err != nil {
log.Fatal(err)
}
log.Println(resp.Text())
}

genkit.Init returns a *genkit.Genkit. Create one per process in main() and share it across every request handler: it is safe for concurrent use by many goroutines, as are the flow, tool, and prompt values you define from it. The ctx you pass to genkit.Generate propagates cancellation to the provider call, but there is no default per-request timeout, so set one with context.WithTimeout. Retries and provider fallback are opt-in middleware. For the whole contract, including parallel tool fan-out and shutdown, see Concurrency, cancellation, and lifecycle.

Every concept below has a runnable Go program in the repository. Each one opens with a package comment naming what it teaches and giving the ways to run it: directly, in the Developer UI, and, where the sample serves HTTP, with curl.

SampleWhat it teaches
basicThe two kinds of flow: one that returns its answer whole, one that forwards the model’s chunks as they arrive.
basic-structuredTyped output, where the Go type you ask for is the schema the model is held to.
basic-formatsWhat the output format decides, including what a streamed chunk means under json, jsonl, and enum.
basic-promptsEvery prompt defined twice, inline in code and as a .prompt file, so the pair shows what moves out of code.
basic-prompt-contentFilling the system, conversation, user, and context slots of a prompt from one typed input.
basic-mediaReading a picture, editing one, generating one, and animating one with a background model.
basic-toolsTools, including one that returns a value plus attached content the model and the client both receive.
basic-tools-expThe same program on the in-preview tools API, which also streams progress from inside a running tool.
basic-tool-interruptsHuman in the loop: a tool pauses generation to ask a person, then resumes with their answer.
basic-tool-interrupts-expThe same program on the in-preview tools API, where the resume payload is a typed value rather than a metadata map.
basic-middleware/retry-fallbackComposing Retry and Fallback into a model pipeline that survives a bad model id.
basic-middleware/filesystemScoped file access for the model, read-only and write-enabled.
basic-middleware/skillsA local library of instructions the model loads on demand, so the heavy text stays off the hot path.
basic-middleware/a2uiAn agent that streams generative UI to a browser through the A2UI middleware, served at the endpoint the JavaScript client expects. Runs on an in-preview API.
basic-agentsSeven agents in seven styles behind one interactive CLI, including typed session state, delegation, and sub-agents that run in the background. Agent APIs are in preview.
basic-agents-serverTwo agents served as plain HTTP endpoints, one turn per request, showing session state held by the server and held by the client. Agent APIs are in preview.
basic-errorsClassifying a failure once with core/status so the classification survives to the HTTP boundary.
basic-durable-streaming-expRejoining a stream by ID, with the buffered chunks replayed before live updates resume. Runs on an in-preview API.

Provider samples for Anthropic, OpenAI, and the other OpenAI-compatible providers are the same one-flow program with only the plugin and its config changed, so they read as a diff against each other.

Play with AI sample apps, with visualizations of the Genkit code that powers them, at no cost to you.

Explore Genkit by Example

Create your own AI-powered feature in minutes with our guides.

Broad AI model supportUse a unified interface to integrate with hundreds of models from providers like Google, OpenAI, Anthropic, Ollama, and more. Explore, compare, and use the best models for your needs.
Simplified AI developmentUse streamlined APIs to build AI features with structured output, agentic tool calling, context-aware generation, multi-modal input/output, and more. Genkit handles the complexity of AI development, so you can build and iterate faster.
Web and mobile readyIntegrate seamlessly with frameworks and platforms including Next.js, React, Angular, iOS, and Android using client helpers that call your flows over HTTP.
Cross-language supportBuild with the language that best fits your project. Genkit provides SDKs for JavaScript/TypeScript, Go, Python, and Dart with consistent APIs and capabilities across all supported languages.
Deploy anywhereDeploy AI logic to any environment that supports your chosen programming language, such as Google Cloud Run or any other platform that runs your language’s binaries or containers, with or without Google services.
Developer toolsAccelerate AI development with a purpose-built, local CLI and Developer UI. Test prompts and flows against individual inputs or datasets, compare outputs from different models, debug with detailed execution traces, and use immediate visual feedback to iterate rapidly on prompts. Coding with an AI assistant? Genkit Agent Skills teach it to write idiomatic Genkit code.
Production monitoringShip AI features with confidence using comprehensive production monitoring. Track model performance, request volumes, latency, and error rates in a purpose-built dashboard. Identify issues quickly with detailed observability metrics, and ensure your AI features meet quality and performance targets in real-world usage.

Genkit simplifies building AI-powered and agentic applications with an open-source SDK and unified APIs that work across various model providers and programming languages. It abstracts away complexity so you can focus on delivering great app experiences.

Some key features offered by Genkit include:

Genkit is designed for server-side deployment in multiple language environments, and also provides seamless client-side integration through dedicated client helpers.

1Choose your language and model providerSelect the Genkit SDK for your preferred language (JavaScript/TypeScript, Go, Python, or Dart). Choose a model provider like Google Gemini or Anthropic, and get an API key. Some providers, like Vertex AI, may rely on a different means of authentication.
2Install the SDK and initializeInstall the Genkit SDK, model-provider package of your choice, and the Genkit CLI. Import the Genkit and provider packages and initialize Genkit with the provider API key.
3Write and test AI featuresUse the Genkit SDK to build AI features for your use case, from basic text generation to complex multi-step agentic applications. Use the CLI and Developer UI to help you rapidly test and iterate.
4Deploy and monitorDeploy your AI features to Firebase, Google Cloud Run, or any environment that supports your chosen programming language. Integrate them into your app, and monitor them in production in the Firebase console.