# Classify node

The **Classify** node routes execution into one of several named branches based on the input. Use it when you need deterministic, multi-way branching driven by an LLM (or by simple rules) — for example, triaging support tickets into `billing`, `technical`, or `other`.

Each category you define becomes a separate output handle on the node. Wire each handle into the branch that should handle that category.

---

## How it works

The runtime takes the current input (chat message, webhook payload, or upstream node output), asks the model:

> Classify the user's current intent into exactly one of these categories: `<your categories>`. Respond with only the category name, nothing else.

The chosen category name is written to:

- `last_output` — the name string
- `last_output_parsed.classification` — same value, structured
- `ctx.classification` — convenience alias

The runtime then activates the matching output handle. Downstream nodes connected to that handle run; the others are skipped.

If you provide **operator + value** on a category, that category becomes a *deterministic rule* (no LLM call) — the runtime evaluates `input <operator> value` directly. Useful for fast paths like "if input equals `refund`, go to the refund branch".

---

## Configuration

| Field | Description |
| --- | --- |
| **Categories** | List of categories. Each has a `name` and an optional `operator` + `value` for deterministic matching |
| **Examples** | Optional few-shot examples — `{ input, category }` pairs that guide the model |
| **Classifier model** | Override the default classifier LLM (optional) |
| **Input source** | Where to read the input from. Defaults to `input_as_text`. Can also reference `input.output_text` or `input.output_parsed.<field>` from the upstream agent |

Each category appears on the canvas as a labelled handle. The handle id is `category-<id>`.

---

## Assisted setup

The config panel does most of the wiring for you when the upstream node is a **JSON agent**:

- **Input auto-selected** — when you drop a Classify after an agent with a JSON output schema, the input source is pre-set to that agent's first routable field (`input.output_parsed.<field>`, preferring `enum` then `string` fields). The input pill shows the selected field; click it to pick another.
- **Categories auto-filled** — if the selected field is an `enum` (or a boolean), the categories are pre-created from its values (or `true`/`false`), each with a deterministic `==` rule. Your own edits are never overwritten.
- **"Fill from schema" button** — appears whenever the selected field has known values that your current categories don't cover. One click recreates the categories from the schema.
- **Collapsed matching editor** — each category row shows just its name; the operator + value matcher is folded behind the chevron. A match pill summarizes the rule when it adds information (a value differing from the name, or a non-`==` operator).
- **Value suggestions** — when editing a matcher on an `enum`/boolean field, known values are offered as picks instead of free typing.
- For a **numeric** field, set a threshold per category (e.g. `> 10`); the panel reminds you to prefer If/Else for complex multi-field logic.

---

## Example workflow

A support inbox triages incoming emails:

```
Webhook → Classify → ┬─ billing  → Agent (refund policy) → End
                     ├─ technical → Agent (engineering RAG) → End
                     └─ other     → Agent (generic reply)  → End
```

Classify node config:

- **billing** — "Refund, invoice, payment, subscription issues"
- **technical** — "Bug reports, integration questions, API errors"
- **other** — fallback for anything else

The model picks exactly one; the corresponding branch fires.

---

## Fallback behavior

If the model returns a name that does not match any category (rare with clear category labels), no downstream handle fires and the workflow ends on that branch. Add an explicit catch-all category (e.g. `other`) to guarantee one branch always runs.

---

## Tips

- **Keep category names short and meaningful** — single words or short noun phrases work best.
- **Use examples for ambiguous categories** — three or four well-chosen `{ input, category }` pairs lift accuracy noticeably.
- **Add a fallback** — always include an `other` category so unknown inputs have a home.
- **For structured upstream data, use `input.output_parsed.<field>`** as the input source instead of the raw text.
- **For fully deterministic routing**, set the `operator` and `value` on every category — no LLM call is made.

---

*Source: https://agentbuilder.systalink.sn/docs/node-classify — human documentation.*
*Other language: [/docs-md/fr/node-classify.md](/docs-md/fr/node-classify.md).*
*Machine-readable index: [/llms.txt](/llms.txt).*
