{"slug": "genkit-1-39-retires-the-chat-beta-lands-production-agents", "title": "Genkit 1.39 Retires the Chat Beta, Lands Production Agents", "summary": "Genkit JS v1.39.0, released June 26, 2026, removes the beta Chat API and replaces it with a production-ready Agents framework built around defineAgent(), which includes stateful sessions, pluggable persistence via FirestoreSessionStore, streaming with JSON Patch state updates, and human-in-the-loop controls. Developers using ai.chat() or the Chat class must migrate to defineAgent() as the old API no longer compiles against 1.39.", "body_md": "# Genkit 1.39 Retires the Chat Beta, Lands Production Agents\n\nGenkit JS v1.39.0 removes the beta Chat API and ships defineAgent, a production multi-turn agent framework with Firestore session persistence.\n\nGenkit 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()`\n\nor the `Chat`\n\nclass, migration is not optional. That code no longer compiles against 1.39.\n\nThe change is documented in the [v1.39.0 release notes on GitHub](https://github.com/genkit-ai/genkit/releases) (June 26, 2026).\n\n## What Changed\n\nThe beta `Chat`\n\nclass and `ai.chat(...)`\n\nmethod are gone. The replacement is `ai.defineAgent()`\n\n, 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.\n\nThe new surface looks like this:\n\n``` js\nimport { genkit } from 'genkit';\nimport { googleAI } from '@genkit-ai/googleai';\n\nconst ai = genkit({ plugins: [googleAI()] });\n\nconst supportAgent = ai.defineAgent({\n  name: 'supportAgent',\n  model: googleAI.model('gemini-2.5-flash'),\n  system: 'You are a helpful support agent.',\n});\n\nconst session = await supportAgent.createSession();\nconst response = await session.chat('What plans do you offer?');\n```\n\nThe `defineAgent()`\n\ncall replaces the old `ai.chat()`\n\nentry 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.\n\n## Key Takeaways\n\n**Migration is required**:`ai.chat()`\n\nand the`Chat`\n\nclass are removed in 1.39. Pin`genkit`\n\nto`<1.39.0`\n\nif you need time to migrate, then move fast.is the new entry point for multi-turn AI conversations in Genkit JS.`defineAgent()`\n\n**SessionStore** is pluggable: in-memory and file-based options ship in the core package; ais available for production deployments where session state must survive restarts and scale horizontally.`FirestoreSessionStore`\n\n**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`\n\n, wiring`defineAgent`\n\nsessions directly into React chat UIs.\n\n## Migration Path\n\nThe mechanical migration from Chat to Agents is straightforward for most apps:\n\n| Before (≤1.38) | After (1.39+) |\n|---|---|\n`const chat = ai.chat(options)` |\n`const agent = ai.defineAgent(options)` |\n`await chat.send(message)` |\n`const session = await agent.createSession(); await session.chat(message)` |\n| No built-in persistence | Pass `sessionStore: new FirestoreSessionStore(db)` to defineAgent |\n\nIf you were managing conversation history manually on top of Chat, the new `session.chat()`\n\ninterface maintains that history automatically and exposes the full session snapshot for inspection or custom storage.\n\n## Production Session Persistence\n\n`FirestoreSessionStore`\n\nis 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.\n\nFor local development and testing, the file-based store (`FileSessionStore`\n\n) or the default in-memory store are sufficient.\n\n## What This Doesn’t Change\n\nGenkit 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.\n\n## Related\n\n— the other major SDK update from June 2026.[Firebase SQL Connect Streaming Lands in the JavaScript SDK](/blog/firebase-sql-connect-streaming-2026/)", "url": "https://wpnews.pro/news/genkit-1-39-retires-the-chat-beta-lands-production-agents", "canonical_source": "https://firerun.io/blog/genkit-1-39-agents-api-2026/", "published_at": "2026-06-28 00:00:00+00:00", "updated_at": "2026-07-20 19:46:49.267047+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "ai-agents", "large-language-models"], "entities": ["Genkit", "Google AI", "Firestore", "Vercel", "Zod", "Cloud Run"], "alternates": {"html": "https://wpnews.pro/news/genkit-1-39-retires-the-chat-beta-lands-production-agents", "markdown": "https://wpnews.pro/news/genkit-1-39-retires-the-chat-beta-lands-production-agents.md", "text": "https://wpnews.pro/news/genkit-1-39-retires-the-chat-beta-lands-production-agents.txt", "jsonld": "https://wpnews.pro/news/genkit-1-39-retires-the-chat-beta-lands-production-agents.jsonld"}}