---
title: Build a flow
url: https://docs.triply.cc/how-to/build-a-flow/
description: 'Create and edit a flow: add and connect tasks, choose what they read and write, branch on
  a condition, use a saved query, go back to an earlier version, and copy, rename or share a flow.'
availability:
- 'Private preview: This feature is switched on per instance, by arrangement. Get in touch if you would
  like access.'
---

# Build a flow

This page covers the tasks of building and editing a flow. Flows are built in the console only:
the HTTP API can run a flow, but not create or change one. For a first flow from start to finish,
follow [Build your first flow](https://docs.triply.cc/tutorials/build-your-first-flow/); for what each task does, see
[Flow tasks](https://docs.triply.cc/reference/flow-tasks/).

## Create a flow

On the account or group page that should own the flow, click **New** → **Flow**. Choose the
**Owner**, enter a **Flow name** and click **Create flow**. The flow builder opens.

Creating a flow in a group takes the **Create flows** permission there.

## Add a task

Drag the task type from the **Tasks** tab of the **Flow elements** panel onto the canvas. The
search box at the top of the panel filters the list.

To configure the task, click its title on the card; its settings open on the right. To remove it,
click **Delete** at the bottom of its settings.

## Choose what a task reads and writes

A task's inputs and output are set on its card, not in its settings.

1. Click **Select an input...** or **Select an output...** on the card.
2. Choose the **Type**: the kinds offered are the ones that task accepts.
3. Fill in **Account** and the name fields — or click an item under **Reuse a selector** to use one
   that another task in the flow already names.
4. For a dataset or graph that does not exist yet, type its name and pick **Add "…"** from the
   list; the card marks it **NEW** until a run creates it.
5. Click **Save**.

To take the value from a [variable](https://docs.triply.cc/how-to/use-variables-in-a-flow/) instead, click **$** beside the
field.

## Set the order

Drag from the circle on the right edge of one card to the circle on the left edge of another. The
second task then waits for the first to finish.

- To run tasks in parallel, leave them unconnected, or connect one task to several.
- To make a task wait for several others, connect all of them to it.
- To remove a connection, click it and press **Delete**.

If the builder reports that the order of two tasks *could influence the output*, they both touch
the same dataset and nothing orders them; connect them in the order you mean.
[Why](https://docs.triply.cc/concepts/flows/#edges-set-the-order).

## Branch on a condition

1. Add a **Decision** task and connect the task before it.
2. In its settings, add the **Conditions**: each compares two values with `=` or `!=`, usually a
   variable — one the flow defines, or one a
   [Set variables](https://docs.triply.cc/reference/flow-tasks/#set-variables) task set — against a fixed value.
3. On the card, each condition has its own circle on the right edge, and so does the **else**
   branch. Drag from each to the first task of that branch.
4. Where the branches meet again, add an **Or** task. Connect the last task of each branch to it;
   connecting to its free circle starts a new group. The **Or** task continues once every task in
   any one group has finished.

A **Stop run** task at the end of a branch ends the run there, as aborted or failed.

## Use a saved query

In a **Construct query**, **Select query** or [SPARQL update](https://docs.triply.cc/reference/flow-tasks/#sparql-update)
task, set **Query location** to **saved query** and pick the query under **Saved Query**. If the
query has [API variables](https://docs.triply.cc/reference/saved-queries/), give each a value under
**Query variables**: fixed, or a flow variable.

Without a version, the task runs the query's latest version, so saving a new version of the query
changes what the flow does.

## Save, and see what stops a run

Click **Save** at the top of the builder. A flow can be saved while it is unfinished.

The icon in the canvas's bottom-right corner shows a green check when the flow can run, or the
number of problems that prevent it. Click it for the list.

## Go back to an earlier version

Every save is kept.

1. Open **⋮** → **Version history**.
2. Pick the revision and click **Load revision**. It opens in the builder.
3. Click **Save** to make it the current version, or leave the page without saving to discard it.

## Copy and paste tasks

Tasks copy through the clipboard, so they can go to another place in the same flow, to another
flow, or to a flow on another TriplyDB instance.

1. Select the tasks: click one, **Shift**-drag a box around several, or press **Ctrl**/**⌘**+**A**
   for all of them.
2. Press **Ctrl**/**⌘**+**C**. The connections between the selected tasks are copied with them.
3. Open the flow to paste into — in another tab or on another instance, if you like — and press
   **Ctrl**/**⌘**+**V**. The tasks are pasted where the pointer is.
4. Save the flow.

Pasted tasks keep their settings exactly, including the accounts, datasets and saved queries they
name. On another instance those may not exist, so check each task's inputs and outputs. Variables
the tasks use are not copied: the builder names any that the flow is missing, to add on the
**Variables** tab. Masked values are never copied; add them on the **Masked values** page.

To copy a whole flow to another instance, create an empty flow there, then select all, copy and
paste.

## Copy, rename, share or delete a flow

All four are in the builder's **⋮** menu.

- **Copy** makes a copy under another account or group on the same instance; choose it under
  **To**. To copy to another instance, use [copy and paste](#copy-and-paste-tasks). The copy has the
  same tasks and variables, and masked values with the same names but no values: fill them in on
  its **Masked values** page. Runs, presets and schedules are not copied. The copy's tasks still
  read and write the same datasets as the original, so change their inputs and outputs if the copy
  should work on data of its own.
- **Rename** changes the flow's name.
- **Access control** makes the flow **Private** or **Internal**. See
  [Access levels](https://docs.triply.cc/reference/flows/#access-levels).
- **Delete** removes the flow, with its runs and versions.
