# Workbench Pipelines

> Automate multi-step data processing in the staging workbench — chain AI extraction, waterfall enrichment, formulas, and branching into reusable pipelines.

Source: https://docs.graph8.com/data/staging-pipelines/

Workbench Pipelines let you chain enrichment steps into automated workflows that run whenever new data arrives. Instead of manually triggering AI extraction, waterfall enrichment, and formula columns one at a time, define a pipeline once and let it process every incoming row automatically.

Pipelines are configured per workbench table and trigger on specific ingest events — email PDF uploads, webhook payloads, scraper bot results, or manual imports.

## How It Works

1. Open a workbench table and click the **Pipeline** tab
2. Click **New Pipeline** or choose a pre-built template
3. Configure the **start event** — what triggers this pipeline (email PDF, webhook, scraper bot, or import)
4. Add steps to the pipeline — AI extraction, waterfall enrichment, formula evaluation, branching, or export to list
5. Drag steps to reorder them, or add branch conditions to route data through different paths
6. Click **Save** — the pipeline runs automatically whenever matching data arrives

## Pipeline Builder

The visual pipeline builder shows your workflow as a connected chain of steps. Each step card displays its type, name, and a summary of its configuration.

### Start Events

Every pipeline begins with a start event that determines when it triggers:

| Start Type | When It Triggers | Use Case |
|------------|-----------------|----------|
| **Email PDF** | A PDF is received via email ingest | Processing resumes, invoices, or inbound documents |
| **Webhook** | Data arrives via the table's webhook endpoint | Integrating with external tools or APIs |
| **Scraper Bot** | A scraper bot delivers results | Processing web-scraped company or contact data |
| **Import** | Rows are added via CSV, paste, CRM import, or search | Enriching newly imported batches automatically |

For email PDF and webhook start events, you can configure expected source types and fields so the pipeline knows what data to extract.

### Step Types

Add steps in any order. Each step runs after the previous one completes.

| Step | What It Does | Configuration |
|------|-------------|---------------|
| **AI Group** | Runs AI extraction using a saved column group | Select an existing AI column group or create one inline |
| **Waterfall** | Runs waterfall enrichment on a column | Select a waterfall-configured column |
| **Formula** | Evaluates a formula expression and writes the result | Uses the G8X expression engine — see [formula syntax](#formula-expressions) |
| **Branch** | Routes rows through different paths based on a condition | Configure field, operator, and value — rows go to "if true" or "else" path |
| **Export to List** | Sends the row to a contact or company list | Choose destination list and map fields |

### Branching

Branch steps split the pipeline into two paths based on a condition. Configure the condition using a field name, an operator, and a value:

| Operator | Example |
|----------|---------|
| Equals | `status` equals `qualified` |
| Not equals | `tier` not equals `disqualified` |
| Contains | `title` contains `VP` |
| Greater than | `score` greater than `70` |
| Less than | `score` less than `30` |
| Is empty | `email` is empty |
| Is not empty | `phone` is not empty |

Rows matching the condition follow the "if true" path. All others follow the "else" path. Each path can have its own steps.

> **Caution:**
> Only one branch step is allowed per pipeline. Nested branches are not supported.

## Templates

The pipeline builder includes pre-built templates to get started quickly:

| Template | Steps | Use Case |
|----------|-------|----------|
| **Email PDF Extraction** | AI extraction → formula scoring → export | Processing inbound resumes or documents |
| **Webhook Routing** | AI classification → branch → export | Routing webhook data based on content |
| **Import Classification** | AI analysis → formula tagging → export | Categorizing newly imported contacts |
| **SDR Candidate Grading** | Resume extraction → location detection → scoring → tier mapping → narrative → export | Full candidate evaluation pipeline |

Click a template to scaffold the pipeline with pre-configured steps. You can then customize each step's settings.

## Formula Expressions

Pipeline formula steps use the G8X expression engine — a safe, deterministic formula language. Formulas can reference any field in the row using dot notation.

### Common Functions

| Category | Functions |
|----------|----------|
| **String** | `UPPER`, `LOWER`, `TRIM`, `CONCAT`, `SPLIT`, `JOIN`, `REPLACE`, `SUBSTRING`, `LEFT`, `RIGHT` |
| **Math** | `ADD`, `SUB`, `MUL`, `DIV`, `MOD`, `MIN`, `MAX`, `FLOOR`, `CEIL`, `ROUND`, `ABS` |
| **Logic** | `IF`, `AND`, `OR`, `NOT`, `EQ`, `GT`, `GTE`, `LT`, `LTE` |
| **Type** | `TO_NUMBER`, `TO_STRING`, `IS_EMPTY`, `COALESCE`, `DEFAULT` |
| **JSON** | `GET`, `KEYS`, `VALUES`, `LENGTH`, `INCLUDES`, `FIND` |

### Examples

Score a contact based on title and location:
```
IF(INCLUDES(LOWER(title), "vp"), 90, IF(INCLUDES(LOWER(title), "director"), 70, 50))
```

Classify a row by source:
```
IF(IS_EMPTY(email), "no-email", IF(INCLUDES(email, "@company.com"), "internal", "external"))
```

Combine first and last name:
```
CONCAT(TRIM(first_name), " ", TRIM(last_name))
```

> **Tip:**
> Formulas run in a sandboxed environment with no access to external data or APIs. They can only read fields from the current row and call whitelisted functions.

## Async Processing

Pipelines process data asynchronously. When rows arrive, graph8 evaluates which pipelines match the start event and enqueues each step for background processing. This means:

- **No timeouts** — large batches process reliably without blocking the UI
- **Retry on failure** — failed steps retry automatically with exponential backoff
- **Progress tracking** — the grid updates in real time as each step completes

AI and waterfall steps are distributed across multiple workers for throughput. Formula steps execute immediately since they require no external calls.

## Related

- [Staging Workbench →](https://docs.graph8.com/data/staging-workbench/) — Import and prepare data before it enters your lists
- [Enrichment & Formulas →](https://docs.graph8.com/data/enrichment/) — Enrich contacts already in a list
- [Managing Lists →](https://docs.graph8.com/data/managing-lists/) — Organize and filter your lists
