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

# Creating Workflows

> Build visual workflows for your agents

This guide walks you through creating workflows using the visual workflow builder.

## Creating a New Workflow

<Steps>
  <Step title="Navigate to Workflows">
    Go to **Build → Workflows** in your dashboard.

    {/* Screenshot: Workflows page with Create Workflow button */}
  </Step>

  <Step title="Click Create Workflow">
    Click **Create Workflow** to open the builder.
  </Step>

  <Step title="Name Your Workflow">
    Give it a descriptive name:

    * Good: "Refund Request Handler", "Order Status Lookup"
    * Avoid: "Workflow 1", "New Workflow"
  </Step>

  <Step title="Build Your Workflow">
    Use the visual builder to add and connect nodes.

    {/* Screenshot: Workflow builder canvas with node palette and properties panel */}
  </Step>

  <Step title="Save and Publish">
    Save your workflow and publish when ready.
  </Step>
</Steps>

## Using the Workflow Builder

### The Canvas

The main area where you build your workflow:

* **Drag** nodes to position them
* **Click** nodes to select and configure
* **Drag from outputs** to create connections

{/* Screenshot: Workflow builder canvas showing drag-and-drop interaction */}

### Node Palette

The builder starts each workflow with a **Start** node. From there, add:

{/* Screenshot: Node palette showing all available node types */}

* **Tool** — Execute tools, agents, runbooks, or other workflows
* **Decision** — Branch based on conditions

### Properties Panel

Configure the selected node:

{/* Screenshot: Properties panel for a selected node showing configuration options */}

## Adding Nodes

### Tool Nodes

Execute a tool or operation:

<Steps>
  <Step title="Add Tool Node">
    Add a **Tool** node to the canvas.
  </Step>

  <Step title="Select Tool">
    Choose the Duckie tool, app tool, custom tool, MCP tool, agent, runbook, or workflow to execute.
  </Step>

  <Step title="Configure Inputs">
    Map manual values, ticket data, saved values, previous node outputs, or AI-generated values to the tool's inputs.
  </Step>

  <Step title="Name Outputs">
    Define output variable names for use in later nodes.
  </Step>
</Steps>

### Decision Nodes

Branch based on rule or AI conditions:

<Steps>
  <Step title="Add Decision Node">
    Drag a **Decision** node to the canvas.
  </Step>

  <Step title="Define Condition">
    Add a branch and choose a **Rule** condition or an **AI** condition.
  </Step>

  <Step title="Connect Outputs">
    Connect each branch output to the right next node. Use the **Else** output for the fallback path.
  </Step>
</Steps>

### AI Decision Branches

Use an AI branch when a simple field comparison is not enough:

<Steps>
  <Step title="Open a Decision Node">
    Select a **Decision** node.
  </Step>

  <Step title="Add AI Branch">
    Click **AI** to add an AI condition branch.
  </Step>

  <Step title="Write the Prompt">
    Describe what the AI should evaluate (e.g., "Is the customer satisfied with the resolution?").
  </Step>

  <Step title="Choose Inputs">
    Select the message, ticket fields, saved values, or previous node outputs the AI should evaluate.
  </Step>
</Steps>

### Generate Values With AI

When configuring tool inputs, use **Generate with AI** to create a value from context.

For example, a tool input can ask the AI to extract an order number from the latest message or summarize the conversation before calling another tool.

### Send Responses

Use a **Tool** node with the **Responder** tool when a workflow should send a customer-facing response.

<Steps>
  <Step title="Add Tool Node">
    Add a **Tool** node to the canvas.
  </Step>

  <Step title="Select Responder">
    Choose the **Responder** Duckie tool.
  </Step>

  <Step title="Write Response">
    Provide a static response or let AI generate the response from the mapped context.
  </Step>
</Steps>

### Call an Agent

Use a **Tool** node with an Agent action when a workflow should delegate part of the run to another agent.

<Steps>
  <Step title="Add Tool Node">
    Add a **Tool** node to the canvas.
  </Step>

  <Step title="Select Agent">
    Open the tool selector, choose **Agents**, and select an active agent.
  </Step>

  <Step title="Configure Inputs">
    Add **Instructions**, decide whether to include **Conversation history**, and add **Additional context** when the child agent needs extra workflow data.
  </Step>

  <Step title="Use the Output">
    Reference the Agent action output in later nodes when you need the child run status or resolution summary.
  </Step>
</Steps>

[Learn more about sub-agents ->](/agents/sub-agents)

## Connecting Nodes

### Creating Connections

1. Click and drag from a node's output port
2. Drop on another node's input port
3. The connection is created

{/* Screenshot: Dragging to create a connection between nodes */}

### Connection Rules

* Every node (except Start) needs at least one input connection
* Decision nodes have one output for each branch plus **Else**
* Tool nodes have Success and Failure outputs

## Configuring Inputs

### Variable Mapping

Map data between nodes using the properties panel:

{/* Screenshot: Input mapping configuration showing dropdown selections */}

**Available sources:**

| Source               | Description                                   |
| -------------------- | --------------------------------------------- |
| **Manual Value**     | A fixed value you enter                       |
| **Ticket Data**      | Fields from the conversation or source ticket |
| **Previous Node**    | Output from an earlier node                   |
| **Saved Value**      | A value saved earlier in the workflow         |
| **Generate with AI** | A value generated from selected context       |
| **Multiple Items**   | A list of input values                        |

### Workflow Inputs

Use workflow inputs when a workflow should accept values from another workflow, a runbook, or an autonomous agent.

In the builder, open **Workflow Inputs** at the top-left of the canvas. Add each input with a name, type, and whether it is required. Node input pickers then show those values under **Workflow Inputs**, so you can reference them in tool inputs, decision rules, or AI-generated values.

When testing in the builder, the test panel shows fields for the workflow's declared inputs. Required inputs must be provided before the workflow can run. When one workflow calls another workflow, the child workflow's inputs appear as parameters on the workflow action. Autonomous agents can also pass declared inputs when they call an available workflow.

## Testing Workflows

### In the Builder

{/* Screenshot: Workflow builder with test panel showing test inputs and execution trace */}

1. Click **Test** in the builder
2. Enter test inputs
3. Run the workflow
4. See which path was taken and outputs at each step

### In Playground

1. Assign the workflow to an agent
2. Test in **Test → Playground**
3. Conversation-level testing with full context

## Publishing Workflows

Workflows start as drafts. To make available to agents:

1. Click **Publish** in the builder
2. Confirm the publication
3. Workflow is now available for agent assignment

<Info>
  You can continue editing a published workflow. Changes create a new draft that must be published to take effect.
</Info>

## Best Practices

### Design

* **Start simple** — Build the happy path first, then add branches
* **Name clearly** — Use descriptive names for nodes and variables
* **Group logically** — Organize related nodes spatially

### Testing

* **Test each branch** — Ensure all paths work correctly
* **Test edge cases** — What happens with missing data?
* **Test failures** — How does the workflow handle errors?

### Maintenance

* **Document decisions** — Add notes explaining complex logic
* **Version carefully** — Test changes before publishing
* **Monitor execution** — Check run history for issues

## Next Steps

<CardGroup cols={2}>
  <Card title="Nodes & Conditions" icon="code-branch" href="/workflows/nodes-and-conditions">
    Detailed node reference
  </Card>

  <Card title="Test Your Workflow" icon="flask" href="/testing/playground">
    Validate in the playground
  </Card>
</CardGroup>
