# Build a workflow

> Build a workflow in chat, save and activate it, run it, and read its run history in TulipFarm.

Source: https://docs.tulipfarm.ai/guides/build-a-workflow/

A [workflow](https://docs.tulipfarm.ai/concepts/agents-skills-and-workflows/) is a reusable automation. Each time a workflow runs, TulipFarm records a run. You create and edit workflows in chat.

## Build the workflow in chat

1. Select **Workflows** in the sidebar.

2. Select **New workflow**.

   A new chat opens.

3. Describe what starts the workflow, the steps it takes, and the agents it uses.

4. Select **View workflow draft**.

5. Check the trigger, the people or agents that act, and each step.

6. Select **Save workflow**.

A saved workflow is not active. It does not run until you activate it. See [Saved, activated, and running](https://docs.tulipfarm.ai/concepts/saved-activated-running/).

### How a workflow can start

The run history shows how each run started:

- **Started manually**
- **Started by schedule**
- **Started by webhook**
- **Started by event**
- **Started by row change**
- **Started by record date**
- **Started by connected app**

To start a workflow from another app, see [Start workflows from other apps](https://docs.tulipfarm.ai/guides/start-workflows-from-other-apps/).

### Use the output of an earlier step

A step can use a fixed value, the workflow input, or the output of an earlier step. To read one field, separate the nested names with `/`, for example `contract / start_date`. If a condition skips a step, that step leaves no output.

## Activate the workflow

1. Select **Workflows** in the sidebar.

2. Select the workflow.

3. Select **Definition and activation**.

4. Select **Activate saved revision**.

When you save new changes later, they show as **Saved changes not active**. Activate the saved revision again to use them.

## Run the workflow by hand

1. Select **Workflows** in the sidebar.

2. Select the workflow.

3. Under **Run manually**, enter the input with **Use plain text**.

   To enter structured data, select **Advanced JSON input**. JSON is JavaScript Object Notation.

4. Select **Run workflow**.

If you see "Ask a manager for run permission to start runs or respond to steps.", ask a workflow manager for access.

## Read the runs

1. Select **Workflows** in the sidebar.

2. Select **Runs**.

3. Open a run in **Run history**.

4. Select **View run diagram** to see each step of the run.

Each run shows a status, such as **Queued**, **Waiting**, **Completed**, **Failed**, or **Cancelled**. To stop an unfinished run, select **Cancel run**. Runs continue after you leave the page.

The run history shows your own manual runs. It also shows unattended runs that someone shared with you.

### Respond to a waiting step

Some steps ask a person to decide. When a run waits for you, open the run and select one of these:

- **Approve request**
- **Decline request**
- **Submit response**

## Disable or archive a workflow

To stop new runs, select **Disable workflow**.

> **Caution:** You cannot undo an archive. Archiving stops the schedules, webhooks, and app triggers of the workflow. It also stops unfinished runs. TulipFarm keeps the run history.

To archive a workflow, select **Archive workflow**.

## Next steps

- [Start workflows from other apps](https://docs.tulipfarm.ai/guides/start-workflows-from-other-apps/)
- [Build an agent](https://docs.tulipfarm.ai/guides/build-an-agent/)
- [Unconfirmed changes](https://docs.tulipfarm.ai/troubleshooting/unconfirmed-changes/)
