Class AgentConfig.Builder<S>

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

public static final class AgentConfig.Builder<S> extends Object
Builder for AgentConfig.
  • Method Details

    • name

      public AgentConfig.Builder<S> name(String name)
      Sets the agent's registered name (required).
      Parameters:
      name - the agent name
      Returns:
      this builder
    • description

      public AgentConfig.Builder<S> description(String description)
      Sets the agent's human-readable description.
      Parameters:
      description - the description
      Returns:
      this builder
    • model

      public AgentConfig.Builder<S> model(String model)
      Sets the model name to use for generation. When null, the Genkit default model is used.
      Parameters:
      model - the model name
      Returns:
      this builder
    • system

      public AgentConfig.Builder<S> system(String system)
      Sets the system prompt for the agent.
      Parameters:
      system - the system prompt
      Returns:
      this builder
    • tools

      public AgentConfig.Builder<S> tools(List<Tool<?,?>> tools)
      Sets the tools available to the agent.
      Parameters:
      tools - the tools
      Returns:
      this builder
    • tools

      public AgentConfig.Builder<S> tools(Tool<?,?>... tools)
      Sets the tools available to the agent.
      Parameters:
      tools - the tools
      Returns:
      this builder
    • config

      public AgentConfig.Builder<S> config(GenerationConfig config)
      Sets the generation configuration.
      Parameters:
      config - the config
      Returns:
      this builder
    • maxTurns

      public AgentConfig.Builder<S> maxTurns(Integer maxTurns)
      Sets the maximum number of tool-execution turns for a single generate call.
      Parameters:
      maxTurns - the max turns
      Returns:
      this builder
    • store

      public AgentConfig.Builder<S> store(SessionStore<S> store)
      Sets the session store for server-managed mode. Pass null (or omit) for client-managed mode.
      Parameters:
      store - the session store
      Returns:
      this builder
    • stateType

      public AgentConfig.Builder<S> stateType(Class<S> stateType)
      Sets the Java class for the agent's custom state type.
      Parameters:
      stateType - the state type class
      Returns:
      this builder
    • clientTransform

      public AgentConfig.Builder<S> clientTransform(ClientTransform<S> clientTransform)
      Sets the client-transform applied to session state before returning it to the caller in client-managed mode.
      Parameters:
      clientTransform - the transform
      Returns:
      this builder
    • promptName

      public AgentConfig.Builder<S> promptName(String promptName)
      Sets the name of a registered prompt to drive definePromptAgent.
      Parameters:
      promptName - the prompt name
      Returns:
      this builder
    • promptInput

      public AgentConfig.Builder<S> promptInput(Object promptInput)
      Sets the input passed to the prompt for definePromptAgent.
      Parameters:
      promptInput - the prompt input
      Returns:
      this builder
    • build

      public AgentConfig<S> build()
      Builds the AgentConfig.
      Returns:
      a new AgentConfig
      Throws:
      IllegalStateException - if name is null or blank