Skip to main content
Genkit provides a comprehensive collection of examples and sample applications to help you get started and learn different features of the framework.

Interactive Examples

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

Genkit by Example

Explore interactive examples in your browser

Sample Applications by Language

JavaScript/TypeScript Samples

The JavaScript samples demonstrate various Genkit features and use cases:

Basic Samples

Coffee Shop

Simple “AI barista” demonstrating basic LLM usage

Gemini Basics

Getting started with Google’s Gemini models

OpenAI Integration

Using OpenAI models with Genkit

Prompting Techniques

Various prompting patterns and techniques

Intermediate Samples

Menu Understanding

Progressive restaurant menu app with 5 iterations:
  • Basic prompts with templates
  • Flows with strong schemas and tools
  • Multi-turn chat with session history
  • Vector database and RAG
  • Vision model for photo menu ingestion

Character Generator

RPG character generation with structured output

Chatbot

Full-stack chatbot with JavaScript frontend and multi-model support

Angular Streaming

Angular application with streaming AI responses

Advanced Samples

School Agent System

Multi-agent architecture with routing:
  • RoutingAgent: Main entry point and router
  • AttendanceAgent: Specialized for absence/tardy reporting
  • GradesAgent: Manages academic performance queries
Demonstrates agent handoff, specialized tools, and separation of concerns

Go Samples

The Go SDK includes extensive samples covering various capabilities:

Basic Go Samples

  • basic: Simple text generation
  • basic-prompts: Working with prompt templates
  • basic-structured: Structured output generation
  • anthropic: Using Anthropic Claude models
  • coffee-shop: AI barista example in Go

Model Integration Samples

  • gemini: Google Gemini integration
  • cache-gemini: Context caching with Gemini
  • code-execution-gemini: Server-side code execution
  • imagen: Image generation with Imagen
  • imagen-gemini: Combined image and text generation
  • compat_oai: OpenAI-compatible API integration (Anthropic, Custom, OpenAI)

Advanced Go Samples

  • flow-sample1: Building flows
  • formats: Output formatting examples
  • intermediate-interrupts: Human-in-the-loop workflows
  • durable-streaming: Streaming with durability
  • durable-streaming-firestore: Streaming with Firestore backend
  • firebase-retrievers: Firebase vector search integration
  • files-api-vision: Vision with Files API
  • menu: Restaurant menu understanding (Go port)

MCP (Model Context Protocol) Samples

  • mcp-client: MCP client implementation
  • mcp-server: MCP server with client example
  • mcp-ception: Advanced MCP patterns
  • mcp-git-pr-explainer: GitHub PR analysis using MCP

View All Go Samples

Browse the complete Go samples directory

Python Samples (Alpha)

Python samples are organized by category with consistent structure:

Model Provider Samples

  • provider-google-genai-hello: Gemini with Google AI
  • provider-google-genai-vertexai-hello: Gemini with Vertex AI
  • provider-google-genai-code-execution: Server-side code execution
  • provider-google-genai-context-caching: Context caching for long prompts
  • provider-google-genai-vertexai-image: Imagen image generation
  • provider-google-genai-media-models-demo: TTS, Veo, Lyria, Imagen, editing
  • provider-anthropic-hello: Claude models
  • provider-amazon-bedrock-hello: AWS Bedrock (Claude, Llama, Nova)
  • provider-microsoft-foundry-hello: Azure AI Foundry + Application Insights
  • provider-ollama-hello: Local models with Ollama
  • provider-compat-oai-hello: OpenAI-compatible APIs
  • provider-deepseek-hello: DeepSeek V3 and R1
  • provider-xai-hello: Grok models
  • provider-cloudflare-workers-ai-hello: Cloudflare Workers AI
  • provider-mistral-hello: Mistral models
  • provider-huggingface-hello: HuggingFace Inference API
  • provider-cohere-hello: Cohere models and embeddings
  • provider-vertex-ai-model-garden: Third-party models via Model Garden
  • provider-vertex-ai-rerank-eval: Rerankers and evaluators
  • provider-vertex-ai-vector-search-bigquery: BigQuery with vectors
  • provider-vertex-ai-vector-search-firestore: Firestore with vectors
  • provider-firestore-retriever: Firestore vector search
  • provider-checks-hello: Google Checks AI safety guardrails
  • provider-observability-hello: Sentry, Honeycomb, Datadog, Grafana, Axiom

Framework Feature Samples

  • framework-context-demo: Context propagation through flows
  • framework-dynamic-tools-demo: Dynamic tool registration
  • framework-evaluator-demo: Custom evaluators and RAGAS
  • framework-format-demo: Output formatting and schemas
  • framework-middleware-demo: Custom retry and logging middleware
  • framework-prompt-demo: Dotprompt features (picoschema, roles, media, variants, helpers)
  • framework-realtime-tracing-demo: Real-time tracing visualization
  • framework-restaurant-demo: Restaurant ordering with tools and RAG
  • framework-tool-interrupts: Human-in-the-loop tool approval

Web Framework Samples

  • web-endpoints-hello: FastAPI, Litestar, Quart, gRPC endpoints
  • web-fastapi-bugbot: AI code reviewer with streaming SSE
  • web-flask-hello: Flask HTTP endpoints
  • web-multi-server: Multiple Genkit servers (Litestar, Starlette)
  • web-short-n-long: ASGI deployment with long-running flows

View All Python Samples

Browse the complete Python samples directory with detailed README

Running Samples

JavaScript/TypeScript

cd samples/<sample-name>
npm install
export GEMINI_API_KEY=your_api_key  # or other provider key
npm run genkit:dev
Access the Developer UI at http://localhost:4000

Go

cd go/samples/<sample-name>
go mod tidy
export GOOGLE_GENAI_API_KEY=your_api_key
genkit start -- go run .
Access the Developer UI at http://localhost:4000

Python

cd py/samples/<sample-name>
./run.sh  # Starts DevUI and runs with hot reload
Each Python sample includes a run.sh script with automatic dependency installation and hot reloading.

Try in Cloud IDEs

IDX (Google)

Try JavaScript samples in Google’s Cloud-Based IDE: Try in IDX

Firebase Studio

Skip local setup entirely and try Genkit using Firebase Studio: Open in Firebase Studio

Sample Categories

By Complexity

  • Basic: Simple single-feature demonstrations (coffee-shop, basic prompts, simple generation)
  • Intermediate: Multi-feature integration (menu app, chatbot, character generator, streaming)
  • Advanced: Complex architectures (multi-agent systems, RAG pipelines, MCP integration)

By Feature

  • Text Generation: coffee-shop, gemini, openai, prompts
  • Structured Output: character-generator, basic-structured, formats
  • Tool Calling: menu (step 2+), schoolAgent, framework-dynamic-tools-demo
  • Chat/Sessions: chatbot, angular, framework-restaurant-demo
  • RAG: menu (step 4), framework-restaurant-demo
  • Multimodal: menu (step 5), files-api-vision, imagen samples, media-models-demo
  • Streaming: angular, chatbot, durable-streaming, fastapi-bugbot
  • Multi-Agent: schoolAgent
  • Evaluation: framework-evaluator-demo, vertex-ai-rerank-eval

Contributing Examples

We welcome new examples! See our Contributing Guide for guidelines on:
  • Example structure and naming conventions
  • Documentation requirements
  • Testing and validation
  • Submitting pull requests

Additional Resources

Community Examples

Community-contributed samples and examples

Documentation

Official Genkit documentation

GitHub Discussions

Ask questions and share your examples

Discord Community

Get help and connect with other developers

Build docs developers (and LLMs) love