Package com.google.genkit.ai
Class AgentConfig
java.lang.Object
com.google.genkit.ai.AgentConfig
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();
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic AgentConfig.Builderbuilder()Creates a new builder.Gets the sub-agents (agents that can be delegated to).Gets the generation config.Gets the description.getModel()Gets the model name.getName()Gets the agent name.Gets the output config.Gets the system prompt.getTools()Gets the tools available to this agent.voidsetAgents(List<AgentConfig> agents) Sets the sub-agents.voidsetConfig(GenerationConfig config) Sets the generation config.voidsetDescription(String description) Sets the description (used when agent is called as a tool).voidSets the model name.voidSets the agent name.voidsetOutput(OutputConfig output) Sets the output config.voidSets the system prompt.voidSets the tools available to this agent.
-
Constructor Details
-
AgentConfig
public AgentConfig()Default constructor.
-
-
Method Details
-
getName
Gets the agent name.- Returns:
- the name
-
setName
Sets the agent name.- Parameters:
name- the name
-
getDescription
Gets the description.- Returns:
- the description
-
setDescription
Sets the description (used when agent is called as a tool).- Parameters:
description- the description
-
getSystem
Gets the system prompt.- Returns:
- the system prompt
-
setSystem
Sets the system prompt.- Parameters:
system- the system prompt
-
getModel
Gets the model name.- Returns:
- the model name
-
setModel
Sets the model name.- Parameters:
model- the model name
-
getTools
Gets the tools available to this agent.- Returns:
- the tools
-
setTools
Sets the tools available to this agent.- Parameters:
tools- the tools
-
getAgents
Gets the sub-agents (agents that can be delegated to).- Returns:
- the sub-agents
-
setAgents
Sets the sub-agents.- Parameters:
agents- the sub-agents
-
getConfig
Gets the generation config.- Returns:
- the generation config
-
setConfig
Sets the generation config.- Parameters:
config- the generation config
-
getOutput
Gets the output config.- Returns:
- the output config
-
setOutput
Sets the output config.- Parameters:
output- the output config
-
builder
Creates a new builder.- Returns:
- a new builder
-