# Class LlmAgent.Builder

java.lang.Object
com.google.adk.agents.BaseAgent.Builder<LlmAgent.Builder>
com.google.adk.agents.LlmAgent.Builder

Enclosing class:
  `LlmAgent`

public static class LlmAgent.Builder extends BaseAgent.Builder<LlmAgent.Builder>
Builder for `LlmAgent`.

- ## Field Summary

  ### Fields inherited from class BaseAgent.Builder

  `afterAgentCallback, beforeAgentCallback, description, name, subAgents`
  Modifier and Type
  Field
  Description
  `protected com.google.common.collect.ImmutableList<Callbacks.AfterAgentCallback>`
  `afterAgentCallback`
  `protected com.google.common.collect.ImmutableList<Callbacks.BeforeAgentCallback>`
  `beforeAgentCallback`
  `protected String`
  `description`
  `protected String`
  `name`
  `protected com.google.common.collect.ImmutableList<BaseAgent>`
  `subAgents`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Builder()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `LlmAgent.Builder`
  `afterAgentCallbackSync(Callbacks.AfterAgentCallbackSync afterAgentCallbackSync)`
  `LlmAgent.Builder`
  `afterModelCallback(Callbacks.AfterModelCallback afterModelCallback)`
  `LlmAgent.Builder`
  `afterModelCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.AfterModelCallbackBase> afterModelCallbacks)`
  `LlmAgent.Builder`
  `afterModelCallbackSync(Callbacks.AfterModelCallbackSync afterModelCallbackSync)`
  `LlmAgent.Builder`
  `afterToolCallback(Callbacks.AfterToolCallback afterToolCallback)`
  `LlmAgent.Builder`
  `afterToolCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.AfterToolCallbackBase> afterToolCallbacks)`
  `LlmAgent.Builder`
  `afterToolCallbackSync(Callbacks.AfterToolCallbackSync afterToolCallbackSync)`
  `LlmAgent.Builder`
  `beforeAgentCallbackSync(Callbacks.BeforeAgentCallbackSync beforeAgentCallbackSync)`
  `LlmAgent.Builder`
  `beforeModelCallback(Callbacks.BeforeModelCallback beforeModelCallback)`
  `LlmAgent.Builder`
  `beforeModelCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.BeforeModelCallbackBase> beforeModelCallbacks)`
  `LlmAgent.Builder`
  `beforeModelCallbackSync(Callbacks.BeforeModelCallbackSync beforeModelCallbackSync)`
  `LlmAgent.Builder`
  `beforeToolCallback(Callbacks.BeforeToolCallback beforeToolCallback)`
  `LlmAgent.Builder`
  `beforeToolCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.BeforeToolCallbackBase> beforeToolCallbacks)`
  `LlmAgent.Builder`
  `beforeToolCallbackSync(Callbacks.BeforeToolCallbackSync beforeToolCallbackSync)`
  `LlmAgent`
  `build()`
  `LlmAgent.Builder`
  `clearBeforeModelCallbacks()`
  `LlmAgent.Builder`
  `codeExecutor(BaseCodeExecutor codeExecutor)`
  `LlmAgent.Builder`
  `disallowTransferToParent(boolean disallowTransferToParent)`
  `LlmAgent.Builder`
  `disallowTransferToPeers(boolean disallowTransferToPeers)`
  `LlmAgent.Builder`
  `executor(Executor executor)`
  `LlmAgent.Builder`
  `generateContentConfig(com.google.genai.types.GenerateContentConfig generateContentConfig)`
  `LlmAgent.Builder`
  `globalInstruction(Instruction globalInstruction)`
  `LlmAgent.Builder`
  `globalInstruction(String globalInstruction)`
  `LlmAgent.Builder`
  `includeContents(LlmAgent.IncludeContents includeContents)`
  `LlmAgent.Builder`
  `inputSchema(com.google.genai.types.Schema inputSchema)`
  `LlmAgent.Builder`
  `instruction(Instruction instruction)`
  `LlmAgent.Builder`
  `instruction(String instruction)`
  `LlmAgent.Builder`
  `maxSteps(int maxSteps)`
  `LlmAgent.Builder`
  `model(BaseLlm model)`
  `LlmAgent.Builder`
  `model(String model)`
  `LlmAgent.Builder`
  `onModelErrorCallback(Callbacks.OnModelErrorCallback onModelErrorCallback)`
  `LlmAgent.Builder`
  `onModelErrorCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.OnModelErrorCallbackBase> onModelErrorCallbacks)`
  `LlmAgent.Builder`
  `onModelErrorCallbackSync(Callbacks.OnModelErrorCallbackSync onModelErrorCallbackSync)`
  `LlmAgent.Builder`
  `onToolErrorCallback(Callbacks.OnToolErrorCallback onToolErrorCallback)`
  `LlmAgent.Builder`
  `onToolErrorCallback(@Nullable List<? extends com.google.adk.agents.Callbacks.OnToolErrorCallbackBase> onToolErrorCallbacks)`
  `LlmAgent.Builder`
  `onToolErrorCallbackSync(Callbacks.OnToolErrorCallbackSync onToolErrorCallbackSync)`
  `LlmAgent.Builder`
  `outputKey(String outputKey)`
  `LlmAgent.Builder`
  `outputSchema(com.google.genai.types.Schema outputSchema)`
  `LlmAgent.Builder`
  `planning(boolean planning)`
  `LlmAgent.Builder`
  `tools(Object... tools)`
  `LlmAgent.Builder`
  `tools(List<?> tools)`
  `protected void`
  `validate()`

  ### Methods inherited from class BaseAgent.Builder

  `afterAgentCallback, afterAgentCallback, beforeAgentCallback, beforeAgentCallback, description, name, self, subAgents, subAgents`
  Modifier and Type
  Method
  Description
  `LlmAgent.Builder`
  `afterAgentCallback(Callbacks.AfterAgentCallback afterAgentCallback)`
  `LlmAgent.Builder`
  `afterAgentCallback(List<com.google.adk.agents.Callbacks.AfterAgentCallbackBase> afterAgentCallback)`
  `LlmAgent.Builder`
  `beforeAgentCallback(Callbacks.BeforeAgentCallback beforeAgentCallback)`
  `LlmAgent.Builder`
  `beforeAgentCallback(List<com.google.adk.agents.Callbacks.BeforeAgentCallbackBase> beforeAgentCallback)`
  `LlmAgent.Builder`
  `description(String description)`
  `LlmAgent.Builder`
  `name(String name)`
  `protected LlmAgent.Builder`
  `self()`
  This is a safe cast to the concrete builder type.
  `LlmAgent.Builder`
  `subAgents(BaseAgent... subAgents)`
  `LlmAgent.Builder`
  `subAgents(List<? extends BaseAgent> subAgents)`

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### Builder

    public Builder()

- ## Method Details

  - ### model

    @CanIgnoreReturnValue public LlmAgent.Builder model(String model)

  - ### model

    @CanIgnoreReturnValue public LlmAgent.Builder model(BaseLlm model)

  - ### instruction

    @CanIgnoreReturnValue public LlmAgent.Builder instruction(Instruction instruction)

  - ### instruction

    @CanIgnoreReturnValue public LlmAgent.Builder instruction(String instruction)

  - ### globalInstruction

    @CanIgnoreReturnValue public LlmAgent.Builder globalInstruction(Instruction globalInstruction)

  - ### globalInstruction

    @CanIgnoreReturnValue public LlmAgent.Builder globalInstruction(String globalInstruction)

  - ### tools

    @CanIgnoreReturnValue public LlmAgent.Builder tools(List<?> tools)

  - ### tools

    @CanIgnoreReturnValue public LlmAgent.Builder tools(Object... tools)

  - ### generateContentConfig

    @CanIgnoreReturnValue public LlmAgent.Builder generateContentConfig(com.google.genai.types.GenerateContentConfig generateContentConfig)

  - ### includeContents

    @CanIgnoreReturnValue public LlmAgent.Builder includeContents(LlmAgent.IncludeContents includeContents)

  - ### planning

    @CanIgnoreReturnValue public LlmAgent.Builder planning(boolean planning)

  - ### maxSteps

    @CanIgnoreReturnValue public LlmAgent.Builder maxSteps(int maxSteps)

  - ### disallowTransferToParent

    @CanIgnoreReturnValue public LlmAgent.Builder disallowTransferToParent(boolean disallowTransferToParent)

  - ### disallowTransferToPeers

    @CanIgnoreReturnValue public LlmAgent.Builder disallowTransferToPeers(boolean disallowTransferToPeers)

  - ### clearBeforeModelCallbacks

    @CanIgnoreReturnValue public LlmAgent.Builder clearBeforeModelCallbacks()

  - ### 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

    @CanIgnoreReturnValue public LlmAgent.Builder executor(Executor executor)

  - ### outputKey

    @CanIgnoreReturnValue public LlmAgent.Builder outputKey(String outputKey)

  - ### codeExecutor

    @CanIgnoreReturnValue public LlmAgent.Builder codeExecutor(BaseCodeExecutor codeExecutor)

  - ### validate

    protected void validate()

  - ### build

    public LlmAgent build()
    Specified by:
      `build` in class `BaseAgent.Builder<LlmAgent.Builder>`