Class AgentConfig

java.lang.Object
com.google.genkit.ai.AgentConfig

public class AgentConfig extends Object
Configuration for defining an agent (prompt as tool).

An agent is a specialized prompt that can be used as a tool, enabling multi-agent systems where one agent can delegate tasks to other specialized agents.

Example usage:


 // Define a specialized agent
 AgentConfig reservationAgent = AgentConfig.builder().name("reservationAgent")
 		.description("Handles restaurant reservations")
 		.system("You are a reservation specialist. Help users make and manage reservations.").model("openai/gpt-4o")
 		.tools(List.of(reservationTool, cancelTool)).build();

 // Use as a tool in a triage agent
 AgentConfig triageAgent = AgentConfig.builder().name("triageAgent")
 		.description("Routes customer requests to appropriate specialists")
 		.system("You are a customer service triage agent...").agents(List.of(reservationAgent, menuAgent)) // Sub-agents
 																											// as
 																											// tools
 		.build();
 
  • Constructor Details

    • AgentConfig

      public AgentConfig()
      Default constructor.
  • Method Details

    • getName

      public String getName()
      Gets the agent name.
      Returns:
      the name
    • setName

      public void setName(String name)
      Sets the agent name.
      Parameters:
      name - the name
    • getDescription

      public String getDescription()
      Gets the description.
      Returns:
      the description
    • setDescription

      public void setDescription(String description)
      Sets the description (used when agent is called as a tool).
      Parameters:
      description - the description
    • getSystem

      public String getSystem()
      Gets the system prompt.
      Returns:
      the system prompt
    • setSystem

      public void setSystem(String system)
      Sets the system prompt.
      Parameters:
      system - the system prompt
    • getModel

      public String getModel()
      Gets the model name.
      Returns:
      the model name
    • setModel

      public void setModel(String model)
      Sets the model name.
      Parameters:
      model - the model name
    • getTools

      public List<Tool<?,?>> getTools()
      Gets the tools available to this agent.
      Returns:
      the tools
    • setTools

      public void setTools(List<Tool<?,?>> tools)
      Sets the tools available to this agent.
      Parameters:
      tools - the tools
    • getAgents

      public List<AgentConfig> getAgents()
      Gets the sub-agents (agents that can be delegated to).
      Returns:
      the sub-agents
    • setAgents

      public void setAgents(List<AgentConfig> agents)
      Sets the sub-agents.
      Parameters:
      agents - the sub-agents
    • getConfig

      public GenerationConfig getConfig()
      Gets the generation config.
      Returns:
      the generation config
    • setConfig

      public void setConfig(GenerationConfig config)
      Sets the generation config.
      Parameters:
      config - the generation config
    • getOutput

      public OutputConfig getOutput()
      Gets the output config.
      Returns:
      the output config
    • setOutput

      public void setOutput(OutputConfig output)
      Sets the output config.
      Parameters:
      output - the output config
    • builder

      public static AgentConfig.Builder builder()
      Creates a new builder.
      Returns:
      a new builder