Skip to main content

Understanding automation logic

Written by Sam B.

When most people first try to build an automation, they describe it the way they'd describe any task: as a sequence of steps. "First do this, then do that, then do the other thing." That linear description feels natural because it mirrors how we narrate actions out loud.

But real-world processes aren't actually linear. They branch. They depend on conditions. They repeat in some situations and skip steps in others. A truly linear automation — one that executes the same fixed sequence every time regardless of context — is either too rigid to be useful, or it has quietly baked in a dozen assumptions you haven't noticed yet.

The tree model exists to make those assumptions explicit, and to give your automation a structure that can actually handle variation.

A tree is a hierarchy of steps and sub-steps. At the top sits a single root — the overall goal of your automation. Beneath it, that goal breaks into a small number of major steps. Each of those steps may break into sub-steps, and so on, until you reach actions that are atomic: simple enough to just execute without further decomposition.

The key insight is that each agent in the tree has one job. It either does something (e.g. a Browser agent), or it decides something (e.g. a Branch agent).

Example: Should I fly to Cancun?

The goal: check the weather for a location of your choice, and if it's colder than you'd like, find flights to Cancun so you can escape.

Step 1: State the goal at the root

Before you draw any branches, write the root node in plain language:

Check the weather at my location, and if it's too cold, find flights to Cancun

That's the root. Everything else in the tree is in service of this outcome.

Step 2: Ask "what would need to be true for this to work?"

To get from that goal to a working automation, three things need to happen:

  1. The automation needs to know the location and the temperature threshold

  2. It needs to look up the actual current weather for that location

  3. It needs to compare the result and act accordingly: do nothing if it's warm enough, or find flights if it's not

These become your three child agents.

Step 3: Break each agent down

Now zoom into each agent and ask the same question recursively: "What would need to be true for this agent to work?"

Child Agent 1 — Collect inputs from the user

  • Accept a location (city or zip code) formatted so the weather service will recognize it

  • Accept a preferred minimum temperature to use as the comparison threshold

Child Agent 2 — Look up the weather

  • Navigate to weather.gov

  • Search for the forecast for the inputted location

  • Extract the current temperature from the page

Child Agent 3 — Compare and act

  • Compare the fetched temperature against the user's threshold

  • If it's warmer than the threshold → the automation is done; no action needed

  • If it's colder than the threshold → trigger a sub-tree: find flights to Cancun

Child Agent 3b — Find flights to Cancun (only runs if it's too cold)

  • Navigate to Google Flights

  • Fill in the origin (the user's location), destination (Cancun), departure date (today), and return date (one week from today)

  • Read the first result on the page

  • Return the flight details: duration, whether it's direct, cost, and departure time

Did this answer your question?