Class Workflow.Builder

java.lang.Object
com.google.adk.workflow.Workflow.Builder
Enclosing class:
Workflow

public static final class Workflow.Builder extends Object
Builder for Workflow. Only the name is required. Unlike other nodes, a workflow reruns from scratch when resumed unless rerunOnResume turns that off.
  • Method Details

    • name

      @CanIgnoreReturnValue public Workflow.Builder name(String name)
    • edges

      @CanIgnoreReturnValue public Workflow.Builder edges(List<Edge> edges)
    • edges

      @CanIgnoreReturnValue public Workflow.Builder edges(Edge... edges)
    • edges

      @CanIgnoreReturnValue public Workflow.Builder edges(Consumer<? super EdgesBuilder> graphDefinition)
      Sets the edges that graphDefinition adds to a new EdgesBuilder.

      For example: .edges(g -> g.fromStart().chain(a, b)).

    • description

      @CanIgnoreReturnValue public Workflow.Builder description(String description)
    • maxConcurrency

      @CanIgnoreReturnValue public Workflow.Builder maxConcurrency(int maxConcurrency)
      Sets the maximum number of nodes to run at once, which must be at least 1. A workflow without one has no limit.
    • rerunOnResume

      @CanIgnoreReturnValue public Workflow.Builder rerunOnResume(boolean rerunOnResume)
    • waitForOutput

      @CanIgnoreReturnValue public Workflow.Builder waitForOutput(boolean waitForOutput)
    • config

      @CanIgnoreReturnValue public Workflow.Builder config(NodeConfig config)
    • inputSchema

      @CanIgnoreReturnValue public Workflow.Builder inputSchema(@Nullable com.google.genai.types.Schema inputSchema)
    • outputSchema

      @CanIgnoreReturnValue public Workflow.Builder outputSchema(@Nullable com.google.genai.types.Schema outputSchema)
    • stateSchema

      @CanIgnoreReturnValue public Workflow.Builder stateSchema(@Nullable com.google.genai.types.Schema stateSchema)
    • build

      public Workflow build()
      Builds the workflow.
      Throws:
      IllegalArgumentException - if the workflow's name or the name of a node in its graph is empty or contains /, @, or .
      GraphValidationException - if the graph is malformed, for example if Start cannot reach one of its nodes