AI is most useful in a workflow when its answer decides what happens next: an email is sorted into a folder, a reply is sent only if it passes a check, a person reviews the cases the model isn’t sure about. The AI step makes the judgment; regular flow nodes do the routing.
Classify, then route
Section titled “Classify, then route”flowchart LR In["New message"] --> Classify["Text Classifier"] Model["Chat model"] --> Classify Classify --> Switch["Switch on category"] Switch -->|Billing| A["Create billing task"] Switch -->|Bug| B["Post to the team channel"] Switch -->|Anything else| C["Save for later"]
- Text Classifier sorts the text into the Categories you list and returns
{ category }. If none fits, it returns"unknown". - Switch sends each item to the branch for its category, with a fallback for the rest. For two outcomes, an If node is enough.
Sentiment Analysis works the same way and returns { sentiment }. Both nodes can also run on-device with a Local Classifier, which adds confidence scores you can branch on.
Check before you act
Section titled “Check before you act”Guardrails checks text against a Policy you write, for example “no personal data, no promises about prices”. It has two outputs:
- Pass: the text complies.
- Fail: the text doesn’t comply, or the model’s verdict couldn’t be read. When in doubt, it fails.
Put Guardrails between an AI step that writes text and the step that sends or publishes it.
Ask a person when it matters
Section titled “Ask a person when it matters”Some decisions shouldn’t be left to a model alone. Pause the run and ask:
- Wait For Approval pauses until someone approves or rejects. Put it before a step that sends, deletes or pays.
- In-Page Form shows a form on the page and continues with the values you enter, for example a corrected category or a missing detail.
A common pattern: let items with a clear category go through automatically, and send unknown ones to Wait For Approval.
Agents that act through the Browser, HTTP Request or MCP Client tools always ask for approval. See Action approval.
Plan for model errors
Section titled “Plan for model errors”Models fail sometimes: a rate limit, a refused API key, an answer in the wrong format.
- Turn on Retry in the AI node’s settings for temporary failures, and Continue On Fail when the run should go on without the answer. See Error handling.
- Wrap risky steps in a Try node to route a failure instead of ending the run.
- Use an Auto-fixing Output Parser when a later step needs a strict format.
- Add an Error Trigger workflow to be told when a workflow fails.