Parallel¶
The Parallel block executes several block sequences in parallel.
Each sub-sequence gets its own independent scratchpad.
Each sub-sequence can be made of several blocks. The same block transition logic occurs within each sub-sequence as within the “main” sequence. These sub-sequences can even be nested.
The Parallel block terminates when all of the subsequences have terminated.
For example, in the above example, the parallel block targets the “Fetch authorized discount” and “Detect Intent” chains, but each is made of several blocks. The Parallel block will only complete when both:
Compute possible discount has terminated
Either “Respond to Dispute” or “Respond to incident report” has terminated (based on which way the Routing block sent this subsequence)
The Generate action report block will then execute.
Output¶
Once a parallel block completes, it’s possible to grab the text output of each sub-sequence, and to create a key in the state of scratchpad, that will contain a list of the outputs of each individual sub-sequence.
Cautions¶
Inherently, the parallel block is not interactive. If you are using a Core Loop block within a Parallel block, it will not be possible to resume from it. When the Core Loop block within the Parallel block terminates, control will move to the block after Parallel.
Be careful about writing to the state from a sub-sequence of a Parallel block, as you are not guaranteed isolation.