# Anatomy of an automation

Get to know the four kinds of step every flow is made of, and what happens each time one runs.

Source: https://support.rework.com/article/anatomy-of-an-automation

An automation is a picture of a piece of work: what starts it, and what should happen next. You draw it once on a canvas, and the app runs it for you every time the starting event arrives. Everything in the app is built on a handful of ideas, and once you know them the rest of the product reads easily 💡

## A flow is a trigger and the steps after it

Every automation is one **flow**: a single trigger at the top, then the steps that follow it, connected top to bottom. Each box on the canvas is a step. Each line between two boxes says what runs next.

![The Route new leads to a rep flow on the Builder canvas](https://storage.googleapis.com/reworkv3-public/success/260923/ACQgVEyvzAEjH8GcUJvjHwtZCHdLf2HftFIIVmMzGJcFEnXzYvSqu6f5UVXF8E6q/img.8DAvpEcVx68T0AnSEWgmsZl0xnS5UtxvaqyV76ii6xigmrPTrm0Rg6yhFxZ6J6aA.png)

There are four kinds of step, and telling them apart is most of what you need.

| Kind | What it does | Examples |
| --- | --- | --- |
| **Trigger** | Starts a run. Exactly one per automation, always the first step. | **Webhook**, **Schedule**, an event in another Rework app |
| **Action** | Does one piece of work, then continues. | **Send email**, **HTTP request**, **Set variable** |
| **Filter** | Asks a yes or no question and quietly stops the run when the answer is no. | **Only continue if** |
| **Control** | Shapes the path instead of doing work. | **Branches**, **Merge**, **Loop**, **Wait** |

Steps come from **packs**, grouped in the step picker by the app or service they belong to. Steps labelled **Soon** aren't available yet.

## A run is one pass through the flow

Each time the trigger fires, the app creates a **run**: one pass through the flow, from the trigger to wherever the path ends. A run records what each step did, in order, with the data that went in and the data that came out.

![A finished run with each step's result](https://storage.googleapis.com/reworkv3-public/success/260923/rf0XuZ6oyhnBzlYnF5YBNzFeTIkHZwUeZNSLoemiAlF5rCdUwRyVjNCsJsix4Jfl/img.JscmHdM0zLXLzhdE6Qsa3pnrPKgK1ARJYUAu9Zpz7CQLOeQrEATIJgt8OE8YJYag.png)

A run ends in one of these states:

| Run status | Meaning |
| --- | --- |
| **Completed** | Every step on the path taken finished. A filter that stopped the run still counts as completed. |
| **Partially failed** | A step threw an error, so the flow stopped there. |
| **Enrolled** | The run is still going, usually parked on a **Wait** step. |
| **Unenrolled** | Someone stopped the run before it finished. |

Inside a run, each step has its own result: **Success**, **Failed**, **Skipped** (a branch arm that wasn't taken) or **Pending**. See [Read a run step by step](https://support.rework.com/article/read-a-run-step-by-step).

## Steps pass data down the flow

A step can use anything the steps above it produced. You reference it with a token such as `{{trigger.body.email}}`, and the app fills in the real value while the run happens. That's what turns a flow from a fixed script into something that responds to each event. See [Pass data between steps](https://support.rework.com/article/pass-data-between-steps).

## What to read next

- [Drafts and published flows](https://support.rework.com/article/drafts-and-published-flows): the difference between what you're editing and what's live.
  
- [How a flow is shaped](https://support.rework.com/article/how-a-flow-is-shaped): the rules for branching, merging and looping.
  
- [Create your first automation](https://support.rework.com/article/create-your-first-automation): build one end to end.
