Package com.google.adk.workflow
Class ParallelWorkers
java.lang.Object
com.google.adk.workflow.ParallelWorkers
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 Summary
Modifier and TypeMethodDescriptionstatic NodeparallelNode(Node node) Returns a node that runsnodeon every item at once.static NodeparallelNode(Node node, int maxParallelWorkers) Returns a node that runsnodeon each item of a list input, at mostmaxParallelWorkersat a time and starting them in input order; the returned node takesnode's name, description, state schema andNode.requiresAllPredecessors(), and leaves its config and input and output schemas to each item's run.
-
Method Details
-
parallelNode
Returns a node that runsnodeon every item at once. Otherwise it behaves asparallelNode(Node, int)describes.- Throws:
WorkflowConfigurationException- ifnodeisStart
-
parallelNode
Returns a node that runsnodeon each item of a list input, at mostmaxParallelWorkersat a time and starting them in input order; the returned node takesnode's name, description, state schema andNode.requiresAllPredecessors(), and leaves its config and input and output schemas to each item's run. A text-onlyContent, such as a user message, is read as JSON, and a JSON list fans out. Its text reaches the items as aStringif 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- ifnodeisStartormaxParallelWorkersis less than 1
-