# What is a workflow

A workflow automates work that should happen without someone stepping through it.
When an order arrives, check it, create a job and notify the team. Every night,
export the day's production figures. When a file lands in a watched folder, read
it and update the matching records. You describe the work once; the platform runs
it each time it is needed and records what happened.

## Nodes and edges

A workflow is made of steps, called nodes, joined by connections, called edges.
Each node does one thing: calculate values, test a condition, run a Lua script,
query data, call an external service, wait, or repeat work for each item in a
list. An edge means one node runs after another. The order you write nodes in
does not matter; the edges decide what runs when. A condition node chooses which
branch continues.

Each run receives inputs, available as `input`, and an optional input schema
states which inputs a run needs. Every node's result is available to the nodes
after it as `nodes.<id>.output`, so a later step can use what an earlier step
produced.

## How a workflow starts

Run a workflow yourself, or start it through the API with `executeWorkflow`,
supplying its inputs. To run it automatically, attach a trigger:

- on a schedule;
- when a platform event occurs, such as a record changing; the trigger can load
  that record's data into the run's inputs first;
- when a connected device publishes a message;
- when a webhook address is called;
- when an edge app reports an event;
- when a file arrives in a watched folder.

## What happens during a run

Each run is an execution you can inspect: its inputs, the status and output of
every step, and any error. A workflow runs under its execution identity, a bot
user whose permissions decide what the workflow can read and change. Give that
identity only the access the workflow needs.

You edit a draft and save it as a version. One version is active and is used by
new runs; activating another version never rewrites an existing one.

## When to use something else

A workflow runs on its own. For a guided process that a person steps through,
use a Journey. For a screen that shows and edits data, use a Workspace. For a
document or data export produced on demand or on a schedule, use a Report; a
workflow can start one with a `run-report` step.

The next chapter builds a first workflow in the editor.