ParallelWorkflow extends BaseWorkflow to implement the parallelization pattern. All tasks in the input list are dispatched simultaneously through a ThreadPoolExecutor, each handled by the same ExecutionAgent. Individual task failures are captured as error strings and do not abort the remaining tasks.
Import
Constructor
Dictionary of agent instances. Must contain the key
"executor" mapped to an ExecutionAgent.Optional list of tools available to the workflow. Not used internally by the default
run implementation, but accessible via self.tools for subclasses.Methods
run
Dispatches all tasks concurrently and collects their results.
A list of independent task description strings. Each is executed in isolation — no shared state is passed between concurrent executions.
Maximum number of threads in the
ThreadPoolExecutor. Limits the degree of parallelism.Return value
Always
"completed" — the workflow returns after all futures resolve regardless of individual task outcomes.A flat dictionary mapping each original task string to its result string.