Class LlmAgent

java.lang.Object
com.google.adk.agents.BaseAgent
com.google.adk.agents.LlmAgent

public class LlmAgent extends BaseAgent
The LLM-based agent.
  • Constructor Details

  • Method Details

    • builder

      public static LlmAgent.Builder builder()
      Returns a LlmAgent.Builder for LlmAgent.
    • determineLlmFlow

      protected BaseLlmFlow determineLlmFlow()
    • runAsyncImpl

      protected io.reactivex.rxjava3.core.Flowable<Event> runAsyncImpl(InvocationContext invocationContext)
      Specified by:
      runAsyncImpl in class BaseAgent
    • runLiveImpl

      protected io.reactivex.rxjava3.core.Flowable<Event> runLiveImpl(InvocationContext invocationContext)
      Specified by:
      runLiveImpl in class BaseAgent
    • canonicalInstruction

      public io.reactivex.rxjava3.core.Single<String> canonicalInstruction(ReadonlyContext context)
      Constructs the text instruction for this agent based on the instruction field.

      This method is only for use by Agent Development Kit.

      Parameters:
      context - The context to retrieve the session state.
      Returns:
      The resolved instruction as a Single wrapped string.
    • canonicalGlobalInstruction

      public io.reactivex.rxjava3.core.Single<String> canonicalGlobalInstruction(ReadonlyContext context)
      Constructs the text global instruction for this agent based on the globalInstruction field.

      This method is only for use by Agent Development Kit.

      Parameters:
      context - The context to retrieve the session state.
      Returns:
      The resolved global instruction as a Single wrapped string.
    • instruction

      public Instruction instruction()
    • globalInstruction

      public Instruction globalInstruction()
    • model

      public Optional<Model> model()
    • planning

      public boolean planning()
    • generateContentConfig

      public Optional<com.google.genai.types.GenerateContentConfig> generateContentConfig()
    • exampleProvider

      public Optional<BaseExampleProvider> exampleProvider()
    • includeContents

      public LlmAgent.IncludeContents includeContents()
    • tools

      public List<BaseTool> tools()
    • disallowTransferToParent

      public boolean disallowTransferToParent()
    • disallowTransferToPeers

      public boolean disallowTransferToPeers()
    • beforeModelCallback

      public Optional<List<Callbacks.BeforeModelCallback>> beforeModelCallback()
    • afterModelCallback

      public Optional<List<Callbacks.AfterModelCallback>> afterModelCallback()
    • beforeToolCallback

      public Optional<List<Callbacks.BeforeToolCallback>> beforeToolCallback()
    • afterToolCallback

      public Optional<List<Callbacks.AfterToolCallback>> afterToolCallback()
    • inputSchema

      public Optional<com.google.genai.types.Schema> inputSchema()
    • outputSchema

      public Optional<com.google.genai.types.Schema> outputSchema()
    • executor

      public Optional<Executor> executor()
    • outputKey

      public Optional<String> outputKey()
    • resolvedModel

      public Model resolvedModel()