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

# Router Connection Rules

> Design valid router graphs with category-aware lanes

## Overview

Router graphs use strict connection rules to keep request routing understandable and safe. The editor validates every edge as you draw it and rejects unsupported source-target pairs with a warning.

## Valid Topology

```mermaid theme={null}
graph LR
    Trigger((Trigger)) --> Signal[Signal]
    Trigger --> Projection[Projection]
    Trigger --> Decision[Decision]
    Decision --> Algorithm[Algorithm]
    Decision --> Plugin[Plugin]
```

## Allowed Lanes

| Lane                 | When to Use                                                     |
| -------------------- | --------------------------------------------------------------- |
| Trigger → Signal     | Evaluate request inputs or content before routing               |
| Trigger → Projection | Derive structured routing context                               |
| Trigger → Decision   | Evaluate routing rules                                          |
| Decision → Algorithm | Select endpoints, weights, order, or fallback behavior          |
| Decision → Plugin    | Apply extension behavior such as cache, policy, or integrations |

## Common Invalid Connections

<AccordionGroup>
  <Accordion title="Trigger → Algorithm">
    Algorithms must attach to a Decision. Add a Decision node, connect Trigger → Decision, then connect Decision → Algorithm.
  </Accordion>

  <Accordion title="Signal → Decision">
    Signals are evaluated from the trigger and referenced by Decision rules. Connect Trigger → Signal and reference the signal in the decision configuration.
  </Accordion>

  <Accordion title="Projection → Decision">
    Projections are also evaluated from the trigger and referenced by name. Connect Trigger → Projection and reference the projection from the Decision.
  </Accordion>

  <Accordion title="Decision → Decision">
    Decisions do not chain. Model multiple conditions inside one Decision action or use priority inside the decision configuration.
  </Accordion>

  <Accordion title="Algorithm or Plugin → Any Node">
    Algorithms and plugins are leaf nodes. They do not have outgoing connections.
  </Accordion>
</AccordionGroup>

## Recommended Design Pattern

Use this repeatable pattern for most routers:

1. Add Signals for request facts you need to evaluate.
2. Add Projections for derived or normalized context.
3. Add one Decision that references those inputs.
4. Attach one or more Algorithm or Plugin leaf nodes from the Decision.

```mermaid theme={null}
flowchart TD
    A[Request enters Trigger] --> B[Evaluate Signals]
    A --> C[Compute Projections]
    A --> D[Decision reads signal and projection outputs]
    D --> E{Route selected?}
    E -->|Endpoint strategy| F[Algorithm leaf]
    E -->|Extension policy| G[Plugin leaf]
```

## Troubleshooting Edge Warnings

If the editor blocks an edge:

1. Check the source and target action categories.
2. Confirm the target belongs in one of the allowed lanes.
3. If an action appears in the wrong category, refresh the page to reload `/routers/actions` metadata.
4. If the action type is custom, ensure its prefix or API category resolves to Signal, Decision, Projection, Algorithm, or Plugin.
