Package com.google.genkit.plugins.middleware


package com.google.genkit.plugins.middleware
Middleware plugin for Genkit providing higher-level generation building blocks.

This module provides:

  • GenerationMiddlewarePlugin — a MiddlewarePlugin that ships ready-to-use, parameterized Generation Middleware V2 (the Java equivalent of the JS @genkit-ai/middleware package): retry, fallback, and simulateSystemPrompt. Each is registered into the "middleware" bucket and appears in the Genkit Dev UI Middleware panel with a parameters form.
  • Agents — sub-agent delegation, where each configured sub-agent is exposed to the model as a delegate_to_<name> tool that runs the sub-agent for a single turn and returns its text (plus optional artifacts).
  • Artifactsread_artifact and write_artifact tools operating on the active agent session's artifact store.

Agents and Artifacts are implemented as tool factories: they return List<Tool<?, ?>> (and, for agents(), a system-prompt fragment) that callers wire into an agent via AgentConfig.tools(...) and AgentConfig.system(...).

See Also: