By the end of this lesson Shree Sarees will get a low-stock summary every morning at 9, and the workflow will retry short failures, fall back when the AI step fails, alert you when a run breaks, and stop an agent that goes round in circles.
You need: the Shree Sarees sheet from lesson 2, your Gmail credential, and the chat agent from lessons 1 and 2 · Time: 9 minutes
You built this shape in n8n 101: a schedule, a sheet, one email. Today it gets an AI step and four safety nets. Create a new workflow called
Daily stock check:- Schedule Trigger: every day at 9am. In the workflow Settings, set the time zone to
Asia/Kolkata. - Google Sheets: Get Row(s) from the
Stocktab, no filter, so it reads every row. - Filter: keep only rows where
Qtyis less than3. - Aggregate: choose All Item Data and type
dataas the output field, so all rows become one item and you get one email, not ten. - Basic LLM Chain with your
AllModelAPIchat model, and this prompt:
Prompt · copy it into your AI agentYou write a short morning stock note for the owner of Shree Sarees, a saree boutique in Surat. Here are the items with less than 3 pieces left, as JSON: {{ JSON.stringify($json.data) }} Write at most 6 lines in simple English: first the items at 0, then the rest, each as "Item (Colour): N left". End with one line suggesting which item to reorder first and why. Do not invent items that are not in the list.- Gmail: send the chain's text to the owner, subject
Low stock today.
Why a chain and not an agent? This job is the same five steps every morning. There is nothing for an AI to decide, only text to write.
The daily workflow on top, and the four safety nets this lesson adds. Why?A workflow that runs while you sleep has no one watching it. If it fails silently, the owner doesn't get the email and nobody knows why. Safety nets turn silent failures into retries, fallbacks and alerts.
- Schedule Trigger: every day at 9am. In the workflow Settings, set the time zone to
Log in free to read the rest of this lesson
Every lesson is free. A free account unlocks all of them and saves your progress.
Still to come in this lesson:
- Net 1: retry short failures
- Net 2: a fallback when a step fails
- Net 3: an alert when a run breaks
- Net 4: limits for the chat agent
- Recap