Branches - Logical Step and Parallel execution
The Logical Step and Parallel Execution Step are critical components of the workflow builder, enabling dynamic branching and parallel processing within your workflows. Below is a detailed explanation of their functionality, behaviors, and best practices for using them effectively.
Logical Step
The Logical Step allows you to split the workflow into multiple branches based on conditions. Each branch is evaluated independently, and the workflow proceeds along the branch where the condition evaluates to True
.

Logical Step with two branches
Key Features:
Condition Definition:
You can define conditions using Python expressions or Natural Language Prompts.
Example Python condition:
result > 2
ortransfer != 'Yes, I would like to be transferred!'
Example Prompt: "Check if the user wants to transfer."
Parallel Execution
The Parallel Execution enables the simultaneous execution of multiple branches. This is useful for workflows where tasks can be performed independently and concurrently. This node is useful for advanced use cases, most of the time you will not need it. Try to rely on linear flows as much as possible.

Parallel Execution with two branches that merge into a single Output
Key Features:
Simultaneous Execution:
All branches under a Parallel Execution are executed at the same time.
This is ideal for tasks that do not depend on each other.
Special Behaviors for Logical Step and Parallel Execution
Deleting a Step:
When deleting a Logical or Parallel Execution, you will be prompted to select which branches (subtrees) to delete. This is because floating branches are not allowed in the workflow.
Warning: Deleting branches is a destructive action and should only be performed when absolutely necessary.
Deleting a step with multiple branches
Automatic Branch Creation:
Adding a node to a Logical or Parallel Execution Step automatically creates a new branch.
Output Behavior:
If branches are not merged, each branch generates its own output, which is returned to the agent.
Merging Branches:
Branches can be merged by dragging the connection point of one branch to another branch output. This ensures a single output.
Best Practices
Use Logical Steps for Decision-Making:
Logical Steps are ideal for workflows that require conditional branching based on user input, variables, or context values.
Use Parallel Execution for Independent Tasks:
Parallel Execution Steps are best suited for workflows where tasks can be performed simultaneously without dependencies.
Avoid Floating Branches:
Always ensure that branches are either merged or lead to an Output Step. Floating branches are not allowed and will result in errors.
Carefully Manage Deletions:
When deleting Logical or Parallel Execution Steps, review the branches carefully to avoid accidental loss of workflow components.
Test Conditions Thoroughly:
For Logical Steps, ensure that conditions are well-defined and tested to avoid unexpected behavior.
By leveraging Logical and Parallel Execution Steps effectively, you can create dynamic, flexible, and efficient workflows tailored to your specific needs.