This document introduces the Genkit framework, its core architecture, and key capabilities. Genkit is an open-source framework for building production AI applications with support for JavaScript/TypeScript, Go, and Python. This overview covers the framework's purpose, architecture, and high-level component interactions. For detailed information about specific subsystems, refer to the following sections:
Genkit is a framework for building AI-powered applications that provides unified APIs for integrating with AI models, managing agentic workflows, and deploying production-ready systems. The framework abstracts away complexity across multiple AI providers (Google AI, Vertex AI, OpenAI, Anthropic, Ollama, etc.) while maintaining language-specific optimizations.
Sources: README.md1-172
Genkit provides three SDK implementations with varying maturity levels:
| Language | Status | Package Name | Description |
|---|---|---|---|
| JavaScript/TypeScript | Production-ready | genkit, @genkit-ai/ai, @genkit-ai/core | Full feature support with mature ecosystem |
| Go | Production-ready | github.com/firebase/genkit/go | Full feature support with Go idioms |
| Python | Alpha | genkit-* | Core functionality with evolving APIs |
All SDKs share consistent core abstractions while allowing language-specific patterns. The JavaScript/TypeScript SDK is distributed across multiple packages: @genkit-ai/core for foundational runtime capabilities, @genkit-ai/ai for generative AI primitives, and genkit as the main developer-facing package.
Sources: README.md4-8 js/genkit/package.json1-234 js/ai/package.json1-170 js/core/package.json1-136
Genkit Core Abstractions and Package Structure
The framework is built around eight core abstractions:
generate() and stream() methodsexecute()defineTool()defineFlow()embed()retrieve()rerank()evaluate()All abstractions are implemented as Actions registered in a central Registry. This enables runtime discovery, reflection APIs, and language-agnostic tooling.
Sources: js/ai/package.json52-168 js/core/package.json63-106 js/genkit/package.json52-232
Genkit Plugin Ecosystem
Genkit uses a plugin architecture where each plugin can register models, embedders, retrievers, tools, or other capabilities. Plugins are configured during initialization via the plugins array.
Key Plugin Categories:
| Category | Examples | Capabilities |
|---|---|---|
| Model Providers | @genkit-ai/googleai, @genkit-ai/vertexai, genkitx-ollama | Models, embedders, image generation |
| Vector Databases | genkitx-chromadb, genkitx-pinecone, @genkit-ai/dev-local-vectorstore | Retrievers, indexers |
| Infrastructure | @genkit-ai/firebase, @genkit-ai/google-cloud | Trace storage, telemetry, deployment helpers |
| Evaluation | @genkit-ai/evaluator | Pre-built evaluator metrics |
Sources: js/plugins/googleai/package.json1-58 js/plugins/vertexai/package.json1-116 js/plugins/ollama/package.json1-54 js/plugins/chroma/package.json1-56 js/plugins/pinecone/package.json1-56 js/plugins/dev-local-vectorstore/package.json1-53 js/plugins/firebase/package.json1-120 js/plugins/google-cloud/package.json1-89 js/plugins/evaluators/package.json1-59
Genkit Usage Flow
The typical usage pattern involves:
genkit() constructorai.generate() for single-turn requests or ai.chat() for conversationsai.defineFlow() for complex workflowsSimple example from the codebase demonstrates this pattern:
Sources: README.md14-24
Multi-Agent System Pattern
Genkit supports multi-agent architectures where specialized agents are exposed as tools to a triage agent. This pattern allows complex customer service scenarios with agent handoff.
Agent definitions use ai.definePrompt() with tools, and can be loaded from .prompt files or defined inline. The triage agent coordinates which specialist agent handles each request.
Sources: js/doc-snippets/src/multi-agent/multi.ts1-61 js/doc-snippets/src/multi-agent/simple.ts1-75
Genkit Development Tools Architecture
The development workflow centers on:
genkit start command wraps application execution with telemetry collection.genkit/ directoryThis architecture enables language-agnostic tooling through file-based discovery and HTTP reflection APIs.
Sources: js/core/package.json1-136
Monorepo Organization
The repository is structured as a monorepo with separate workspaces:
| Directory | Purpose | Build System |
|---|---|---|
js/ | JavaScript/TypeScript SDK packages | TypeScript + tsup-node |
genkit-tools/ | CLI, Dev UI, Telemetry Server | TypeScript + tsup-node |
go/ | Go SDK modules | Go modules |
py/ | Python SDK packages (Alpha) | uv + pyproject.toml |
samples/ | Example applications | Language-specific |
tests/ | End-to-end integration tests | Language-specific |
The JavaScript packages use dual CommonJS/ESM output via tsup-node, producing .js, .mjs, and .d.ts files.
Sources: js/genkit/package.json12-21 js/ai/package.json12-21 js/core/package.json12-20
| Capability | Description | Primary APIs |
|---|---|---|
| Model Integration | Unified interface for 100+ AI models | ai.generate(), Model.generate() |
| Tool Calling | Agentic function calling with auto-iteration | ai.defineTool(), tools parameter |
| Structured Output | Type-safe schema-based generation | output parameter, extract() |
| RAG | Retrieval-Augmented Generation pipeline | Embedder, Retriever, Reranker |
| Multimodal | Image, video, audio input/output | Part types, media handling |
| Chat Sessions | Multi-turn conversation management | ai.chat(), session persistence |
| Streaming | Incremental response streaming | stream(), Channel abstraction |
| Flows | Multi-step workflow orchestration | ai.defineFlow(), step tracking |
| Prompts | Template-based prompt management | ai.definePrompt(), .prompt files |
| Observability | Built-in OpenTelemetry tracing | Automatic span creation, trace correlation |
| Evaluation | Dataset-based quality assessment | DatasetStore, EvalStore, evaluators |
| Deployment | Multi-platform deployment helpers | Firebase, Cloud Run, Express integrations |
Sources: README.md35-70 README.md77-86
To begin using Genkit:
genkit({ plugins: [...] })ai.generate(), ai.chat(), or ai.defineFlow() for your use casegenkit start -- <your-command> to launch the Developer UIFor detailed quickstart guides:
Sources: README.md89-119
Refresh this wiki
This wiki was recently refreshed. Please wait 6 days to refresh again.