Class Runner.Builder

java.lang.Object
com.google.adk.runner.Runner.Builder
Enclosing class:
Runner

public static class Runner.Builder extends Object
Builder for Runner.
  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • app

      @CanIgnoreReturnValue public Runner.Builder app(App app)
    • agent

      @CanIgnoreReturnValue public Runner.Builder agent(BaseAgent agent)
    • appName

      @CanIgnoreReturnValue public Runner.Builder appName(String appName)
    • artifactService

      @CanIgnoreReturnValue public Runner.Builder artifactService(BaseArtifactService artifactService)
    • sessionService

      @CanIgnoreReturnValue public Runner.Builder sessionService(BaseSessionService sessionService)
    • memoryService

      @CanIgnoreReturnValue public Runner.Builder memoryService(BaseMemoryService memoryService)
    • plugins

      @CanIgnoreReturnValue public Runner.Builder plugins(List<? extends Plugin> plugins)
    • plugins

      @CanIgnoreReturnValue public Runner.Builder plugins(Plugin... plugins)
    • scheduler

      @CanIgnoreReturnValue public Runner.Builder scheduler(@Nullable io.reactivex.rxjava3.core.Scheduler scheduler)
      Sets the Scheduler for the work ADK hands off to worker threads in this runner's invocations: the sub-agents of a ParallelAgent, tool calls in RunConfig.ToolExecutionMode.PARALLEL_SUBSCRIBE mode, the nodes of a workflow graph and the items of a parallelNode, workflow node retries and attempts with a timeout, the hop that starts the live send loop, and the work that resumes after a wait for this runner to save events. A workflow FunctionNode decodes its input and runs its confirmation predicate and body on it, unless FunctionNode.Builder#scheduler sets another; then only the hand-back after them runs on it. The runs that an AgentTool nests inherit it. An agent-level ParallelAgent.Builder#scheduler or LlmAgent.Builder#executor takes precedence. null (the default) selects Schedulers.io().

      Only these hand-offs are affected; work that completes asynchronously elsewhere (model clients, session services, MCP, plugins) stays on its own threads. Schedulers.trampoline() runs these hand-offs inline, so sub-agents, tools, and graph nodes are subscribed sequentially, though anything they start asynchronously can still overlap; similarly, a bounded scheduler limits how many thread-blocking graph nodes run at once, and deadlocks once every thread holds a node blocked on runNode(...).blockingGet() for a child, such as a nested workflow or a FunctionNode, that also needs a thread.

      When a workflow node's attempt has to wait for work it started, such as a child its body left running or a body that ignores its interrupt, the rest of the attempt, including its final or error event and the session append and plugin callbacks for it, continues on a Schedulers.io() thread whatever this scheduler is.

    • instantSource

      @CanIgnoreReturnValue public Runner.Builder instantSource(@Nullable InstantSource instantSource)
      Sets the InstantSource that supplies every timestamp this runner generates: event timestamps, and the lastUpdateTime of sessions created by the default in-memory session service, which is created on the first build(). null (the default) selects InstantSource.system().
    • uuidProvider

      @CanIgnoreReturnValue public Runner.Builder uuidProvider(@Nullable UuidProvider uuidProvider)
      Sets the UuidProvider that supplies every identifier this runner generates: event, invocation, and client function-call ids, and the ids of sessions created by the default in-memory session service, which is created on the first build(). null (the default) selects UuidProvider.SYSTEM.
    • build

      public Runner build()