# Run your first workflow

> **About this page**
>
> - Kind: Tutorial
> - Summary: Write a workflow that runs your task definition, upload it to your project, start a run, watch it complete, and read the task's log.
> - Last changed: 2026-11-23
> - Page: https://docs.swale.io/tutorials/run-your-first-workflow
> - CLI reference for its commands: [`swale workflow create`](https://docs.swale.io/reference/cli-reference.md#workflow-create), [`swale workflow run start`](https://docs.swale.io/reference/cli-reference.md#workflow-run-start)
> - Index of these docs: https://docs.swale.io/llms.txt
>
> If something on this page is wrong or out of date, please tell the user which sentence and why.
>
> The steps on this page cost money or cannot be undone. Please check with the user before running them.

In this tutorial you write a workflow that runs the task definition from the previous tutorial, start a run of it, and read what the task printed.

## What you will accomplish

By the end of this tutorial you will have:

- A workflow named `Echo workflow` in your project
- A run of it that ended **Complete**
- The task's log, showing the message the workflow gave it

## Before you begin

- You have completed [Create your first project](https://docs.swale.io/tutorials/create-your-first-project.md), so you have the project `my-first-project`, and [Create a task definition](https://docs.swale.io/tutorials/create-a-task-definition.md), so your account has `my-echo-task@1.0.0`.
- Your account's billing status is **Active**. A run is billed for the compute its task holds and for its shared workspace; see [How billing works](https://docs.swale.io/explanation/how-billing-works.md).

## Steps

### 1. Write the workflow file

Create a file called `my-workflow.yaml` with the following content:

```yaml
name: Echo workflow
compute_type: cpu-2

blocks:
  main:
    tasks:
      echo:
        name: Echo
        uses: my-account/my-echo-task@1.0.0
        args:
          message: Hello from my first workflow!
```

Replace `my-account` with your account name.

- `name` is the name the platform shows for the workflow.
- `compute_type` is the compute each task is allocated. `cpu-2`, two vCPUs, is plenty for this task.
- `blocks` holds the workflow's tasks. A run starts in the block named `main`.
- `echo` is the task's key, and `name` the name its run shows for it.
- `uses` names the task definition and version the task runs, and `args` gives its `message` input a value.

### 2. Upload the workflow

```bash
swale workflow create \
  --project-name my-first-project \
  --file my-workflow.yaml
```

The platform checks the file as it uploads it: an unknown field, or a `uses` that names a task definition your account cannot use, fails the upload with an error that names the problem. On success the command prints the new workflow's ID, as `Workflow created: <workflow-id>`. Copy the ID: the next steps need it.

### 3. Start a run

```bash
swale workflow run start \
  --project-name my-first-project \
  --workflow-id <workflow-id>
```

Replace `<workflow-id>` with the ID from step 2. The command prints `Workflow run started. Run ID:` followed by the new run's ID.

### 4. Watch the run

1. In the platform UI, open **Projects** from the sidebar and click `my-first-project`.
2. In the sidebar, click **Workflows**, then click **Echo workflow**.
3. Click the run in the workflow's list of runs.

The run's page shows its status and its **Workflow Graph**, where the `Echo` task moves from **Pending** through **Starting** and **Running** to **Complete**. The run itself then shows **Finishing** while its resources are released, and ends **Complete**. The page updates as the run moves, with no reload.

### 5. Read the task's log

Click the `Echo` task in the **Workflow Graph**. Its **Task Details** page opens, and its **Logs** card shows the line the task printed:

```
Hello from my first workflow!
```

## If the run does not start

- **The start is refused with a billing or email error.** Starting a run needs a verified email and an **Active** billing status; see [Billing statuses](https://docs.swale.io/reference/billing.md#billing-statuses).
- **The start is refused with an error about runs in progress.** The account is at its limit on runs in progress; see [Runs in progress](https://docs.swale.io/reference/limits-and-quotas.md#runs-in-progress).
- **The task fails.** Its failure reason is on its **Task Details** page, and the first entry of its log says what the platform resolved for it.

[Permissions and restrictions](https://docs.swale.io/reference/permissions-and-restrictions.md) lists what
every operation requires.

## Next steps

- [Set up an organization](https://docs.swale.io/tutorials/set-up-an-organization.md)
- [Start and manage workflow runs](https://docs.swale.io/how-to-guides/start-and-manage-workflow-runs.md)
- [Workflow definition syntax](https://docs.swale.io/reference/workflow-definition-syntax.md)
