---
title: "Build and test a workflow"
description: "Turn a repeatable process into connected steps, validate it, publish it, and inspect a manual run."
---

> Documentation Index
> Fetch the complete documentation index at: https://docs.aiagent.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Build and test a workflow

Use a workflow when work follows a repeatable sequence. Build and test it manually before adding a recurring trigger.

> **Workflows are in beta**
>
> Test important paths with representative input before relying on a workflow
> for recurring work.

**Before you begin**

Define the outcome, identify the agent and connections the process needs, and
decide which external changes require human approval.

## Build the workflow

1. **Create a workflow**

   1. In **Workflows**, click **New**.

   ![The New button at the top of the Workflows page.](/screenshots/guides/autopilot-new-button.webp)

   2. Click **Workflow**.

   ![The New automation dialog with the Workflow option.](/screenshots/guides/workflow-choose-type.webp)

   3. In **Create workflow**, click **Blank workflow**, or click a template.

   ![The Create workflow dialog with the Blank workflow option and the templates.](/screenshots/guides/workflow-create-view.webp)

   The builder opens. A blank workflow is named **Untitled workflow**: click the title to rename it, and give it a name that describes the outcome rather than the implementation. The header holds the **Build**, **Test**, and **Run** tabs. A template starts with its blocks already placed. The **Templates** tab on the **Workflows** page lists the same starting points.
2. **Add the steps**

   The **Blocks** panel on the left groups the blocks by category:

   - **AI**: Agent, Generate, Extract.
   - **Actions**: Tool, HTTP Request, Send, Set ticket status, Respond to webhook.
   - **Data**: Template, Format, Only once.
   - **Logic**: If / else, Continue only if, Stop run.
   - **Wait**: Approval, Wait for event.
   - **Advanced data**, **Advanced logic**, **Structure**, and **Timing**: List Operator, Code, Choose path, Classify, Run together, Wait for paths, Repeat, Call workflow, Wait, and Wait until.

   **Code** is a Labs feature that is off by default. To add it, turn on **Show Labs features** and then **Code block** in **Settings → Labs**. **Set ticket status** changes the status of an AI Agent ticket.

   1. In **Blocks**, click a block to add it to the canvas, or drag it there.

   ![The Blocks panel of the workflow builder with the Agent block.](/screenshots/guides/workflow-blocks.webp)

   2. Connect the blocks in execution order.
   3. In a block's text field, click **Insert data** to pass an earlier block's output into a later block. Do not copy values by hand.

   ![The Insert data button above a block's prompt field in the builder.](/screenshots/guides/workflow-insert-data.webp)
3. **Draft the blocks with AI (optional)**

   If the canvas has no blocks, the right panel can draft the workflow for you.

   1. In **Describe your workflow**, describe the process in a few sentences.
   2. Click **Generate**.

   ![The Describe your workflow box on an empty canvas, with a description entered and the Generate button.](/screenshots/guides/workflow-describe-box.webp)

   **Generate** uses credits. The draft can use these blocks: Agent, Generate, Extract, Tool, Send, Approval, **If / else**, **Choose path**, **Continue only if**, **Stop run**, **Format**, **Only once**, and **Repeat**. Add any other block yourself. The builder gives every generated Agent block the same default agent, so choose the right agent for each one. Review the draft and click **Save** before you rely on it.
4. **Configure boundaries**

   For every agent or tool block, verify:

   - which agent owns the step;
   - which connection account it can use;
   - the expected input and output;
   - what should happen when a condition is not met;
   - whether an external change needs an approval point.

   Keep supported external write and destructive actions behind an **Approval** block so a person can confirm the proposed change before it proceeds.

   > **Keep external changes reviewable**
   >
   > Place supported write and destructive actions behind an approval point.
   > Approval lets a person confirm the exact account and proposed change before
   > execution.

   A **Tool** step for a connected app shows **Account** when the app has two or more active accounts, or when the step already uses a pinned account. Keep **Choose automatically**, or pick one account so the step always uses it. If a pinned account is disconnected, publishing and **Run now** stop with an error before the run starts, and the picker shows **Account no longer available**. Pick another account to fix it.

   A **Tool** step that writes to a connected app does not create an approval card each time it runs. When you set the trigger live, **Allow these writes?** lists those writes once. Click **Allow and set live** to accept them. A step that cannot go live opens **This workflow can't go live** instead, with one of these reasons: **Destructive write**, **Manual-only action**, **Unsupported backend**, or **No connection bound**. Fix the step, then set the trigger live again.
5. **Validate and publish the workflow**

   The builder saves a draft a few seconds after each edit, even while the draft still has issues. A visually connected workflow can still be incomplete if a required setting is missing. Before a workflow can run or go live, publish the draft.

   1. Click **Save**. The message says how many issues to fix before you can publish.
   2. Fix each issue the builder lists.
   3. In the **Unpublished draft** bar, click **Review changes**.

   ![The Unpublished draft bar in the builder header with the Review changes button.](/screenshots/guides/workflow-review-changes.webp)

   4. In **Review draft changes**, check the differences, then click **Publish, keep paused**.

   ![The Review draft changes dialog with the Publish, keep paused button.](/screenshots/guides/workflow-publish.webp)

   Publishing updates future runs and leaves the workflow paused. Until you publish, the workflow keeps using its published version. To drop your edits, click **Discard draft**. If the workflow is live, pause its trigger before you publish.
6. **Test on demand**

   1. Select a block, then click **Test step** above it.

   ![A selected Agent block with the Test step button above it.](/screenshots/guides/workflow-test-step.webp)

   The **Test** tab opens with **Test input (JSON)**. Enter sample input, then click **Test step** in the panel. A step test does not create run history.

   2. To run the whole workflow, click the **Run** tab.
   3. Click **Run**.

   ![The Build, Test and Run tabs of the builder, with the Run tab selected and the Run button at the top right.](/screenshots/guides/workflow-run-tab.webp)

   If **Start** has input fields, or a trigger sample exists, **Start workflow run** opens. Enter the values and click **Start run**, or click **Run with sample**. Otherwise the run starts at once. Open the run and inspect:

   - step order and status;
   - the output of each step;
   - the path selected by each condition;
   - any waiting approval or failure;
   - the final result.

   If the run fails, correct the workflow, publish the draft, and start a new test. The previous run remains available in the run history for comparison.

   **Test step** works on Agent, Tool, Approval, and Repeat blocks, and on Template, Format, List Operator, Code, and Only once blocks. Testing a Template, Format, List Operator, Code, or Only once block uses no credits. To skip a block in a run without deleting it, right-click it and choose **Disable**. A disabled block passes its input to the next block, so check that later blocks do not need its output. **Disable** is not offered on blocks that branch or end a run (**If / else**, **Choose path**, **Classify**, **Stop run**, **Respond to webhook**), or on **Repeat**, **Run together**, **Wait for paths**, and **Wait for event**.
7. **Prepare it for reuse**

   After a representative run succeeds, keep it as an on-demand workflow, or give it a trigger. Click the **Start** block, then click the trigger button in **Trigger**. It reads **Manual trigger** until you change it. In **Trigger**, choose **Run manually**, **On a schedule**, **When an app event happens**, or **When a webhook arrives**. **Show advanced triggers** adds more. Click **Save trigger draft**, publish the draft again, then click the **Trigger paused** switch. It changes to **Trigger live**.

   To run a task on a schedule with one agent, configure an Autopilot instead. Your plan sets how many scheduled jobs you can run and how often. Event and webhook triggers need the Pro plan or higher. See [Plans, credits, and usage](/billing/plans-credits-and-usage).

## Expected result

**A workflow is ready for reuse when**

It validates, is published, and completes a manual run with the expected
inputs, outputs, branches, and approval behavior.

## Continue from here

- [Configure an Autopilot](/guides/configure-an-autopilot)
- [Inspect runs](/core-concepts/runs)
- [Understand approvals](/core-concepts/approvals)
- [Workflows and Autopilots](/core-concepts/workflows-and-autopilots)

Source: https://docs.aiagent.app/guides/build-and-test-a-workflow/index.mdx
