> For the complete documentation index, see [llms.txt](https://docs.ixhello.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ixhello.com/ixhc2/flows/flow-editor/branch-node.md).

# Branch Node

### Overview

The Branch Node enables builders to direct workflow execution using deterministic, rule-based logic. Rather than delegating decision-making to an Agent and relying on LLM reasoning, the Branch Node evaluates predefined conditions through the Expression Engine to determine the appropriate path.

This approach provides several key advantages:

* **Consistent outcomes** – the same inputs always produce the same routing decision.
* **Instant execution** – routing occurs immediately without additional processing delays.
* **No LLM dependency** – decisions are made directly through expression evaluation.
* **Reduced costs** – no LLM calls are required for simple branching scenarios, eliminating unnecessary AI usage costs.

By using the Branch Node, builders can create predictable, efficient, and cost-effective workflows for scenarios that require straightforward conditional routing.

***

### What Problem Does the Branch Node Solve?

**Replaces Agent-Based Branching for Simple Logic**

Previously, workflow routing often relied on an Agent to determine the next step, which could introduce unnecessary cost, latency, and variability. The Branch Node replaces this with deterministic, rule-based routing for straightforward decisions.

**Delivers Predictable Outcomes**

The same condition always produces the same result, ensuring consistent and reliable workflow behavior a key requirement for business-critical processes.

**Improves Flow Clarity**

Branching rules are displayed directly on the canvas, making workflows easier to understand, maintain, and troubleshoot without embedding logic inside prompts.

***

### Why Use the Branch Node?

**Lower Runtime Costs**

Eliminates unnecessary LLM calls for simple decision-making, helping reduce operational costs, especially in high-volume deployments.

**Improved Reliability**

Deterministic logic ensures that the same input always follows the same path, providing consistent outcomes.

**Faster Performance**

Branch evaluation happens instantly without model inference, making it ideal for:

* Voice applications
* High-volume chat experiences
* Real-time workflows

**Better Transparency**

All branch conditions are visible on the canvas, making workflows easier to audit, review, and debug.

***

### How the Branch Node Works

#### 1. Core Behavior

**1. Evaluates Existing Data**

The Branch Node routes flows using data that is already available within the workflow, including:

* Slot values
* API responses
* System variables
* Flow variables
* Channel, locale, or language information

**2. Uses Expression-Based Logic**

Each branch is defined using a JavaScript-style expression that evaluates to either `true` or `false`.

**Examples:**

```
zipcode === "NL"
apiResponse.status !== null
["gold", "platinum"].includes(tier)
```

**3. Evaluates Conditions Sequentially**

Conditions are processed from top to bottom. The Branch Node selects the first condition that evaluates to `true`.

**4. Routes Through Defined Output Paths**

Each condition is mapped to a specific output port. When a condition matches, the flow continues through its associated path.

**5. Includes a Default Else Path**

An Else path is always required and serves as the fallback route when none of the configured conditions are met.

#### 2. Runtime Behavior

**First Match Wins**

The Branch Node evaluates conditions in order and stops as soon as a matching condition is found. Once a route is selected, no additional conditions are evaluated.

**Automatic Fallback Routing**

If no conditions match, the flow automatically follows the **Else** path, ensuring execution can always continue.

**No LLM Involvement**

All branch evaluations are performed directly by the Expression Engine without Agent reasoning or LLM inference, resulting in faster, more predictable, and cost-efficient routing.

***

### User Workflow

**1. Add a Branch Node**

Drag a Branch Node from the Flow Editor onto the canvas and place it at the point where the workflow needs to split into multiple paths.

**2. Define Branch Conditions**

In the node configuration panel, add one or more conditions. Each condition is written as an expression that evaluates data available in the current flow context.

**3. Configure Routing Rules**

For each condition, specify:

* The variable or value to evaluate
* The comparison logic or operator
* The value or expression to compare against
* The corresponding output route

**4. Map Output Paths**

Assign each condition to a dedicated output port. Each port represents a different route the workflow can take.

**5. Connect Downstream Nodes**

Connect each output path to the next step in the workflow.

**Example:**

* Gold Customers → VIP Support Node
* Standard Customers → Standard Support Node
* Else → Fallback Node

**6. Configure the Else Path**

Ensure the required **Else** path is connected. This serves as the default route when none of the defined conditions are met.

**7. Runtime Execution**

At runtime, the Branch Node evaluates conditions in order from top to bottom.

* The **first condition that evaluates to true** is selected.
* Remaining conditions are skipped.
* If no conditions match, the workflow automatically follows the **Else** path.

This approach ensures routing remains **fast, predictable, and deterministic** without requiring Agent reasoning or LLM inference.

***

### Supported Condition Patterns

The Branch Node supports a variety of expression patterns, allowing builders to create flexible and deterministic routing logic based on workflow data.

**1. Equality Checks**

Use equality operators when routing based on an exact value.

**Examples:**

```
language === "en"
channel === "voice"
```

**2. Null and Existence Checks**

Verify whether a value exists before proceeding with a specific route.

**Examples:**

```
apiResponse.status !== null
customerId != null
```

**3. Membership Checks**

Determine whether a value belongs to a predefined group or list.

**Example:**

```
["gold", "platinum"].includes(tier)
```

**4. Comparison-Based Conditions**

Use numeric comparisons for threshold-based or rule-driven decisions.

**Examples:**

```
totalPoints > 1000
orderAmount >= 500
```

**5. Compound Expressions**

Combine multiple conditions to support more advanced routing logic.

**Example:**

```
channel === "voice" && language === "es"
`
```

**Note:** Supported expression syntax may vary based on the product implementation. Always validate expressions against the latest platform documentation.

***

## Example Use Cases

**1. Customer Tier Routing**

Direct customers to different experiences based on their membership or loyalty level.

**Example:**

```
True → Premium Support Path
Else → Standard Support Path
```

**2. API Response Handling**

Route workflows based on the outcome of an API call.

**Examples:**

```
SUCCESS → Continue Workflow
FAILED → Error Handling
Else → Fallback Path
```

**3. Channel-Specific Experiences**

Deliver tailored experiences based on the interaction channel.

**Examples:**

```
Voice → Voice-Optimized Flow
Chat → Chat-Optimized Flow
```

**4. Language-Based Routing**

Guide users to language-specific content and experiences.

**Examples:**

```
French → French Content Path
Dutch → Dutch Content Path
Else → Default Language Path
```

**5. Eligibility and Qualification Checks**

Use slot values, API responses, or computed variables to determine whether users meet specific criteria.

**Example:**

```
True → Proceed to Next Step
Else → Ineligible Response Path
```

These patterns enable builders to create clear, deterministic, and maintainable routing logic without relying on Agent reasoning or LLM-based decision-making.

***

### Example from the Demo&#x20;

Complete flow of the Demo refer to this [document](/ixhc2/flows/flow-editor/set-variable-node.md)

#### 1. Loyalty Points-Based Routing

In the demo, a Set Variable Node first calculated a customer's total loyalty points. The Branch Node then evaluated a series of conditions in sequence, such as:

* `totalPoints > 1000`
* `totalPoints < 500`
* `totalPoints > 0`
* Else (fallback route)

The workflow followed the route associated with the first condition that evaluated to true, demonstrating deterministic and predictable routing behavior.

#### 2. Deterministic Routing in Action

The presenter compared the Branch Node to a traditional if / else-if / else statement.

Key behaviors highlighted in the demo included:

* Conditions are evaluated from top to bottom.
* The first matching condition is selected.
* Once a match is found, the remaining conditions are skipped.
* The workflow continues along the selected branch.

This ensures consistent results every time the same inputs are evaluated.

#### 3. Built-In Testing and Validation

The demo also showcased the Branch Node's testing capabilities, allowing builders to validate routing logic before deployment.

The test view helps verify:

* Which conditions evaluate to true or false
* Which branch is selected at runtime
* Whether routing behaves as expected for different input values

This makes it easier to troubleshoot and validate branching logic during flow design.

If calculation succeeds, the flow proceeds to a branching decision.

<table><thead><tr><th width="272">Setting</th><th>Value</th></tr></thead><tbody><tr><td>Name</td><td>route_tier</td></tr><tr><td>Branching Rule 1</td><td><p>Expression: total_points >= 2000</p><p>Branch Name: platinum                                                                                         </p></td></tr><tr><td>Branching Rule 2</td><td><p>Expression: total_points >= 1000</p><p>Branch Name: gold     </p></td></tr><tr><td>Branching Rule 3</td><td><p>Expression: total_points >= 500</p><p>Branch Name: silver </p></td></tr><tr><td>Branching Rule 4</td><td><p>Expression: total_points > 0</p><p>Branch Name: bronze</p></td></tr></tbody></table>

<figure><img src="/files/mTItXp8SLF1IosCimHQ5" alt="" width="315"><figcaption></figcaption></figure>

<table><thead><tr><th width="141">Setting</th><th>Description</th><th></th><th></th><th></th><th></th></tr></thead><tbody><tr><td>Node Name</td><td>platinum_message</td><td>gold_message</td><td>silver_message</td><td>bronze_message</td><td>no_points_message</td></tr><tr><td>Message</td><td>This member has {{points}} points, plus a 15% bonus of {{bonus_points}}, for {{total_points}} total — that's PLATINUM tier! Concierge service and every perk unlocked.</td><td>This member has {{points}} points, plus a 15% bonus of {{bonus_points}}, for {{total_points}} total — that's GOLD tier! Keep earning to reach Platinum at 2000.</td><td>This member has {{points}} points, plus a 15% bonus of {{bonus_points}}, for {{total_points}} total — that's SILVER tier! Free shipping unlocked.</td><td>This member has {{points}} points, plus a 15% bonus of {{bonus_points}}, for {{total_points}} total — that's BRONZE tier. Keep earning to reach Silver at 500!</td><td>This member has no points yet. Make a purchase to start earning!</td></tr><tr><td>Allow barge-in</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td><td>Yes</td></tr></tbody></table>

<figure><img src="/files/49Y5HnYcrHNlAhRr0lu7" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ixhello.com/ixhc2/flows/flow-editor/branch-node.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
