{"slug": "genkit-agents-api-build-full-stack-ai-agents-in-typescript", "title": "Genkit Agents API: Build Full-Stack AI Agents in TypeScript", "summary": "Google shipped the Genkit Agents API on July 1 in preview for TypeScript and Go, offering a single chat() interface for building full-stack AI agents that integrate into existing backends rather than replacing them. The API supports detached turns for long-running tasks, interruptible tools requiring human approval with anti-forgery validation, and two state management models with built-in Firestore, in-memory, and file-based stores.", "body_md": "Google shipped the Genkit Agents API on July 1 — in preview for TypeScript and Go — and it makes a bet most agent frameworks are too timid to make: agents belong inside your app, not on top of it. Most frameworks want to become your backend. Genkit wants to be a feature you add to the backend you already have. One `chat()`\n\ninterface, detached long-running turns, tools that stop and ask a human before proceeding, and state persistence that adapts to your architecture — whether you run on Firebase, Cloud Run, or anything that handles HTTP. If you’ve been stuffing polling loops, job queues, and WebSocket boilerplate into your AI integration, this is worth checking out.\n\n## One Interface for Every Agent Pattern\n\nThe design center of the Genkit Agents API is a single `chat()`\n\nobject that handles every interaction pattern: one-shot replies, streamed multi-turn conversations, tool calls waiting on human approval, and long-running detached tasks. Same interface in development and production. Same interface whether the agent runs in-process or behind an HTTP endpoint.\n\nConnecting a frontend to a remote Genkit agent looks like this:\n\n``` js\nimport { remoteAgent } from 'genkit/beta/client';\n\nconst agent = remoteAgent<WeatherState>({\n  url: 'http://localhost:8080/api/weatherAgent',\n});\n\nconst chat = agent.chat();\nconst res = await chat.send('Weather in Tokyo?');\nconsole.log(res.text);\n```\n\nThe same `chat`\n\nobject you use to drive a simple chatbot in tests drives it from the browser. If you’re building with Next.js, there’s a `GenkitChatTransport`\n\nadapter for the Vercel AI SDK that plugs directly into `useChat`\n\n— no custom transport layer needed.\n\n## Detached Turns: Let the Agent Work While the Client Moves On\n\nHere’s the problem every developer building serious AI integrations runs into: the agent task takes thirty seconds. Maybe two minutes. Do you hold the HTTP connection open? Build a job queue? Stand up WebSockets? None of those feel right for what should be a routine “do this and tell me when you’re done” interaction.\n\nDetached turns are Genkit’s answer. The client kicks off a task and disconnects. The agent keeps running server-side, writing progress to snapshots. The client polls — or reconnects later — by snapshot ID:\n\n``` js\nconst task = await chat.detach('Write the quarterly market report.');\n\nfor await (const snapshot of task.poll({ intervalMs: 1000 })) {\n  renderStatus(snapshot.status);\n}\n```\n\nThis is not an edge case. Any agent doing real work — multi-step planning, extended research, document analysis — needs async execution. Genkit bakes it into the API surface rather than leaving it as an exercise for the developer.\n\n## Interruptible Tools: Agents That Ask Before They Act\n\nThe moment an agent has permission to write to a database, call a payment API, or modify files, the stakes change. You need a way to pause execution, surface the proposed action to a human, and only proceed on approval.\n\nGenkit calls these interruptible tools. Mark a tool as interruptible, and when the model selects it, the agent pauses and returns a pending action instead of executing immediately. The detail worth noting: the runtime validates the resume payload against session history. A client cannot forge an approval for an action the session never generated. That anti-forgery check is easy to overlook in the docs and harder than it sounds to implement correctly from scratch.\n\n## State Management: Two Models, Clear Trade-offs\n\nState management is where Genkit forces a decision most frameworks paper over. You get two models:\n\n**Server-managed state**— the agent persists messages, custom state, and artifacts as snapshots. Clients reconnect by session ID. You can branch from a specific snapshot without disturbing the original thread. Built-in session stores: Firestore for production multi-instance deployments, in-memory for local development, file-based for local testing. Pluggable interface for custom stores.**Client-managed state**— the server returns full state every turn; the client sends it back on the next. Suits stateless deployments and data residency requirements. Trade-off: network payload grows as conversations lengthen.\n\nWithin state, Genkit separates two concerns: **custom state** (your typed application data — workflow status, selected entities, task lists) and **artifacts** (generated outputs a user can inspect or download). Keeping these distinct makes building multi-step agentic workflows considerably less messy.\n\n## Genkit vs. ADK: These Are Not the Same Product\n\nADK is built for multi-agent orchestration as a complete system — it assumes agents are your product and targets managed infrastructure on the Gemini Enterprise Agent Platform. The [InfoQ technical breakdown](https://www.infoq.com/news/2026/07/genkit-agents-api-preview/) of the two frameworks is clear on this distinction.\n\nThe Genkit Agents API is built for agents as a feature inside an app you’re already building. You host it wherever Node.js or Go runs. You own the deployment. The scope is deliberately narrower — and that’s the right call for most web and mobile developers. Use ADK when multi-agent orchestration becomes your entire system. Use Genkit when you’re adding agents to something you’re already shipping.\n\n## What’s Not Ready Yet\n\nPython developers: the Agents API is not available to you yet. Python has Genkit support in beta, but the Agents API is TypeScript and Go only. Dart is in the same position. No timeline has been given for either language — a real limitation that the announcement doesn’t surface prominently enough.\n\nThe preview status means breaking changes can arrive in minor version releases. The ecosystem is also younger than [LangChain’s 700-plus integrations](https://www.langchain.com/resources/ai-agent-frameworks). And Google’s product history creates reasonable skepticism about long-term commitment. None of these are reasons to ignore it — they’re reasons to go in with clear eyes.\n\n## Getting Started\n\nThe [Genkit documentation](https://genkit.dev/) has the full Agents API guide, including session store configuration and the Agent Runner in the developer UI — a testing interface that lets you drive interrupts and inspect snapshots without writing client code. The framework is open-source under Apache 2.0 on [GitHub](https://github.com/firebase/genkit). The [Google Developers Blog announcement](https://developers.googleblog.com/build-agentic-full-stack-apps-with-genkit/) covers the full-stack architecture in detail.\n\nIf you’re already using Genkit for AI features in a TypeScript or Go app, the Agents API is the upgrade that makes the framework production-capable for real agentic workflows. If you’re evaluating frameworks fresh, the full-stack story — server-side logic, typed client SDK, built-in streaming, no runtime vendor lock-in — is worth serious consideration.", "url": "https://wpnews.pro/news/genkit-agents-api-build-full-stack-ai-agents-in-typescript", "canonical_source": "https://byteiota.com/genkit-agents-api-build-full-stack-ai-agents-in-typescript/", "published_at": "2026-07-21 21:10:19+00:00", "updated_at": "2026-07-21 21:34:45.775063+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "ai-infrastructure", "developer-tools", "generative-ai"], "entities": ["Google", "Genkit Agents API", "TypeScript", "Go", "Firebase", "Cloud Run", "Firestore", "Vercel AI SDK"], "alternates": {"html": "https://wpnews.pro/news/genkit-agents-api-build-full-stack-ai-agents-in-typescript", "markdown": "https://wpnews.pro/news/genkit-agents-api-build-full-stack-ai-agents-in-typescript.md", "text": "https://wpnews.pro/news/genkit-agents-api-build-full-stack-ai-agents-in-typescript.txt", "jsonld": "https://wpnews.pro/news/genkit-agents-api-build-full-stack-ai-agents-in-typescript.jsonld"}}