Skip to main content

Workflow Parallel Template

The Workflow Parallel template demonstrates how a workflow can execute multiple independent branches simultaneously and synchronize them before continuing. Instead of processing every task sequentially, BindAI can run several branches concurrently, significantly reducing overall execution time for independent operations. This template introduces concurrent workflow execution.

Purpose

This template demonstrates how to:
  • execute multiple branches simultaneously
  • synchronize parallel execution
  • combine results from independent tasks
  • improve workflow performance
  • coordinate multiple agents
It extends the Loop and Condition templates by introducing concurrent execution.

Workflow Structure

A parallel workflow typically looks like this.
Both branches execute independently before meeting at the Join node.

Execution Flow

The workflow reaches the Parallel node.
Every outgoing branch begins execution.

Parallel Node

The Parallel node starts multiple execution paths.
Each branch executes independently.

Independent Branches

Parallel branches should not depend on one another. Good example:
Each task can execute simultaneously. Poor example:
Dependent tasks should remain sequential.

Join Node

Once every branch completes, execution continues.
The Join node acts as a synchronization point.

Synchronization

The Join node waits until every expected branch has arrived.
If one branch is still running, execution pauses at the Join.

Example

Suppose two agents gather different information.
The final response uses outputs from both agents.

Shared Workflow Context

All branches share the same workflow context.
To avoid conflicts, branches should write to different variables. Example:
Later workflow nodes can combine both results.

Performance Benefits

Sequential execution:
Parallel execution:
Independent tasks finish much faster when executed concurrently.

Typical Use Cases

Parallel workflows are useful for:
  • multiple AI agents
  • independent API calls
  • document analysis
  • retrieval from several knowledge sources
  • report generation
  • validation tasks
  • external integrations
These operations rarely depend on one another.

Parallel vs Sequential

Choose the approach based on task dependencies.

Error Handling

If one branch fails, workflow behavior depends on your design. Common strategies include:
  • fail the workflow
  • retry the failed branch
  • continue with partial results
  • route to an error handler
Parallel execution works well alongside Retry and Timeout policies.

Related Templates

The Parallel template builds upon:
  • Workflow Basic
  • Workflow Condition
  • Workflow Loop
It also prepares you for:
  • Workflow Human
  • Workflow Retry
  • Workflow Timeout
  • Workflow Schedule

Best Practices

  • Execute only independent tasks in parallel.
  • Use separate workflow variables for each branch.
  • Synchronize branches with a Join node.
  • Keep branches balanced in complexity.
  • Handle branch failures explicitly.
  • Avoid unnecessary parallelism for very small tasks.

Summary

The Workflow Parallel template demonstrates how BindAI executes multiple independent workflow branches simultaneously. By combining Parallel and Join nodes, workflows can improve performance while maintaining predictable execution and proper synchronization across concurrent branches.