Skip to content

Genkit JS 1.42.0

Latest

Choose a tag to compare

@pavelgj pavelgj released this 02 Sep 00:35

New: A2UI plugin (@genkit-ai/a2ui)

A new plugin that lets an agent stream A2UI ("Agent to UI") surfaces, rich interactive UI rendered incrementally by the client, instead of just prose. Server integration is a single model middleware you drop into an agent's use array. It injects the catalog's capabilities into the system prompt, then intercepts streamed and final model output, extracts a2ui blocks, validates them against the catalog, and rewrites them into A2UI data parts. A browser-safe /client entrypoint (a2uiEnvelopes, actionToMessage) feeds envelopes to a renderer and sends user actions back to the agent. Ships with a runnable js/testapps/a2ui sample (Express backend + Vite/Lit frontend). Note: this is an early proof-of-concept. (#5795, #6209, #6222)

import { genkit } from 'genkit/beta';
import { googleAI } from '@genkit-ai/google-genai';
import { a2ui } from '@genkit-ai/a2ui';

const ai = genkit({ plugins: [googleAI()] });

export const uiAgent = ai.defineAgent({
  name: 'uiAgent',
  model: 'googleai/gemini-flash-latest',
  system: 'You help users. Render UI when it is clearer than prose.',
  use: [a2ui()], // the only A2UI-specific line
});

Features

  • OpenTelemetry logs are now enabled by default; the GENKIT_OTEL_ENABLE_LOGS flag has been removed, and custom log record processors set in telemetryConfig are no longer overwritten. (#6069)

Bug Fixes

  • plugins/google-genai: Surface API errors from streaming responses by mapping HTTP status codes to Genkit statuses and parsing JSON error bodies returned with HTTP 200 (e.g. overloaded models), so middleware like retry can react appropriately. (#6170)
  • plugins/compat-oai: Fix inverted 401/403 status mapping so a bad or missing API key now surfaces as UNAUTHENTICATED instead of PERMISSION_DENIED; affects all compat-oai based providers (openai, xai, deepseek). (#6151)
  • Add prompt name to render span metadata for better Dev UI usability. (#6025)

Full Changelog: https://github.com/genkit-ai/genkit/compare/genkit@1.41.0...genkit@1.42.0