> ## 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.

# Workflows Overview

> Visual, graph-based automations for precise control

Workflows are visual automations that define exactly how Duckie handles specific scenarios with deterministic, step-by-step execution.

{/* Screenshot: Workflows page showing workflow cards with names and status */}

## What is a Workflow?

A workflow is a visual graph of connected nodes that define a precise execution path. Each node performs an action or makes a decision, and edges connect nodes to define the flow.

{/* Screenshot: Workflow builder showing a simple workflow with action and decision nodes */}

Unlike runbooks (which give agents flexibility), workflows follow explicit branches and conditions every time.

## When to Use Workflows

Workflows are ideal when:

| Situation              | Why Workflows Work                           |
| ---------------------- | -------------------------------------------- |
| Exact steps required   | Every execution follows the same path        |
| Compliance/audit needs | Deterministic execution is traceable         |
| Complex branching      | Multiple decision points with clear outcomes |
| Tool orchestration     | Multiple tools must coordinate precisely     |

## Workflow Components

### Nodes

Nodes are the building blocks of workflows:

| Node Type    | Purpose                                                                             | Example                                   |
| ------------ | ----------------------------------------------------------------------------------- | ----------------------------------------- |
| **Start**    | Entry point for the workflow                                                        | "Begin when the deployment trigger fires" |
| **Tool**     | Execute a Duckie tool, app tool, custom tool, MCP tool, agent, runbook, or workflow | "Search company docs"                     |
| **Decision** | Route to different branches using rule or AI conditions                             | "Is the order eligible?"                  |
| **End**      | Mark a workflow path complete                                                       | "Refund handled"                          |

### Edges

Edges connect nodes and define the flow:

* **Success path** — Where to go when the node succeeds
* **Failure path** — Where to go when the node fails
* **Branch paths** — Decision outputs evaluated in order, with an else path when nothing matches

### Inputs and Outputs

Each node can:

* **Accept inputs** — Manual values, ticket data, saved values, previous node outputs, or AI-generated values
* **Produce outputs** — Data passed to subsequent nodes

Tool nodes can also call another agent as a [sub-agent](/agents/sub-agents). Use this when a workflow needs a specialized agent to complete one part of the process.

## Example Workflow

**Refund Request Workflow:**

**What this does:**

1. Extracts the order number from the customer's message
2. Looks up the order in your system
3. Checks if it's within the return window
4. Either processes the refund OR explains the policy
5. Sends the appropriate response

## Workflows vs Runbooks

| Aspect         | Workflows                            | Runbooks                     |
| -------------- | ------------------------------------ | ---------------------------- |
| **Format**     | Visual graph                         | Natural language             |
| **Execution**  | Deterministic — same path every time | Flexible — AI adapts         |
| **Best for**   | Strict processes, compliance         | Judgment-based conversations |
| **Complexity** | Visual but more setup                | Easy to write                |
| **Debugging**  | See exact path taken                 | See AI reasoning             |

### Choose Workflows When

* Process must be identical every time
* Audit trails require deterministic paths
* Multiple tools must execute in exact order
* Branching logic is complex but well-defined

### Choose Runbooks When

* Conversations vary significantly
* AI judgment improves outcomes
* Quick iteration is important
* Instructions are easier than flowcharts

## Workflow Versions

Workflow edits are saved as versions:

| Version type  | Meaning                                        |
| ------------- | ---------------------------------------------- |
| **Draft**     | Saved changes that are not live for agents yet |
| **Published** | The version available for agents to use        |

## Next Steps

<CardGroup cols={2}>
  <Card title="Create a Workflow" icon="plus" href="/workflows/creating-workflows">
    Build your first workflow
  </Card>

  <Card title="Nodes & Conditions" icon="code-branch" href="/workflows/nodes-and-conditions">
    Reference for all node types
  </Card>

  <Card title="Sub-Agents" icon="diagram-project" href="/agents/sub-agents">
    Call agents from workflows
  </Card>

  <Card title="Compare to Runbooks" icon="book-open" href="/runbooks/overview">
    Understand when to use each
  </Card>
</CardGroup>
