> ## 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.

# Logic Nodes

> Make decisions, repeat steps, wait for approval, and control how your workflow runs

Logic nodes help your workflow make decisions. They're like traffic directors - they decide where things go next, whether to repeat something, or when to pause and wait.

## Available Logic Nodes

<CardGroup cols={2}>
  <Card title="Condition" icon="code-branch" href="/nodes/logic/condition">
    Go one way if something is true, another way if it's not. Like an "if/else" statement.
  </Card>

  <Card title="Multi-Condition" icon="arrows-split-up-and-left" href="/nodes/logic/multi-condition">
    Choose between multiple options based on a value. Like a menu with many choices.
  </Card>

  <Card title="Loop" icon="rotate" href="/nodes/logic/loop">
    Repeat the same steps for each item in a list.
  </Card>

  <Card title="Human Step" icon="user" href="/nodes/communication/human-step">
    Pause and wait for someone to approve, confirm, or reply before continuing.
  </Card>

  <Card title="Wait and Combine" icon="code-merge" href="/nodes/logic/wait-and-combine">
    Wait for all separate paths to finish before moving on.
  </Card>

  <Card title="Pause" icon="clock" href="/nodes/logic/pause">
    Wait for a certain amount of time before continuing.
  </Card>
</CardGroup>

## Which One Should I Use?

| I want to...                                      | Use This                                          |
| ------------------------------------------------- | ------------------------------------------------- |
| Do something different based on yes/no            | [Condition](/nodes/logic/condition)               |
| Choose between 3 or more options                  | [Multi-Condition](/nodes/logic/multi-condition)   |
| Do the same thing for every item in a list        | [Loop](/nodes/logic/loop)                         |
| Get a person's approval before continuing         | [Human Step](/nodes/communication/human-step)     |
| Make sure multiple things finish before moving on | [Wait and Combine](/nodes/logic/wait-and-combine) |
| Wait before doing the next step                   | [Pause](/nodes/logic/pause)                       |

## Common Patterns

### One Thing After Another

The simplest flow - each step happens after the one before:

```
Start → Ask AI → Send Email → Done
```

### Yes or No Decision

Different paths depending on a condition:

```
Start → Is it urgent?
          ├── Yes: Alert the team immediately
          └── No: Add to regular queue
```

### Multiple Choices

Route to different places based on a category:

```
Start → What type is it?
          ├── Sales: Send to sales team
          ├── Support: Send to support team
          ├── Billing: Send to billing team
          └── Other: Send to general inbox
```

### Do Something, Then Continue Together

When you need multiple things to happen before moving on:

```
Start → Send alert to Slack ────────┐
      → Send alert to Email ────────┼→ Log that both were sent
      → Send alert to SMS ──────────┘
```

### Repeat for Each Item

Do the same thing for every item in a list:

```
Start → For each customer:
          └── Send personalized email
        → When done: Log how many were sent
```

## Connection Points

Logic nodes have special outputs:

### Condition Node

* **Green (met)** - Goes here when the condition is true
* **Red (unmet)** - Goes here when the condition is false

### Multi-Condition Node

* **One for each option** - You create these based on your choices
* **Default** - Goes here when nothing else matches

### Loop Node

* **Inside the loop** - Runs for each item
* **After the loop** - Runs once when all items are done

### Human Step Node

* Branches on what the person did: approved, rejected, completed, or failed
* See the [Human Step node](/nodes/communication/human-step) for the full set of outcomes

## Tips

<Tip>
  You don't have to connect every output. It's fine if a "no" path just ends without doing anything.
</Tip>

<Tip>
  Use Wait and Combine when you need to wait for multiple things to finish. Without it, the workflow moves on as soon as the first thing finishes.
</Tip>

<Note>
  Logic nodes don't actually do work themselves - they just direct traffic to the nodes that do.
</Note>

## Next Steps

<CardGroup cols={2}>
  <Card title="Condition Node" icon="code-branch" href="/nodes/logic/condition">
    Start with basic branching
  </Card>

  <Card title="Loop Node" icon="rotate" href="/nodes/logic/loop">
    Learn to process collections
  </Card>
</CardGroup>
