> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cogniagent.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Multi-Condition Node

> Multi-way branching with dynamic conditions

The Multi-Condition node routes workflow execution to one of multiple paths based on matching conditions. Use it when you have more than two possible routes, such as categorizing items, routing to departments, or handling multiple statuses.

<Frame caption="Multi-Condition configuration — each branch has a name, a condition, and a handle to wire the outgoing edge to.">
  <img src="https://mintcdn.com/glorium/eqWkhSfBUec9afZU/images/nodes/node-multi-condition-form.png?fit=max&auto=format&n=eqWkhSfBUec9afZU&q=85&s=d577077d1202d05cbe39e15be348d314" alt="Multi-Condition node configuration form" width="1440" height="1200" data-path="images/nodes/node-multi-condition-form.png" />
</Frame>

## When to Use

* **Multiple categories** - Route based on type, category, or classification
* **Status handling** - Different actions for different statuses
* **Department routing** - Send to Sales, Support, Billing, etc.
* **Multi-language** - Route based on detected language
* **Tiered responses** - Different handling for different levels

<Tip>
  Use Multi-Condition instead of nested Conditions when you have 3+ possible paths. It's cleaner and shows all options at once.
</Tip>

## Example: Email Routing

Route support emails to different teams:

<Steps>
  <Step title="Classify the email">
    Use an Ask AI node to categorize the email:

    ```
    Categorize this support email into exactly one category:
    BILLING, TECHNICAL, SALES, GENERAL

    Subject: {{event_from_app_1.email.subject}}
    Body: {{event_from_app_1.email.body}}

    Respond with only the category name.
    ```
  </Step>

  <Step title="Configure Multi-Condition">
    Add a Multi-Condition node:

    * Mode: **value**
    * Variable: `{{llm_1.response}}`
    * Cases:
      * BILLING
      * TECHNICAL
      * SALES
      * GENERAL
    * Default: enabled
  </Step>

  <Step title="Connect each case">
    Connect each handle to the appropriate action:

    * BILLING → Slack #billing-support
    * TECHNICAL → Slack #tech-support
    * SALES → Slack #sales-team
    * GENERAL → Slack #general-support
    * default → Slack #triage (for unexpected categories)
  </Step>
</Steps>

## Example: Order Status Handler

Different actions based on order status:

```
├── Webhook (order status update)
├── Multi-Condition (based on {{webhook_1.body.status}})
│   ├── pending → External API (send confirmation email)
│   ├── processing → External API (update inventory system)
│   ├── shipped → External API (send tracking email)
│   ├── delivered → External API (request review)
│   ├── cancelled → Execute Code (process refund)
│   └── default → External API (Slack: unknown status alert)
```

## Example: Language-Based Routing

Route to native speakers:

```
├── Event from App (new chat message)
├── Ask AI (detect language: EN, ES, FR, DE, other)
├── Multi-Condition (based on detected language)
│   ├── EN → Call Agent (English Support Agent)
│   ├── ES → Call Agent (Spanish Support Agent)
│   ├── FR → Call Agent (French Support Agent)
│   ├── DE → Call Agent (German Support Agent)
│   └── default → Human (manual language assignment)
```

## Multi-Condition modes

### Value Mode

Compare a single variable against multiple values:

**Configuration:**

```json theme={null}
{
  "mode": "value",
  "switchVariable": "{{llm_1.response.priority}}",
  "cases": [
    {"name": "Critical", "value": "P1"},
    {"name": "High", "value": "P2"},
    {"name": "Medium", "value": "P3"},
    {"name": "Low", "value": "P4"}
  ]
}
```

Each case checks: `{{llm_1.response.priority}} == "P1"`, etc.

### Conditions Mode

Each case has its own independent condition:

**Configuration:**

```json theme={null}
{
  "mode": "conditions",
  "cases": [
    {
      "name": "VIP Customer",
      "condition": "{{customer.tier}} == 'enterprise' AND {{customer.lifetime_value}} > 100000"
    },
    {
      "name": "At Risk",
      "condition": "{{customer.last_activity_days}} > 90 OR {{customer.support_tickets}} > 10"
    },
    {
      "name": "New Customer",
      "condition": "{{customer.created_days}} < 30"
    },
    {
      "name": "Standard",
      "condition": "true"
    }
  ]
}
```

<Note>
  In conditions mode, cases are evaluated in order. The first matching condition wins. Use a `true` condition last as a catch-all.
</Note>

## Default Case

The default case handles values that don't match any defined case:

```
├── Multi-Condition (order type)
│   ├── subscription → Handle subscription
│   ├── one-time → Handle one-time
│   ├── trial → Handle trial
│   └── default → Log unknown type, alert team
```

<Warning>
  Always enable the default case unless you're certain all possible values are covered. Unmatched values with no default will cause the workflow to stop.
</Warning>

## Case Naming

Give cases descriptive names that appear on the workflow canvas:

```
Good:
- "Enterprise Customer"
- "Needs Approval"
- "Auto-Processed"

Bad:
- "Case 1"
- "Option A"
- "True"
```

## Combining with Wait & Combine

If branches need to rejoin:

```
├── Multi-Condition (customer tier)
│   ├── enterprise → Premium processing
│   ├── business → Standard processing
│   └── free → Basic processing
├── Wait & Combine (wait for whichever branch executed)
└── External API (log completion)
```

## Dynamic Case Values

Reference variables in case values:

```json theme={null}
{
  "mode": "value",
  "switchVariable": "{{webhook_1.body.action}}",
  "cases": [
    {"name": "Create", "value": "CREATE"},
    {"name": "Update", "value": "UPDATE"},
    {"name": "Delete", "value": "DELETE"}
  ]
}
```

## Tips

<Tip>
  Use the Ask AI node before Multi-Condition to classify free-text into known categories. Then Multi-Condition routes based on the AI's structured output.
</Tip>

<Tip>
  Order matters in conditions mode - put more specific conditions first, general catch-alls last.
</Tip>

<Tip>
  You don't need to connect every case. Some cases might intentionally do nothing (the branch just ends).
</Tip>

## Condition vs. Multi-Condition

| Scenario                                  | Use                               |
| ----------------------------------------- | --------------------------------- |
| Yes/no decision                           | Condition                         |
| 2 options                                 | Condition                         |
| 3+ options                                | Multi-Condition                   |
| Comparing one variable to multiple values | Multi-Condition (value mode)      |
| Multiple independent conditions           | Multi-Condition (conditions mode) |

## Settings

<ParamField path="name" type="string" default="Multi-Condition">
  Display name shown on the canvas.
</ParamField>

<ParamField path="key" type="string" default="switch_1">
  Unique identifier for referencing outputs.
</ParamField>

<ParamField path="mode" type="string" default="value">
  How to evaluate cases:

  * **value** - Compare a variable against specific values
  * **conditions** - Each case has its own condition expression
</ParamField>

<ParamField path="switchVariable" type="string">
  For value mode: the variable to compare (e.g., `{{llm_1.response.category}}`).
</ParamField>

<ParamField path="cases" type="array">
  Array of cases, each with:

  * `name` - Label for this case
  * `value` - Value to match (value mode)
  * `condition` - Expression to evaluate (conditions mode)
</ParamField>

<ParamField path="defaultCase" type="boolean" default="true">
  Whether to include a default case for unmatched values.
</ParamField>

## Outputs

Multi-Condition has multiple output handles:

* **One handle per case** - Named after the case (e.g., "Sales", "Support")
* **default** - Executes when no cases match (if enabled)

<ParamField path="matchedCase" type="string">
  The name of the case that matched.
</ParamField>

<ParamField path="matchedValue" type="any">
  The value that triggered the match.
</ParamField>

## Related Nodes

<CardGroup cols={2}>
  <Card title="Condition" icon="code-branch" href="/nodes/logic/condition">
    Simple true/false branching.
  </Card>

  <Card title="Wait and Combine" icon="code-merge" href="/nodes/logic/wait-and-combine">
    Rejoin branches after Multi-Condition.
  </Card>
</CardGroup>
