Package com.google.genkit.agent
Class AgentConfig<S>
java.lang.Object
com.google.genkit.agent.AgentConfig<S>
- Type Parameters:
S- the type of custom session state
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().
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic <S> AgentConfig.Builder<S> builder()Creates a builder for AgentConfig.Returns the client-transform applied to session state before returning it to the caller in client-managed mode.Returns the generation configuration.Returns the agent's human-readable description.Returns the maximum number of tool-execution turns for a single generate call.getModel()Returns the model name to use for generation.getName()Returns the agent's registered name.Returns the input passed to the prompt fordefinePromptAgent.Returns the name of a registered prompt to drivedefinePromptAgent.Returns the Java class for the agent's custom state type.getStore()Returns the session store for server-managed agents.Returns the system prompt for the agent.getTools()Returns the tools available to the agent.
-
Method Details
-
builder
Creates a builder for AgentConfig.- Type Parameters:
S- the type of custom session state- Returns:
- a new builder
-
getName
Returns the agent's registered name.- Returns:
- the agent name (never null on a built config)
-
getDescription
Returns the agent's human-readable description.- Returns:
- the description, or
nullif not set
-
getModel
Returns the model name to use for generation.- Returns:
- the model name, or
nullto rely on the Genkit default model
-
getSystem
Returns the system prompt for the agent.- Returns:
- the system prompt, or
nullif not set
-
getTools
Returns the tools available to the agent.- Returns:
- the tools, or
nullif not set
-
getConfig
Returns the generation configuration.- Returns:
- the config, or
nullif not set
-
getMaxTurns
Returns the maximum number of tool-execution turns for a single generate call.- Returns:
- the max turns, or
nullto use the generate default
-
getStore
Returns the session store for server-managed agents.When
null, the agent operates in client-managed mode.- Returns:
- the session store, or
nullfor client-managed mode
-
getStateType
Returns the Java class for the agent's custom state type.- Returns:
- the state type class, or
nullif not specified
-
getClientTransform
Returns the client-transform applied to session state before returning it to the caller in client-managed mode.- Returns:
- the client transform, or
nullif not set
-
getPromptName
Returns the name of a registered prompt to drivedefinePromptAgent.- Returns:
- the prompt name, or
nullif not set
-
getPromptInput
Returns the input passed to the prompt fordefinePromptAgent.- Returns:
- the prompt input, or
nullif not set
-