Enum Class RunConfig.ToolExecutionMode

java.lang.Object
java.lang.Enum<RunConfig.ToolExecutionMode>
com.google.adk.agents.RunConfig.ToolExecutionMode
All Implemented Interfaces:
Serializable, Comparable<RunConfig.ToolExecutionMode>, Constable
Enclosing class:
RunConfig

public static enum RunConfig.ToolExecutionMode extends Enum<RunConfig.ToolExecutionMode>
Execution mode when the model requests multiple tools.

NONE: defaults to PARALLEL.

SEQUENTIAL: tools execute strictly in request order on the caller thread; each tool must complete (including any asynchronous work) before the next one is subscribed to.

PARALLEL: tools are subscribed to eagerly on the caller thread (i.e. all are kicked off up-front), but no worker threads are introduced. Tools that are truly asynchronous (e.g. they return a Single backed by I/O or another scheduler) will run concurrently; tools that block the subscribing thread (e.g. Single.fromCallable that performs blocking work) will still execute sequentially. This preserves the historical default behavior.

PARALLEL_SUBSCRIBE: like PARALLEL, but every tool is additionally subscribed on a worker thread, so blocking tools also run concurrently. Tool implementations must be thread-safe. The worker is the agent's executor when set, otherwise the RxJava IO scheduler.

  • Enum Constant Details

  • Method Details

    • values

      public static RunConfig.ToolExecutionMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static RunConfig.ToolExecutionMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null