@genkit-ai/compat-oai
1.44.0 · 3 Nov 2026Apache-2.026.5k / weekRepositoryHomepagenpmAtom feed
1.44.0 is the newest release of 1.x.
In short
1 breaking15 new2 changed
- Breaking
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.
Release note
Breaking changes (beta)
- Breaking
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.
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.