
Google on May 24, 2026 introduced a middleware architecture for Genkit that inserts a programmable interception layer around every generate() call, model invocation and tool execution. The change gives developers explicit runtime hooks to govern agentic behavior in production — enabling retries, model fallbacks, approval gates and access controls without changing core application logic. For builders, that means concrete levers to improve reliability, safety and orchestration when embedding agentic features into apps.
Under the new design, Genkit routes each generate() invocation through a tool loop: the model produces output, configured tools run, results are processed, and the cycle repeats until completion. Middleware hooks can intercept the loop at three levels — generation, model calls and tool execution — so teams can implement behaviors such as retries with exponential backoff, automatic fallbacks to alternate models when APIs fail, logging and other runtime policies in a modular way.
Google ships several prebuilt middleware components with the release. Available pieces include retry handling with exponential backoff, automatic fallback to alternative models, approval gates for sensitive tool calls, filesystem access controls and a “skills” system that injects instructions from local files. Components can be stacked into ordered pipelines — combining retries, filters, approvals and observability — to shape end-to-end runtime behavior. The middleware is integrated with the Genkit Developer UI, enabling engineers to inspect middleware behavior, trace execution flows and debug runtime interactions during development. Google presents this visibility as a complement to the programmable hooks: teams can both enforce runtime policies and investigate why an agent took a particular action without altering application code.
Google clarified how Genkit fits alongside its Agent Development Kit (ADK). Engineer Michael Doyle said Genkit is intended for adding agentic features to existing applications — web, mobile and similar — while ADK targets more complex, standalone multi‑agent systems typically run on GCP’s Agent Platform. The distinction frames Genkit as a runtime and orchestration layer for embedding agents into apps, rather than a platform for building large multi‑agent deployments.
Developers can begin using the middleware immediately via the latest Genkit release and may publish custom middleware packages for reuse across projects. Genkit currently supports TypeScript, Go and Dart, with Python support planned, allowing teams across languages to adopt the interception layer and apply standardized runtime controls to agentic features in production.
Sources
Replies (0)
No replies in this topic yet.