# Branch

> Sends the call down a different path based on a value, like an AI decision’s yes or no.

Source: https://voxio.in/docs/steps-branch · voxioagent 2.0.0 · Index: https://voxio.in/docs/llms.txt

Type: `conditional`.

## What it does

1. Reads the first value named in `input_variables` from the call's state.
2. Compares it, as lower-case text with spaces trimmed, to each key in `mappings`. A yes/no value reads as `"true"` or `"false"`.
3. Goes to the matching path's step (or steps, if the path is a list).
4. If nothing matches it takes the `default` path. With no default it follows its `next`, and with neither it stops there.

In the editor each path is a dot on the card; drag from it to the step it leads to. Paths show the step they go to.

## Settings

Everything goes in the step's `parameters`. In the editor, click the step to open its settings.

- `input_variables` ({ name: type }): In the editor: **Decide on**. Something an earlier step decided, like End the call. Default: `{"hangup":"bool"}`.
- `mappings` ({ value: step | step[] }): In the editor: **Paths**. One path per answer. Connect each path to the step it leads to. Default: `{"true":"","false":""}`.

## Examples

### Yes or no

End the call or keep listening:

```json
{
  "type": "conditional",
  "parameters": {
    "input_variables": {
      "hangup": "bool"
    },
    "mappings": {
      "true": "goodbye",
      "false": "ask_for_input"
    }
  }
}
```

### Several answers and a default

Route by intent:

```json
{
  "type": "conditional",
  "parameters": {
    "input_variables": {
      "intent": "str"
    },
    "mappings": {
      "book": "booking",
      "cancel": [
        "cancel_reply",
        "notify"
      ],
      "default": "ask_for_input"
    }
  }
}
```

## Next steps

- [Steps](https://voxio.in/docs/steps.md): all the other steps.
- [Patterns](https://voxio.in/docs/workflows-patterns.md): see it in a full workflow.
