Genkit 1.39 Retires the Chat Beta, Lands Production Agents
Genkit JS v1.39.0 removes the beta Chat API and ships defineAgent, a production multi-turn agent framework with Firestore session persistence.

Genkit JS v1.39.0, released June 26, 2026, removes the beta Chat API entirely and replaces it with a production-ready Agents framework. If your app uses ai.chat() or the Chat class, migration is not optional. That code no longer compiles against 1.39.
The change is documented in the v1.39.0 release notes on GitHub (June 26, 2026).
What Changed
The beta Chat class and ai.chat(...) method are gone. The replacement is ai.defineAgent(), which provides everything Chat offered plus the infrastructure developers were building around it manually: stateful sessions, pluggable persistence, streaming, and human-in-the-loop controls.
The new surface looks like this:
import { genkit } from 'genkit';
import { googleAI } from '@genkit-ai/googleai';
const ai = genkit({ plugins: [googleAI()] });
const supportAgent = ai.defineAgent({
name: 'supportAgent',
model: googleAI.model('gemini-2.5-flash'),
system: 'You are a helpful support agent.',
});
const session = await supportAgent.createSession();
const response = await session.chat('What plans do you offer?');
The defineAgent() call replaces the old ai.chat() entry point. Sessions are now explicit objects, not implicit chat instances. That gives you a place to attach persistence, pass custom state schemas via Zod, and re-open sessions by ID across requests.
Key Takeaways
- Migration is required:
ai.chat()and theChatclass are removed in 1.39. Pingenkitto<1.39.0if you need time to migrate, then move fast. defineAgent()is the new entry point for multi-turn AI conversations in Genkit JS.- SessionStore is pluggable: in-memory and file-based options ship in the core package; a
FirestoreSessionStoreis available for production deployments where session state must survive restarts and scale horizontally. - Streaming now delivers JSON Patch state updates, so clients can show incremental state changes (not just token deltas) without polling.
- Human-in-the-loop flows use an interrupt/resume pattern: an agent step can pause for external approval and resume from the same conversation state when the decision arrives.
- Multi-agent delegation: agent middleware handles it; one agent passes context to another without manual state threading.
- Vercel AI SDK integration ships via
GenkitChatTransport, wiringdefineAgentsessions directly into React chat UIs.
Migration Path
The mechanical migration from Chat to Agents is straightforward for most apps:
| Before (≤1.38) | After (1.39+) |
|---|---|
const chat = ai.chat(options) |
const agent = ai.defineAgent(options) |
await chat.send(message) |
const session = await agent.createSession(); await session.chat(message) |
| No built-in persistence | Pass sessionStore: new FirestoreSessionStore(db) to defineAgent |
If you were managing conversation history manually on top of Chat, the new session.chat() interface maintains that history automatically and exposes the full session snapshot for inspection or custom storage.
Production Session Persistence
FirestoreSessionStore is the production addition that matters most for server-side apps. Sessions persist to Firestore using incremental JSON Patch diffs, so a session that spans multiple HTTP requests or scales across Cloud Run instances stays consistent without any additional plumbing.
For local development and testing, the file-based store (FileSessionStore) or the default in-memory store are sufficient.
What This Doesn’t Change
Genkit flows, RAG, tool calling, and MCP support are unaffected by this release. The Chat API was one entry point to multi-turn conversations; everything else in the Genkit stack continues to work as documented. TypeScript and Go remain the two production-stable Genkit runtimes; Python and Dart remain in Preview.
Related
- Firebase SQL Connect Streaming Lands in the JavaScript SDK — the other major SDK update from June 2026.


