Class AgentConfig<S>

java.lang.Object
com.google.genkit.agent.AgentConfig<S>
Type Parameters:
S - the type of custom session state

public final class AgentConfig<S> extends Object
Facade-level configuration for the ergonomic, prompt-backed agents created via GenkitBeta.defineAgent and GenkitBeta.definePromptAgent.

Unlike CustomAgentConfig (which requires the caller to supply the per-turn AgentFn themselves), this config captures the high-level pieces of a generate-backed agent — model, system prompt, tools, generation config — and the defineAgent implementation synthesizes the AgentFn that calls generate.

The only required field is getName().

  • Method Details

    • builder

      public static <S> AgentConfig.Builder<S> builder()
      Creates a builder for AgentConfig.
      Type Parameters:
      S - the type of custom session state
      Returns:
      a new builder
    • getName

      public String getName()
      Returns the agent's registered name.
      Returns:
      the agent name (never null on a built config)
    • getDescription

      public String getDescription()
      Returns the agent's human-readable description.
      Returns:
      the description, or null if not set
    • getModel

      public String getModel()
      Returns the model name to use for generation.
      Returns:
      the model name, or null to rely on the Genkit default model
    • getSystem

      public String getSystem()
      Returns the system prompt for the agent.
      Returns:
      the system prompt, or null if not set
    • getTools

      public List<Tool<?,?>> getTools()
      Returns the tools available to the agent.
      Returns:
      the tools, or null if not set
    • getConfig

      public GenerationConfig getConfig()
      Returns the generation configuration.
      Returns:
      the config, or null if not set
    • getMaxTurns

      public Integer getMaxTurns()
      Returns the maximum number of tool-execution turns for a single generate call.
      Returns:
      the max turns, or null to use the generate default
    • getStore

      public SessionStore<S> getStore()
      Returns the session store for server-managed agents.

      When null, the agent operates in client-managed mode.

      Returns:
      the session store, or null for client-managed mode
    • getStateType

      public Class<S> getStateType()
      Returns the Java class for the agent's custom state type.
      Returns:
      the state type class, or null if not specified
    • getClientTransform

      public ClientTransform<S> getClientTransform()
      Returns the client-transform applied to session state before returning it to the caller in client-managed mode.
      Returns:
      the client transform, or null if not set
    • getPromptName

      public String getPromptName()
      Returns the name of a registered prompt to drive definePromptAgent.
      Returns:
      the prompt name, or null if not set
    • getPromptInput

      public Object getPromptInput()
      Returns the input passed to the prompt for definePromptAgent.
      Returns:
      the prompt input, or null if not set