“If → then”: autopilot without code
Lesson 13 of 22 in the course “AI Agents for Life”. Free, with animations and a quiz.
Anatomy of an automation
A schedule runs an agent by the clock. An automation runs it on an event. The formula is simple: “if… then…”. If an email with a receipt arrives, then the AI pulls out the date, amount and shop, and adds a row to your spending sheet. Three building blocks: a trigger (what happened), an AI step (what to understand) and an action (what to do). And a fourth block is the stop rule from lesson three: if the amount is over $100, the automation stops and asks you. No code needed: these chains are built with a mouse in Zapier or n8n.
Workflow or agent
Anthropic’s guide to agents draws an important distinction. A workflow is a chain where the steps are set in advance: email → AI → spreadsheet. An agent decides by itself which steps to take and in what order. A workflow is predictable and cheaper; an agent is more flexible, but can wander off. Anthropic’s advice: start with the simplest solution and add complexity only when it’s really needed. For most everyday tasks a workflow is enough. Receipts, reminders, moving data from an email to a sheet: workflow. “Find me a flat”: that’s already an agent.
Zapier and n8n
These are the two best-known builders for such chains. Zapier runs in the cloud and connects to more than 9,000 apps, so it’s the easiest place to start. Its agents run on demand, on a schedule or on an event from another app. n8n can be installed on your own computer or server, and its source code is open. That’s handy if you care that your data doesn’t go to outsiders. And the key thing both have: an approval pause. The automation stops before an important step, like sending an email, and waits for your “yes.”
The approval pause
A pause is a stop rule built into the automation. In Zapier, for example, an agent can stop before sending an external email and notify you by email or chat. Until you press “continue,” it won’t go further. Where do you put a pause? Wherever the brief says “asks you first”: money above a limit, messages to real people, deleting. Liza has a pause on receipts over $100. Once a week she approves a couple of purchases, and no big spend slips past her.
What can go wrong
Automations have their own pitfalls. One: a loop. A chain “new email → reply” can start answering itself if the reply also lands in the inbox. Two: a silent break. A shop changes its receipt format, the AI stops finding the amount, and the sheet sits empty for a week without anyone noticing. Three: excess permissions. A receipt chain doesn’t need permission to send email. The fix is simple: a filter for “only emails from shops,” a weekly glance at the result and least privilege, as in the connectors lesson.
Try it: the receipt bookkeeper
Build your first chain in Zapier or n8n; both have a free way to start. Trigger: a new Gmail email with a filter, for example with “receipt” in the subject. Then the AI step: paste the brief below into it. Then the action: “add a row to Google Sheets.” And a filter pause: if the amount is over $100, notify you first. Not ready to connect services? Open the “Autopilot” trainer: you build the same thing there from cards, risk-free. And you can test the brief in a normal chat by pasting in a couple of receipt emails.
Check yourself
- Which fits better here: a workflow or an agent?
Correct answer: A workflow: the steps are always the same. Anthropic’s advice: start simple. When the path is known in advance, a workflow is more reliable and cheaper than an agent. - What most likely happened?
Correct answer: A loop: replies land in the inbox and trigger the chain again. A classic automation pitfall. Fixed with a filter: only run on emails from other people, not yourself. - Where should the approval pause go?
Correct answer: Before emails go out to people. A pause belongs where a mistake can’t be undone: an email to a real person. Reading risks nothing. - How do you catch a break like this in time?
Correct answer: Check the result weekly and make “NO RECEIPT” visible. A silent break is caught by a quick check. A “NO RECEIPT” row in the sheet shows right away that the email format changed.
← Schedules: the agent shows up by itself Your own Telegram bot →