Class ParallelWorkers

java.lang.Object
com.google.adk.workflow.ParallelWorkers

@Experimental public final class ParallelWorkers extends Object
Static factories for workflow nodes that run a node once per item of a list input. Each item runs as a child of the returned node on its own branch, and the node outputs the items' results as a list in input order. A failed item cancels the others and fails the node, while an item that asks for input stops queued items from starting.
  • Method Details

    • parallelNode

      public static Node parallelNode(Node node)
      Returns a node that runs node on every item at once. Otherwise it behaves as parallelNode(Node, int) describes.
      Throws:
      WorkflowConfigurationException - if node is Start
    • parallelNode

      public static Node parallelNode(Node node, int maxParallelWorkers)
      Returns a node that runs node on each item of a list input, at most maxParallelWorkers at a time and starting them in input order; the returned node takes node's name, description, state schema and Node.requiresAllPredecessors(), and leaves its config and input and output schemas to each item's run. A text-only Content, such as a user message, is read as JSON, and a JSON list fans out. Its text reaches the items as a String if it is not JSON, or if it is a non-list value and the item's input schema takes a string; any other non-list input runs as one item.
      Throws:
      WorkflowConfigurationException - if node is Start or maxParallelWorkers is less than 1