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— aMiddlewarePluginthat ships ready-to-use, parameterized Generation Middleware V2 (the Java equivalent of the JS@genkit-ai/middlewarepackage):retry,fallback, andsimulateSystemPrompt. 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 adelegate_to_<name>tool that runs the sub-agent for a single turn and returns its text (plus optional artifacts).Artifacts—read_artifactandwrite_artifacttools 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:
-
ClassDescriptionFactory for sub-agent delegation tools.A namespaced reference to an artifact produced by a sub-agent.Input for a delegation tool.Output for a delegation tool.Options controlling the sub-agent delegation tools produced by
Agents.Builder forAgentsOptions.Factory for artifact tools that let a model read and write named artifacts on the active agent session.Input forread_artifact.Output forread_artifact.Input forwrite_artifact.Output forwrite_artifact.Options controlling the artifact tools produced byArtifacts.Builder forArtifactsOptions.Strategy controlling how artifacts produced by a sub-agent are surfaced back to the delegating model.Falls back to alternate models when the primary model fails.Configuration parameters forFallbackMiddleware.A plugin that ships a set of ready-to-use, parameterized generation middleware.Retries a failed model call with exponential backoff.Configuration parameters forRetryMiddleware.Rewrites asystemmessage into a user/model exchange, for models that do not natively support system prompts.Configuration parameters forSimulateSystemPromptMiddleware.