Phase 0: AI Workflow Automation Fundamentals · 45 min · n8n · OpenAI API
When to Use AI vs Deterministic Rules
AI for understanding, deterministic for execution.
Hiring signal: The candidate who says 'not every step needs AI — use a regex for email validation and an LLM for document classification' demonstrates the triage mindset that separates automation engineers from AI hobbyists. This is the skill that the 'process automation design round' interview test evaluates directly.
What you will learn
- Apply the feasibility/desirability/viability triage framework to decide which steps use AI vs deterministic rules
- Identify when AI is the right tool: unstructured data, fuzzy matching, classification, extraction from documents
- Identify when deterministic rules are better: exact matching, arithmetic, conditional routing, data validation
- Apply the hybrid pattern: AI for understanding, deterministic for execution
The Problem
A team builds an automation that processes expense reports. They use an LLM to extract the amount from each receipt — "extract the total amount as a number." It works 95% of the time. The other 5%, it returns "$45.30" instead of "45.30", or "forty-five dollars" instead of "45.00", or misreads a smudged "3" as "8". Meanwhile, they also use the LLM to check if the amount exceeds $500 (for manager approval) — a simple comparison that a Code node could do in one line.
They're using AI for a comparison operation. And they're not using validation for the extraction. Every step that could be deterministic is AI, and every step that needs AI has no deterministic safety net.
Not every step needs AI — use a regex for email validation and an LLM for document classification
The triage mindset — knowing which steps use AI and which stay deterministic — is what separates automation engineers from AI hobbyists. Using AI for everything is expensive, slow, and unreliable. Using rules for everything can't handle unstructured data. The skill is knowing which is which.
The Concept
The Triage Framework: Feasibility / Desirability / Viability
For every step in your workflow, ask three questions:
| Question | If Yes | If No |
|---|
| Feasibility: Can a deterministic rule handle this? | Use deterministic | Consider AI |
| Desirability: Is the input unstructured or ambiguous? | Consider AI | Use deterministic |
| Viability: Is the cost of AI justified for this step? | Proceed with AI | Use deterministic |
When AI Is the Right Tool
| Situation | Why AI | Example |
|---|
| Unstructured text | No rule can parse free-form text | Classify email as complaint/inquiry/billing |
| Fuzzy matching | Exact match fails; need semantic similarity | Match "invoice" to "bill" and "statement" |
| Classification | Categories overlap; need judgment | Is this review positive, negative, or mixed? |
| Extraction from documents | Layout varies; no fixed positions | Extract vendor name from 50 different invoice formats |
| Generation | Need novel text, not template | Draft a personalized response to a customer |
| Summarization | Need to condense long text | Summarize a 10-page contract into key terms |
When Deterministic Rules Are Better
| Situation | Why Deterministic | Example |
|---|
| Exact matching | No ambiguity; rule is 100% accurate | Does email contain "unsubscribe"? |
| Arithmetic | Math is deterministic | Is amount > $500? |
| Conditional routing | Known categories, fixed branches | Route by department: sales/support/billing |
| Data validation | Format checks are deterministic | Is email valid? Is date in YYYY-MM-DD? |
| API calls | Structured request/response | Create record in CRM via REST API |
| Deduplication | Exact match or hash comparison | Remove duplicate entries by email address |
Your workflow needs to check if a customer's email domain matches your company's domain (internal vs external). Should this use AI?
This is an exact string match — a deterministic operation. Using an LLM for this would cost money, add latency, and introduce errors (what if the LLM hallucinates?). A simple JavaScript check like email.endsWith('@yourcompany.com') is 100% accurate, instant, and free.
The Hybrid Pattern: AI for Understanding, Deterministic for Execution
This is the pattern that production automations follow:
┌─────────────────────────────────────────────────────────────┐
│ AI LAYER (understanding) │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Classify │ │ Extract │ │ Generate │ │
│ │ (what is │ │ (pull │ │ (write │ │
│ │ this?) │ │ data) │ │ text) │ │
│ └──────────┘ └──────────┘ └──────────┘ │
│ ↓ ↓ ↓ │
├─────────────────────────────────────────────────────────────┤
│ DETERMINISTIC LAYER (execution) │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Validate │ │ Route │ │ Lookup │ │ Action │ │
│ │ (check │ │ (IF/ │ │ (DB/API │ │ (create, │ │
│ │ output) │ │ Switch) │ │ call) │ │ update) │ │
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
└─────────────────────────────────────────────────────────────┘
Common Anti-Patterns
| Anti-Pattern | What They Do | What They Should Do |
|---|
| LLM for email validation | "Is this a valid email?" → LLM | regex.test(email) — 100% accurate, free |
| LLM for date comparison | "Is date1 after date2?" → LLM | new Date(date1) > new Date(date2) |
| LLM for arithmetic | "Calculate total of these items" → LLM | items.reduce((sum, i) => sum + i.price, 0) |
| Rules for sentiment | if text.includes('good') → positive | LLM — sentiment needs semantic understanding |
| Rules for classification | Keyword matching for email categories | LLM — "I want my money back" has no keyword "refund" |
| No validation after AI | Trust AI output blindly | Validate extracted data against database/schema |
Unlock the full lesson
You've read the first 2 sections. The rest of this lesson covers Build It, Use It, Ship It, Exercises, Key Terms, Common Pitfalls — plus a hands-on lab, quiz, and project artifact.
Create a free account to unlock Phase 0 and Phase 1 of every course — no credit card.
Browse all courses · View pricing · DeVenture Academy