By Robert Krzaczyński
Publication Date: 2026-05-24 17:55:00
Google has introduced Middleware for Genkit, its open-source framework for building AI-powered and agentic applications. The update adds a programmable interception layer around model calls, tool execution, and generation loops, giving developers more control over reliability, safety, and orchestration inside production AI systems.
The release enhances Genkit by enabling developers to inject custom behaviors into workflows. Middleware can now add features like retries, model fallbacks, and logging without changing application logic. Genkit supports TypeScript, Go, and Dart, with Python support coming soon.
According to Google, every generate() call in Genkit operates through a tool loop in which the model generates output, executes tools, processes results, and continues until completion. Middleware hooks can intercept that cycle at three levels: generation, model calls, and tool execution.
Google also released several prebuilt middleware components. These include retry…