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

# Running Workflows

> Monitor workflow execution, debug issues, and manage workflow runs

## Workflow Execution

When a CRM event matches your workflow's trigger conditions, Thread automatically creates a **run** - an instance of the workflow executing for a specific account.

***

## How Workflows Execute

### Automatic Triggers

Active workflows respond to CRM events in real-time:

1. **CRM event occurs** (deal reaches stage, status changes, etc.)
2. **Thread receives webhook** from the CRM
3. **Workflow starts** - creates run, extracts account data
4. **Nodes execute sequentially** until complete or paused

<Info>
  Workflows process CRM events within seconds. If you update a deal in HubSpot and the workflow is active, you'll see a new run almost immediately.
</Info>

### Manual Triggers (Testing)

You can also manually trigger workflow runs for testing:

1. Open the workflow editor
2. Click **"Test"** in the toolbar
3. Select or create test data
4. Click **"Run Test"**

***

## Run States

| State         | Icon | Meaning                          |
| ------------- | ---- | -------------------------------- |
| **Running**   | 🔵   | Workflow is actively executing   |
| **Paused**    | ⏸️   | Waiting at a human task node     |
| **Completed** | ✅    | Successfully reached an End node |
| **Failed**    | ❌    | Error occurred during execution  |
| **Cancelled** | 🚫   | Manually cancelled by admin      |

### State Transitions

```
Running → Paused (at human task)
Running → Completed (reached End node)
Running → Failed (error)
Paused → Running (human task completed)
Any state → Cancelled (manual)
```

***

## Viewing Runs

### From Workflows Page

The **Runs** tab on the Workflows page shows all recent runs across all workflows:

**Columns:**

* **Account** - Company the run is for
* **Workflow** - Which workflow ran
* **Status** - Current state
* **Started** - When the run began
* **Duration** - Total time (or time so far)
* **Current Node** - Where the run is (if not completed)

### Run Detail View

Click any run to see detailed execution information:

**What you'll see:**

* Visual path through the workflow
* Status of each node (completed, skipped, current)
* Data at each step
* Time spent at each node
* Error details (if failed)

***

## Debugging Failed Runs

When a run fails, you'll see:

1. **Red failed status** on the run
2. **Error indicator** on the failing node
3. **Error details** in the run detail view

### Common Failure Causes

<AccordionGroup>
  <Accordion title="Missing Required Data">
    **Symptom:** Node fails with "required field missing" error

    **Cause:** CRM record doesn't have expected data

    **Fix:**

    * Add condition node to check for required data
    * Update CRM record and retry
    * Make the field optional in node config
  </Accordion>

  <Accordion title="Integration Disconnected">
    **Symptom:** Node fails with "authentication error"

    **Cause:** CRM integration token expired or revoked

    **Fix:**

    * Go to **Connectors** and reconnect the integration
    * Retry the run
  </Accordion>

  <Accordion title="Invalid Variable Reference">
    **Symptom:** Node fails with "variable not found" error

    **Cause:** Node references variable that wasn't set

    **Fix:**

    * Check upstream nodes are configured correctly
    * Ensure conditional paths set required variables
    * Add default values where appropriate
  </Accordion>

  <Accordion title="Email Send Failed">
    **Symptom:** Send Email node fails

    **Cause:** Invalid email address, rate limits, or email service issue

    **Fix:**

    * Verify recipient email addresses
    * Check email service status
    * Retry after brief delay
  </Accordion>
</AccordionGroup>

### Retrying Failed Runs

<Steps>
  <Step title="Open Run Detail">
    Click on the failed run to view details.
  </Step>

  <Step title="Identify Issue">
    Check the error message and failing node.
  </Step>

  <Step title="Fix Root Cause">
    Address the underlying issue (reconnect integration, update data, etc.).
  </Step>

  <Step title="Retry">
    Click **"Retry"** to re-execute from the failing node.

    <Warning>
      Retry re-runs from the failed node, not from the beginning. Previously completed nodes are not re-executed.
    </Warning>
  </Step>
</Steps>

***

## Managing Paused Runs

Runs pause when they reach human task nodes (CSM Assignment, Approval, Triage, Handoff Form).

### Finding Paused Runs

**From Runs tab:**
Filter by status = "Paused" to see all runs waiting for human action.

**From Queue Dashboard:**
Human tasks appear in the Queue Dashboard for team members to process.

### Completing Human Tasks

When you complete a human task in the Queue Dashboard:

1. Task is marked complete
2. Run automatically resumes
3. Execution continues to next node
4. Run completes or pauses at next human task

<Card title="Queue Dashboard Guide" icon="inbox" href="/csm-guide/workflows/queues">
  Learn how to process queue items
</Card>

***

## Cancelling Runs

To stop a run that's in progress or paused:

<Steps>
  <Step title="Open Run Detail">
    Navigate to the specific run.
  </Step>

  <Step title="Click Cancel">
    Click the **"Cancel Run"** button.
  </Step>

  <Step title="Confirm">
    Confirm that you want to cancel. This action cannot be undone.
  </Step>
</Steps>

<Warning>
  Cancelling a run stops execution immediately. Any pending human tasks are removed from queues. The account remains in whatever state it was in.
</Warning>

### When to Cancel

* Test run you no longer need
* Duplicate run created by mistake
* Run stuck due to unfixable issue
* Account was created in error

***

## Run History & Reporting

### Viewing History

All runs are retained for auditing and analysis:

* **Filter by workflow** - See runs for a specific workflow
* **Filter by status** - Find completed, failed, or paused runs
* **Filter by date** - Search within time ranges
* **Filter by account** - See all workflow runs for an account

### Key Metrics

Monitor these metrics to assess workflow health:

| Metric               | What It Shows                     |
| -------------------- | --------------------------------- |
| **Completion rate**  | % of runs that reach End node     |
| **Average duration** | Time from start to completion     |
| **Pause time**       | Time spent waiting at human tasks |
| **Failure rate**     | % of runs that fail               |

<Info>
  Detailed analytics dashboard coming soon! Currently, you can export run data for analysis.
</Info>

***

## Real-Time Monitoring

### Watching Active Runs

In the run detail view, you can watch execution in real-time:

* Nodes highlight as they execute
* Data updates appear immediately
* Human task status shows when someone claims it

### Notifications

Thread can notify you about workflow events:

* **Failures** - Alert when a run fails
* **Long pauses** - Alert when human tasks aren't completed
* **Completions** - Optional notification on success

<Info>
  Notification preferences are configured in **Settings** → **Notifications**.
</Info>

***

## Best Practices

<CardGroup cols={2}>
  <Card title="Monitor Regularly" icon="eye">
    Check runs daily to catch issues early
  </Card>

  <Card title="Set Up Alerts" icon="bell">
    Get notified about failures immediately
  </Card>

  <Card title="Track Metrics" icon="chart-line">
    Watch completion rates and duration trends
  </Card>

  <Card title="Review Failures" icon="search">
    Investigate every failure to prevent recurrence
  </Card>
</CardGroup>

### Healthy Workflow Indicators

* ✅ 95%+ completion rate
* ✅ Human tasks completed within hours
* ✅ No recurring failure patterns
* ✅ Average duration within expectations

### Warning Signs

* ⚠️ Rising failure rate
* ⚠️ Human tasks sitting for days
* ⚠️ Same error appearing repeatedly
* ⚠️ Runs taking much longer than expected

***

## What's Next?

<CardGroup cols={2}>
  <Card title="Queue Dashboard" icon="inbox" href="/csm-guide/workflows/queues">
    Learn to process human tasks efficiently
  </Card>

  <Card title="Building Workflows" icon="hammer" href="/csm-guide/workflows/building-workflows">
    Improve your workflow designs
  </Card>
</CardGroup>
