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

# Workflow Builder

> Build automations with the visual node-based workflow canvas in Tedro.

# Workflow Builder

The workflow builder is a visual canvas where you create automations by connecting nodes. Each workflow starts with a trigger (like an inbound message), flows through logic and AI nodes, and ends with actions (sending messages, handing off to agents, or setting data). The builder uses a drag-and-drop interface -- no code required.

## Prerequisites

* A Tedro workspace with **Admin** role
* At least one connected channel (for testing workflows)

## Canvas Layout

The workflow builder has four main areas:

| Area             | Position             | Purpose                                                   |
| ---------------- | -------------------- | --------------------------------------------------------- |
| **Node palette** | Left sidebar (280px) | Drag nodes from here onto the canvas                      |
| **Canvas**       | Center               | The main workspace where you build your flow              |
| **Inspector**    | Right panel (360px)  | Configure the selected node's settings                    |
| **Top bar**      | Top (56px)           | Workflow name, save status, preview, and publish controls |

## Building a Workflow

<Steps>
  ### Create a Workflow

  Navigate to **Workflows** in the sidebar and click **Create Workflow**. Enter a name and click **Create**. The builder opens with an empty canvas.

  ### Add a Trigger Node

  Every workflow starts with a trigger. Drag a trigger node from the **Triggers** section in the node palette onto the canvas. The most common trigger is **Inbound Message** -- it fires when a customer sends a message on any channel. For channel-specific workflows, use **WhatsApp Message**, **Instagram Message**, **Messenger Message**, or **Live Chat Message**.

  <Note>
    Every workflow must have exactly one trigger node. The builder enforces this -- you cannot publish a workflow without a trigger.
  </Note>

  ### Add Processing Nodes

  Drag additional nodes onto the canvas to build your automation logic:

  * **AI Agent** -- Let an AI handle the conversation with tools and knowledge
  * **Condition** (logic.switch) -- Branch the flow based on message content, contact data, or other criteria
  * **Set Field** -- Save data to the contact or conversation record
  * **Rate Limit** -- Throttle execution to control costs and prevent spam

  ### Connect Nodes

  Click and drag from a node's **output handle** (right side) to another node's **input handle** (left side) to create a connection. The flow follows these connections at runtime.

  Condition nodes have multiple output handles -- one per branch plus a default. Connect each branch to the appropriate next step.

  ### Add Action Nodes

  At the end of your flow, add action nodes to communicate with the customer:

  * **Send Message** (channel-specific: WhatsApp, Instagram, Messenger, or Live Chat) -- Reply to the customer
  * **Send Template** (WhatsApp only) -- Send a pre-approved template
  * **Handoff to Human** (channel-specific) -- Escalate to a human agent in the inbox

  ### Configure Each Node

  Click any node on the canvas to open the **Inspector** panel on the right. Each node type has its own configuration options (system prompt, conditions, message text, etc.). See the [Node Reference](/nodes/trigger-nodes) for details on each node type's settings.

  ### Add an End Node

  Use the **End** node (logic.end) to explicitly terminate execution paths. While not strictly required (workflows stop when there are no more connected nodes), End nodes make your flow easier to read and debug.
</Steps>

## Draft vs Published

Workflows have two states:

| State         | Description                                                                                                                     |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **Draft**     | Your working copy. Edit freely -- changes are saved automatically. Drafts are not active and do not process real messages.      |
| **Published** | An immutable snapshot of the draft at the time of publishing. This is the version that runs in production when messages arrive. |

<Warning>
  Publishing creates a new version of the workflow. The previous published version is replaced. Make sure to test your draft before publishing.
</Warning>

### Publishing a Workflow

Click **Publish** in the top bar. The builder runs validation checks before publishing (see below). If validation passes, the current draft becomes the active published version.

## Validation Rules

The builder validates your workflow before allowing publication. All of the following must be true:

| Rule                    | Description                                                                                                       |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------- |
| **Single trigger**      | Exactly one trigger node must exist                                                                               |
| **No orphan nodes**     | Every node must be reachable from the trigger via connections                                                     |
| **Handoff path exists** | At least one `handoff` node must be reachable from the trigger (ensures customers can always reach a human)       |
| **Required fields set** | Node-specific required configuration fields must be filled (e.g., AI Agent needs a system prompt or linked agent) |

If validation fails, the builder highlights the problematic nodes with error indicators and displays a message explaining what needs to be fixed.

## Preview and Testing

Use the **Preview** button in the top bar to test your draft without publishing. The preview runs the workflow with simulated data so you can verify the logic before going live. You can also use the `trigger.manual_test` node during development for quick iteration.

## What's Next

<CardGroup cols={2}>
  <Card title="Trigger Nodes" icon="play" href="/nodes/trigger-nodes">
    Learn about the different trigger types that start your workflows.
  </Card>

  <Card title="AI Agents" icon="robot" href="/automation/ai-agents">
    Configure AI agents that handle conversations autonomously within workflows.
  </Card>
</CardGroup>
