> For the complete documentation index, see [llms.txt](https://docs.ebbot.ai/ebbot-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ebbot.ai/ebbot-docs/core-capabilities/automations/workflow-nodes/switch-nodes.md).

# Switch Nodes

Route a workflow down different paths based on a value. Whether you’re routing support tickets by category, handling order statuses, or choosing a follow-up action based on the sentiment expressed in a message, a Switch node keeps your routing logic in one place.

With a Switch node, you can:

* Compare a value from a previous node against multiple cases.
* Give each case its own output path.
* Follow the first matching case.
* Use a default path when no case matches.

## Configuration guide

The Switch node has three main parts: the **value to watch**, the **cases** to match, and a **default path**.

{% stepper %}
{% step %}

### Choose the value to watch

**Value to watch** determines which path the workflow takes. Use the value picker to select the relevant field from a previous node, such as:

* A ticket’s category from an integration node.
* An order’s status from a previous action.
* A sentiment classification from an LLM node.

{% hint style="info" %}
When routing based on an LLM response, use [Structured output in the LLM node](/ebbot-docs/core-capabilities/automations/workflow-nodes/llm-nodes.md#structured-output) to return a dedicated field, such as `sentiment` or `category`. This makes the value easier to use in your Switch node.
{% endhint %}
{% endstep %}

{% step %}

### Add cases

Each case defines a value to match and the next node to run.

1. Enter the value to compare against in **Matches value**.
2. Select the next node from the dropdown, or connect the case’s output on the canvas.
3. Click **Add case** to add another possible path.

For example, if your watched value is a ticket category, you could add separate cases for `Billing`, `Technical support`, and `Account access`.

Each case needs a destination. To remove a case, click the remove button next to it.

{% hint style="info" %}
**The first exact match wins.** Cases are checked in order. If multiple cases match, only the first matching case is followed.
{% endhint %}
{% endstep %}

{% step %}

### Set the default path

**Default (no match)** determines what happens when the value does not match any of your cases.

Select a next node to handle unmatched values, or leave **End flow** selected if no further action is needed.

A default path is useful for handling unexpected values or categories that do not need their own case.
{% endstep %}
{% endstepper %}

## Example: Route by message sentiment

An LLM node analyses the sentiment expressed in an incoming support message and returns a `sentiment` field with one of three values: `Positive`, `Negative`, or `Neutral`. A Switch node uses that value to route the message to an appropriate support action.

1. Add a Switch node after the LLM node.
2. Set **Value to watch** to the LLM’s `sentiment` field.
3. Add the following cases and connect them to the appropriate action nodes:

| Matches value | Next step                   |
| ------------- | --------------------------- |
| `Positive`    | Send a thank-you message    |
| `Negative`    | Escalate to a support agent |
| `Neutral`     | Route to general support    |

4. Set **Default (no match)** to a general support action for any other value.

{% hint style="success" %}
When the workflow runs, a value of `Negative` follows the escalation path. The other case paths are not run.
{% endhint %}

## Node outputs

The Switch node displays a separate output connection for each case, plus a **Default (no match)** output.

| Output                 | When it is used                                                       |
| ---------------------- | --------------------------------------------------------------------- |
| **Case output**        | The watched value matches that case, and no earlier case has matched. |
| **Default (no match)** | None of the cases match.                                              |

Connect each output to the next step you want the workflow to take.
