Class Artifacts

java.lang.Object
com.google.genkit.plugins.middleware.Artifacts

public final class Artifacts extends Object
Factory for artifact tools that let a model read and write named artifacts on the active agent session.

Both tools operate on AgentSessionContext.currentArtifactStore(). When no agent session is bound to the current thread, the tools degrade gracefully: read_artifact reports found = false and write_artifact reports a "no active session" status without throwing.

Usage:


 AgentConfig.builder()
     .name("writer")
     .tools(Artifacts.tools(ArtifactsOptions.defaults()))
     .build();
 
  • Field Details

  • Method Details

    • tools

      public static List<Tool<?,?>> tools()
      Builds the artifact tools using default options (read_artifact + write_artifact).
      Returns:
      the artifact tools
    • tools

      public static List<Tool<?,?>> tools(ArtifactsOptions options)
      Builds the artifact tools.

      Always includes read_artifact. Includes write_artifact unless options.isReadonly() is true.

      Parameters:
      options - the options (must not be null)
      Returns:
      the artifact tools