Class LlmAgent.Builder
- Enclosing class:
LlmAgent
Builder for
LlmAgent.-
Field Summary
Fields inherited from class BaseAgent.Builder
afterAgentCallback, beforeAgentCallback, description, name, subAgentsModifier and TypeFieldDescriptionprotected com.google.common.collect.ImmutableList<Callbacks.AfterAgentCallback> protected com.google.common.collect.ImmutableList<Callbacks.BeforeAgentCallback> protected Stringprotected Stringprotected com.google.common.collect.ImmutableList<BaseAgent> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionafterAgentCallbackSync(Callbacks.AfterAgentCallbackSync afterAgentCallbackSync) afterModelCallback(Callbacks.AfterModelCallback afterModelCallback) afterModelCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.AfterModelCallbackBase> afterModelCallbacks) afterModelCallbackSync(Callbacks.AfterModelCallbackSync afterModelCallbackSync) afterToolCallback(Callbacks.AfterToolCallback afterToolCallback) afterToolCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.AfterToolCallbackBase> afterToolCallbacks) afterToolCallbackSync(Callbacks.AfterToolCallbackSync afterToolCallbackSync) beforeAgentCallbackSync(Callbacks.BeforeAgentCallbackSync beforeAgentCallbackSync) beforeModelCallback(Callbacks.BeforeModelCallback beforeModelCallback) beforeModelCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.BeforeModelCallbackBase> beforeModelCallbacks) beforeModelCallbackSync(Callbacks.BeforeModelCallbackSync beforeModelCallbackSync) beforeToolCallback(Callbacks.BeforeToolCallback beforeToolCallback) beforeToolCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.BeforeToolCallbackBase> beforeToolCallbacks) beforeToolCallbackSync(Callbacks.BeforeToolCallbackSync beforeToolCallbackSync) build()Removes any before-model callbacks set on this builder.codeExecutor(BaseCodeExecutor codeExecutor) disallowTransferToParent(boolean disallowTransferToParent) disallowTransferToPeers(boolean disallowTransferToPeers) Sets the executor for this agent's offloaded work: tool calls inToolExecutionMode.PARALLEL_SUBSCRIBEmode and the live request loop.generateContentConfig(com.google.genai.types.GenerateContentConfig generateContentConfig) globalInstruction(Instruction globalInstruction) globalInstruction(String globalInstruction) includeContents(LlmAgent.IncludeContents includeContents) Sets how much session history the agent sees.inputSchema(com.google.genai.types.Schema inputSchema) instruction(Instruction instruction) instruction(String instruction) maxSteps(int maxSteps) Sets how this agent converses when it runs as a workflow node.onModelErrorCallback(Callbacks.OnModelErrorCallback onModelErrorCallback) onModelErrorCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.OnModelErrorCallbackBase> onModelErrorCallbacks) onModelErrorCallbackSync(Callbacks.OnModelErrorCallbackSync onModelErrorCallbackSync) onToolErrorCallback(Callbacks.OnToolErrorCallback onToolErrorCallback) onToolErrorCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.OnToolErrorCallbackBase> onToolErrorCallbacks) onToolErrorCallbackSync(Callbacks.OnToolErrorCallbackSync onToolErrorCallbackSync) outputSchema(com.google.genai.types.Schema outputSchema) planning(boolean planning) protected voidvalidate()Methods inherited from class BaseAgent.Builder
afterAgentCallback, afterAgentCallback, beforeAgentCallback, beforeAgentCallback, description, name, self, subAgents, subAgentsModifier and TypeMethodDescriptionafterAgentCallback(Callbacks.AfterAgentCallback afterAgentCallback) afterAgentCallback(List<com.google.adk.agents.Callbacks.AfterAgentCallbackBase> afterAgentCallback) beforeAgentCallback(Callbacks.BeforeAgentCallback beforeAgentCallback) beforeAgentCallback(List<com.google.adk.agents.Callbacks.BeforeAgentCallbackBase> beforeAgentCallback) description(String description) protected LlmAgent.Builderself()This is a safe cast to the concrete builder type.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
model
-
model
-
instruction
-
instruction
-
globalInstruction
-
globalInstruction
-
tools
-
tools
-
generateContentConfig
@CanIgnoreReturnValue public LlmAgent.Builder generateContentConfig(com.google.genai.types.GenerateContentConfig generateContentConfig) -
includeContents
@CanIgnoreReturnValue public LlmAgent.Builder includeContents(LlmAgent.IncludeContents includeContents) Sets how much session history the agent sees. Unset, it isLlmAgent.IncludeContents.DEFAULT, except that aSINGLE_TURNworkflow node then runs withLlmAgent.IncludeContents.NONE. -
planning
-
maxSteps
-
disallowTransferToParent
@CanIgnoreReturnValue public LlmAgent.Builder disallowTransferToParent(boolean disallowTransferToParent) -
disallowTransferToPeers
@CanIgnoreReturnValue public LlmAgent.Builder disallowTransferToPeers(boolean disallowTransferToPeers) -
clearBeforeModelCallbacks
Removes any before-model callbacks set on this builder. -
beforeModelCallback
@CanIgnoreReturnValue public LlmAgent.Builder beforeModelCallback(Callbacks.BeforeModelCallback beforeModelCallback) -
beforeModelCallback
@CanIgnoreReturnValue public LlmAgent.Builder beforeModelCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.BeforeModelCallbackBase> beforeModelCallbacks) -
beforeModelCallbackSync
@CanIgnoreReturnValue public LlmAgent.Builder beforeModelCallbackSync(Callbacks.BeforeModelCallbackSync beforeModelCallbackSync) -
afterModelCallback
@CanIgnoreReturnValue public LlmAgent.Builder afterModelCallback(Callbacks.AfterModelCallback afterModelCallback) -
afterModelCallback
@CanIgnoreReturnValue public LlmAgent.Builder afterModelCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.AfterModelCallbackBase> afterModelCallbacks) -
afterModelCallbackSync
@CanIgnoreReturnValue public LlmAgent.Builder afterModelCallbackSync(Callbacks.AfterModelCallbackSync afterModelCallbackSync) -
onModelErrorCallback
@CanIgnoreReturnValue public LlmAgent.Builder onModelErrorCallback(Callbacks.OnModelErrorCallback onModelErrorCallback) -
onModelErrorCallback
@CanIgnoreReturnValue public LlmAgent.Builder onModelErrorCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.OnModelErrorCallbackBase> onModelErrorCallbacks) -
onModelErrorCallbackSync
@CanIgnoreReturnValue public LlmAgent.Builder onModelErrorCallbackSync(Callbacks.OnModelErrorCallbackSync onModelErrorCallbackSync) -
beforeAgentCallbackSync
@CanIgnoreReturnValue public LlmAgent.Builder beforeAgentCallbackSync(Callbacks.BeforeAgentCallbackSync beforeAgentCallbackSync) -
afterAgentCallbackSync
@CanIgnoreReturnValue public LlmAgent.Builder afterAgentCallbackSync(Callbacks.AfterAgentCallbackSync afterAgentCallbackSync) -
beforeToolCallback
@CanIgnoreReturnValue public LlmAgent.Builder beforeToolCallback(Callbacks.BeforeToolCallback beforeToolCallback) -
beforeToolCallback
@CanIgnoreReturnValue public LlmAgent.Builder beforeToolCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.BeforeToolCallbackBase> beforeToolCallbacks) -
beforeToolCallbackSync
@CanIgnoreReturnValue public LlmAgent.Builder beforeToolCallbackSync(Callbacks.BeforeToolCallbackSync beforeToolCallbackSync) -
afterToolCallback
@CanIgnoreReturnValue public LlmAgent.Builder afterToolCallback(Callbacks.AfterToolCallback afterToolCallback) -
afterToolCallback
@CanIgnoreReturnValue public LlmAgent.Builder afterToolCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.AfterToolCallbackBase> afterToolCallbacks) -
afterToolCallbackSync
@CanIgnoreReturnValue public LlmAgent.Builder afterToolCallbackSync(Callbacks.AfterToolCallbackSync afterToolCallbackSync) -
onToolErrorCallback
@CanIgnoreReturnValue public LlmAgent.Builder onToolErrorCallback(Callbacks.OnToolErrorCallback onToolErrorCallback) -
onToolErrorCallback
@CanIgnoreReturnValue public LlmAgent.Builder onToolErrorCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.OnToolErrorCallbackBase> onToolErrorCallbacks) -
onToolErrorCallbackSync
@CanIgnoreReturnValue public LlmAgent.Builder onToolErrorCallbackSync(Callbacks.OnToolErrorCallbackSync onToolErrorCallbackSync) -
inputSchema
@CanIgnoreReturnValue public LlmAgent.Builder inputSchema(com.google.genai.types.Schema inputSchema) -
outputSchema
@CanIgnoreReturnValue public LlmAgent.Builder outputSchema(com.google.genai.types.Schema outputSchema) -
executor
Sets the executor for this agent's offloaded work: tool calls inToolExecutionMode.PARALLEL_SUBSCRIBEmode and the live request loop. When unset, that work runs on the invocation's scheduler (InvocationContext.scheduler()). -
outputKey
-
codeExecutor
-
mode
Sets how this agent converses when it runs as a workflow node. An agent without a mode runs asAgentMode.CHATwhen another agent in its tree sets a mode, and otherwise as it does outside a workflow. AAgentMode.TASKorAgentMode.SINGLE_TURNagent runs as a child node, so building its parent throwsIllegalArgumentExceptionif its name contains '.'. -
validate
protected void validate() -
build
- Specified by:
buildin classBaseAgent.Builder<LlmAgent.Builder>
-