# Steps

> Add a step to a flow, set it up, test it on its own without sending anything, switch it off, and reuse a configured step across flows.

Source: https://docs.go-lumen.ai/build/steps

A step does one thing to the documents of a run: reads a PDF, adds a row, sends an email. You add steps after the trigger, set each one up in a side panel, and test it on its own before the flow ever runs.

-   Any workspace
-   Console or YAML

Every step has a reference page with its inputs, outputs and every setting. [Send it to me by email](https://docs.go-lumen.ai/reference/steps/send-email.md) is an example of one.

## Add a step

**Console:**

1.  Open the flow in the editor. Hover the line after the step you want to follow, and click the **+** on it. (Right after the trigger, the **+** reads **Add a step after** the trigger's name.)
    
2.  Choose what to add:
    
    | Entry | What it adds |
    | --- | --- |
    | **Action** | A step from the catalog, grouped by type (below). |
    | **AI** | The AI steps, such as an agent that reads a document and finds details. |
    | **Branches** | A [branch](https://docs.go-lumen.ai/build/branches-and-filters.md#branch) with a path for each case. |
    | **Filter** | A [filter](https://docs.go-lumen.ai/build/branches-and-filters.md#filter) that stops the run unless a condition holds. |
    | **Wait** | A [wait](https://docs.go-lumen.ai/build/waits-and-schedules.md#wait) for a while, or until a date. |
    | **Call API** | A request to another system. |
    
3.  Under **Action**, type in **Search for a step** or open a group. Click the step.
    
4.  Set it up in the panel that opens, then click **Done**.
    

![The menu that opens from a + on the canvas. It lists Action and AI, each with an arrow, then Branches, Filter, Wait and Call API.](https://docs.go-lumen.ai/img/build/steps-01-add-menu.png)

*The first menu after a +.*

The steps are grouped by what they do: **AI**, **Tables**, **Files & PDF**, **Messages**, **Logic**, **Business**, **Connections**, **Jira** and **GitHub**. The ones you added last come first under **Recent**, and your saved agents are listed first in their group under **Your agents**. Search looks at every word of a step's title and description. A small credit figure under each name is what the step costs per run, and the **(i)** beside it previews an example: what goes in and what comes out.

![The step picker under Action: a Back link, a Search for a step box, and the Tables group open with seven steps, among them Add a row to a table, Look up a row in a table, Update a row in a table and Make a CSV file. Each shows its credit cost and an information icon.](https://docs.go-lumen.ai/img/build/steps-02-picker.png)

*The step picker, one group open.*

**YAML:**

A step is a node with `stepRef` and, when the step takes settings, `config`. Link it from the step before it with `next`.

```yaml title="pdf-bundle.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: steps-pdf-bundle
  namespace: tenant-acme
spec:
  displayName: Merge and keep a pile of PDFs
  triggers:
    - id: manual
      ref: {name: manual-run}
      next: [pdfs]
  nodes:
    - id: pdfs
      title: Only the PDFs
      stepRef: {name: keep-pdfs}
      next: [merge]
    - id: merge
      stepRef: {name: merge-pdfs}
      next: [rename]
    - id: rename
      stepRef: {name: rename-file}
      config: {pattern: "{date} merged.pdf"}
      disabled: true
      next: [keep]
    - id: keep
      stepRef: {name: keep-in-lumen}
```

A flow has at most 64 nodes. Steps cannot loop back: the graph has no cycles.

### The picker offers only steps that can run there

Each step needs something from the steps before it: an email, files, text, or "the details" (fields found earlier). A step whose need is not met at that spot is moved to a **Not available here** group at the bottom of the picker, and the row says why and what fixes it, for example "Needs files, and nothing before it produces that" with the step to add first. A step marked **Not set up** exists in the catalog but this installation has not configured what it needs.

The API enforces the same rule: a flow with a step whose needs nothing upstream provides is refused. See [Data and placeholders](https://docs.go-lumen.ai/concepts/data-and-placeholders.md) for what each trigger and step provides.

## Set up a step

Click a step to open its panel. It has these tabs:

| Tab | What it holds |
| --- | --- |
| **Settings** | The step's settings. A check mark on the tab means every required setting is filled in. |
| **Preview** | For some steps, a live picture of the result: the email that would be sent, the notification, the table row. |
| **Test** | Runs this one step. See [Test a step](#test). |
| **Output** | What the step produced on a run, once the flow has run. |

The **Name** field at the top is the title the canvas and the run view show. Leave it empty for the step's default title. You can also double-click a step on the canvas to rename it. A name is display only (`title` in YAML, up to 80 characters): conditions and placeholders refer to the step by its id, so renaming one breaks nothing, and two steps may share a name.

Text settings accept placeholders such as `{email.from}`: click the `{x}` button beside a field to pick one from what comes earlier. **Example** shows a ready-made use of the step, and **Remove this step** takes it out of the flow when you save. **Cancel** after a change asks before it discards what you typed.

## Test a step

You can run one step without running the flow. Open the step and choose **Test**.

1.  Save the flow once. A test needs a saved flow.
2.  On the **Test** tab, click **Test step**. The step runs with the settings as they are now, saved or not, on an empty document.
3.  To test on real data, open the editor from a finished run (the run page has **Open in editor with this run's data**). The step then runs on what reached it in that run.
4.  Read the **Result**: **Worked** or **Failed**, the fields the step produced, and the credits it would use. A test is metered but never charged.

![The Test tab of the Send it to me by email step. Under Test step, a Test step button, then Result with a green Worked tag. A blue note reads Dry run: Would run send-email. Nothing was sent or saved. Below, a Fields table lists one field, sentTo, of type Text, with the value dana@acme.test, and a footer says 0.5 credits, metered, not charged.](https://docs.go-lumen.ai/img/build/steps-03-test-tab.png)

*A dry run of a step that sends an email. Nothing leaves Lumen.*

### Steps that change something outside Lumen

A step that sends an email, saves a file, adds a row, posts a message or calls an API is a step with side effects. Testing one is a dry run by default: it checks the settings and shows what it would do ("Dry run: Would run send-email. Nothing was sent or saved.") without doing it. To make a test real, turn on **Really send (emails, saves, API calls)** on the Test tab; the panel says "On: this test really sends or saves." Leave it off unless you mean it.

A dry run is the right way to check a step's settings. To check how a whole flow behaves before it goes live, run it on a set of test cases instead. See [Test and evaluate](https://docs.go-lumen.ai/build/test-and-evaluate.md).

## Switch a step off

A disabled step stays in the flow with its settings but is skipped. It costs nothing, and the documents that reach it go on unchanged, with none of the fields it would have added. It still shows in the run, marked as skipped.

**Console:**

Select the step and click the stop icon in its toolbar, or open its **...** menu and choose **Disable**, or press **D** with the step focused. Do the same to switch it back on.

![A flow on the canvas: a trigger, then a dimmed step with a dashed outline and a struck-through title, 1. Read the attachment, with a small stop badge on its corner, then an active step, 2. File it away.](https://docs.go-lumen.ai/img/build/steps-04-disabled-node.png)

*A disabled step is dimmed, struck through and badged.*

**YAML:**

```yaml
nodes:
  - id: rename
    stepRef: {name: rename-file}
    disabled: true
    next: [keep]
```

A disabled step does not need its settings complete, and a flow that refers to its outputs gets a warning, not an error, because those fields will be missing at run time. The same switch works on the other kinds of node:

| Disabled node | What the run does |
| --- | --- |
| Step, wait, approval | Goes straight on to the next node. A wait does not wait. |
| Filter | Lets everything through. |
| Branch | Takes the first path. The others are cut. |
| For each | Skips the loop body and goes to the end node. |

## Save a configured step and reuse it

A saved step is a step configured once and used in many flows, such as "Send the invoice to accounting". It is a **Step** resource built on one catalog step. It fixes some settings (`with`, locked) and leaves others for each flow to fill in (`open`).

```yaml title="invoice-mail.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Step
metadata:
  name: invoice-mail
  namespace: tenant-acme
spec:
  displayName: Mail the invoice
  description: Sends the invoice to accounting.
  from: {clusterStep: send-email}
  with:
    subject: Invoice
    attach: true
  open: [to]
```

A flow uses it by pinning a revision. Every change to the Step is a new numbered revision, and a flow keeps running on the revision it names until you save the flow with a newer one.

```yaml title="A node in a flow"
- id: mail
  stepRef: {kind: Step, name: invoice-mail, revision: 2}
  config: {to: "{details.email}"}
```

The rules:

-   `revision` is required for `kind: Step` and not allowed for a catalog step.
-   A node's `config` may set only the fields the Step leaves in `open`. Anything else is refused.
-   `from` cannot change. A different kind of step is a new Step.
-   Billing, side effects and outputs are those of the catalog step underneath.
-   Deleting a Step is refused while a flow pins any of its revisions.

In the console, the steps you save are agents: build one in an agent step and choose **Save as agent**. It then appears under **Your agents** in the picker, and a flow that uses an older revision says a newer one exists. Saved steps built on other catalog steps are created with `lumen apply -f`, or through the API, and flows reference them as above.

## Next steps

[TriggersChoose what starts the flow, and when it should not.](https://docs.go-lumen.ai/build/triggers.md)[Branches and filtersSend documents down different paths, or stop them.](https://docs.go-lumen.ai/build/branches-and-filters.md)[When a run failsWhat happens when a step cannot finish, and how to retry it.](https://docs.go-lumen.ai/build/when-a-run-fails.md)[Send it to me by emailAn example of a step's reference page: every setting, input and output.](https://docs.go-lumen.ai/reference/steps/send-email.md)
