genkit
LLM FrameworksAn open‑source framework for building full‑stack AI‑powered applications with unified SDKs across multiple languages
Features
- Unified API to integrate hundreds of AI models from providers like Google, OpenAI, Anthropic and Ollama
- Streamlined APIs for structured output, tool calling, multimodal content and RAG workflows
- Cross‑language SDKs (JavaScript/TypeScript, Go, Python Beta, Dart Preview) with consistent capabilities
- Ready‑to‑use client helpers for web frameworks (e.g., Next.js) and mobile platforms (iOS, Android)
- Production‑grade monitoring dashboards for model performance, latency and errors
Security Response History
2 CVEs| CVE | Severity | Disclosed | Patched (this tool) | vs Ecosystem Median |
|---|---|---|---|---|
| CVE-2025-31125 KEV |
medium
CVSS 5.3
|
2025-03-31 | 2026-01-07 | 9mo / median 9mo |
| CVE-2023-4863 KEV |
high
CVSS 8.8
|
2023-09-13 | 2026-01-07 | 2y 4mo / median 2y 4mo |
Recent releases
View all 31 releases →Plugin rename + Vertex AI regions + Gemini model expansion
- Migrate existing code using `Chat`/`ai.chat()`/`session.chat()` to the new Agents API (`defineAgent`, `agent.chat()`).
- If using bidirectional actions or flows, review the updated initialization schema support and streaming changes.
- Removal of the beta Chat API: `Chat` class, `ai.chat(...)`, and `session.chat(...)` are deleted. Migrate to `ai.defineAgent(...)` and use `agent.chat()` instead.
- Agents – a first‑class multi‑turn agent API with stateful chats, typed custom state (Zod), pluggable persistence, streaming patches, interrupts/resume, abort/detach support, and transport‑agnostic usage.
- Agents middleware: `agents()` orchestrator for delegating to sub‑agents and `artifacts()` tools for reading/writing session artifacts.
- FirestoreSessionStore in @genkit-ai/google-cloud (with @genkit-ai/firebase wrapper) persisting agent sessions as incremental JSON Patch diffs with sharded checkpoints.
Full changelog
⚠️ Breaking changes (beta)
- The beta Chat API has been removed and replaced by the new Agents API (#5248, #5251). The
Chatclass,ai.chat(...), andsession.chat(...)are gone. Migrate toai.defineAgent(...)andagent.chat()(see Agents below). All removed surface was beta.
This release introduces Agents, a first-class, multi-turn agent API for Genkit JS. Agents bundle a model/prompt, conversational state, tool loops, interrupts, persistence, streaming, and abort/resume into a single ergonomic, transport-agnostic surface that runs identically in-process on the server and over HTTP from the browser.
Highlights
defineAgent — the new Agents API (#5251)
Define a multi-turn agent in a single call, with three levels of control:
// Zero-config
const agent = ai.defineAgent({
name: 'assistant',
model: 'googleai/gemini-flash-latest',
system: 'You are a helpful assistant.',
tools: [searchTool],
});
// Reuse a registered .prompt (typed promptInput)
const agent = ai.definePromptAgent({ promptName: 'assistant', promptInput: { role: 'pirate' } });
// Full control via a custom turn handler
const agent = ai.defineCustomAgent({ name: 'custom' }, async (runner, input) => { /* ... */ });
Key capabilities:
- Stateful, multi-turn chats —
chat()threadsstate,messages,snapshotId, andsessionIdfor you (send & stream). - Typed custom state with Zod validation (
stateSchema). - Pluggable persistence via
SessionStore(in-memory + file stores included); server-managed sessions resumable bysessionId. - Streaming with live custom-state patches over the wire (JSON Patch).
- Interrupts & resume (
restart/respond) for human-in-the-loop tools. - Abort, detach (background turns) + heartbeats, and graceful failure that preserves the last-good state.
clientTransformto redact/reshape state and stream chunks before they leave the server.- Same API server or browser —
remoteAgent(...)returns the sameAgentAPIshape over HTTP.
Agents middleware: delegation & artifacts (#5252)
New @genkit-ai/middleware middlewares for building multi-agent, artifact-producing workflows:
agents()— turns an agent into an orchestrator that delegates to other registered agents. Injects a dedicateddelegate_to_<agent>tool per sub-agent, auto-discovers descriptions, returns sub-agent interrupts/failures as tool results, and adds guard rails (maxDelegations,historyLength).artifacts()— gives the modelread_artifact/write_artifacttools backed by session state, with an<artifacts>listing injected each turn. Pair withagents({ artifactStrategy: 'session' })so an orchestrator can read artifacts produced by its sub-agents.
useChat adapter for Agents — @genkit-ai/vercel-ai (#5426)
A new plugin providing a Vercel AI SDK ChatTransport that wires useChat directly to Genkit Agents, so you can build rich React chat UIs (Next.js, Vite) with zero custom plumbing:
GenkitChatTransport— drop-inChatTransport, compatible with AI Elements.- Server-managed sessions keyed by the
useChatid(no client-side snapshot bookkeeping). - First-class interrupts mapped onto the AI SDK's native HITL primitives (respond + restart).
- Mapping utilities to convert between Vercel
UIMessageand GenkitMessageData. - Ships a full sample app at
js/testapps/vercel-ai-elements.
Firestore session store (#5586)
FirestoreSessionStore for persisting agent sessions, in @genkit-ai/google-cloud with a thin @genkit-ai/firebase wrapper. It persists each turn as an incremental JSON Patch diff anchored to periodic, sharded full-state checkpoints, so no document approaches Firestore's 1 MiB limit, per-turn reads/writes stay bounded regardless of session length, and reconstruction is strongly consistent without secondary indexes. Tunable via collection, checkpointInterval, and shardSize.
Supporting changes
- Initialization data for flows & actions (#5247) — flows/actions can declare an
initSchemaand receive validatedinitdata (separate frominput) over HTTP. Plumbed throughgenkit/beta/client(runFlow/streamFlow) and the express, fastify, fetch, and next handlers. - Bidi actions and flows (#4288) — foundational support for bidirectional (streaming both ways) actions and flows.
Full Changelog: https://github.com/genkit-ai/genkit/compare/v1.38.0...v1.39.0
Weekly OSS security release digest.
The CVE patches and breaking changes that affected production tools this week. One email, every Sunday.
No spam, unsubscribe anytime.