Automation · Module 05 · Beginner

Flows: chaining steps that don't need a brain

A flow is a sequence of steps that runs on a schedule or a trigger, mostly deterministic, with an AI step or two mixed in. Think of it as plumbing.

Flows vs. agents (again)

A flow is the boring, reliable cousin of an agent. It doesn't decide anything at a high level — you decided everything when you drew the flow. AI shows up as a step: "classify this email," "summarize this doc," "draft this reply." The flow itself is just Python or a visual boxes-and-arrows canvas.

Use flows when

You know the exact sequence. You need predictability. You have a schedule or a trigger event (new email, new file, cron). You want to ship in an hour, not a week.

Where you can build flows

ToolCharacterGood for
n8n (open source)Visual, self-hostable, developer-friendlySerious internal automation. Deploy on your own server. Free.
MakeVisual, powerful, cloud-onlyRich UI, great for complex branching. Paid.
ZapierVisual, simplest, most integrationsQuick wins, non-technical teammates. Paid.
Perplexity Computer cronNatural-language scheduled tasks"Every Monday at 8am, summarize new RFPs in my inbox." Zero setup.
Cloudflare WorkersCode, cheap, global edgeCustom logic you fully control. Runs on the network we already use.

Case study: inbound-lead intake flow

Trigger: a new email to hello@your-company.com. Same pattern works for a design agency, a real-estate broker, a plumbing contractor, or a small SaaS.

New email Classify (LLM) NEW_LEAD → extract details EXISTING_CLIENT → tag + label SPAM → archive Draft reply (LLM) Gmail draft for owner review Notion CRM: create card name · budget · deadline · fit score source: parsed JSON from step 2
Predictable. Debuggable. Runs every 5 minutes. AI touches two steps; everything else is plumbing.

Build it in n8n (visual)

n8n is a free, open-source visual flow builder. You can self-host it on a Cloudflare tunnel or run it locally. The above flow, in n8n, is roughly:

  1. Gmail Trigger node — polls every 5 min for new mail to hello@.
  2. OpenAI / Anthropic node — prompt classifies to NEW_LEAD | EXISTING_CLIENT | SPAM, returns JSON.
  3. Switch node — routes based on the classification.
  4. NEW_LEAD branch: OpenAI node extracts {client, budget, deadline}Notion node creates a CRM card → OpenAI node drafts a reply → Gmail node saves as draft.
  5. EXISTING_CLIENT branch: Gmail node adds a label, sends Slack ping to #projects.
  6. SPAM branch: Gmail node moves to archive.

Total time to build once you have n8n running: 30–45 minutes. Total lines of code: zero.

Build it in Cloudflare Workers (code)

Because you already deploy on Cloudflare, here's the same flow as a Worker triggered by Gmail push:

TypeScript · Cloudflare Workerexport default {
  async fetch(request, env, ctx) {
    const email = await request.json();

    // 1. Classify with a cheap model
    const cls = await classify(email, env);
    if (cls === "SPAM") return new Response("ok");

    // 2. Route
    if (cls === "NEW_LEAD") {
      const details = await extractLeadDetails(email, env);
      await createNotionCard(details, env);
      const draft = await draftReply(email, details, env);
      await saveGmailDraft(draft, env);
    } else if (cls === "EXISTING_CLIENT") {
      await labelEmail(email.id, "active-project", env);
      await pingSlack("#projects", email, env);
    }

    return new Response("ok");
  }
};

async function classify(email, env) {
  const res = await fetch("https://api.openai.com/v1/chat/completions", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${env.OPENAI_API_KEY}`,
      "Content-Type": "application/json"
    },
    body: JSON.stringify({
      model: "gpt-5-mini",
      messages: [
        { role: "system", content: "Classify to NEW_LEAD, EXISTING_CLIENT, or SPAM. Reply one word." },
        { role: "user", content: `Subject: ${email.subject}\n\n${email.body}` }
      ],
      temperature: 0
    })
  });
  const json = await res.json();
  return json.choices[0].message.content.trim();
}

Deploy with wrangler deploy. The whole thing runs at the edge, no server to maintain, roughly $0.30/month at your volume.

The simplest flow: a scheduled task in Computer

You don't need n8n or a Worker for many flows. In Perplexity Computer, you can just say:

Try this in a fresh Computer thread

"Every weekday at 8am, check my inbox for new emails, classify each as NEW_LEAD / EXISTING_CLIENT / SPAM, and send me a Slack summary to #inbox-triage with a link to each. Don't reply automatically."

That's a real cron job. It writes the schedule, wires the connectors, and runs while you sleep. We'll build one properly in Module 8.

Exercise · 20 min

Pick one flow and specify it fully

Choose a repetitive task from your business. Draft the flow before touching any tool:

  1. Trigger: what starts it? (new email, new Drive file, cron, form submit)
  2. Steps: list every step as a verb — "classify," "extract," "draft," "notify."
  3. AI steps: mark which ones need an LLM.
  4. Data at each step: what's the input, what's the output?
  5. Failure modes: what if the LLM returns junk? What if the API is down?

Save this spec. In Module 8 we'll actually build it.

Or pass the quiz above.