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

# Workflow Studio

> Configure the per-brand Temporal pipeline — templates, context sources, review gates, and escalation.

# Workflow Studio

Workflow Studio configures the **15-phase Temporal pipeline** that runs per brand. It is where
you decide what the agent looks at, what it is allowed to do on its own, and when a human gets
involved.

## The pipeline

```
Ingest → Classify → Context → Generate → Review → Dispatch
```

| Stage        | What happens                                         |
| ------------ | ---------------------------------------------------- |
| **Ingest**   | The inbound message arrives from a channel           |
| **Classify** | Contact reason and response motion are determined    |
| **Context**  | Data is gathered from the configured sources         |
| **Generate** | The response and any actions are produced            |
| **Review**   | The review gate decides: dispatch, hold, or escalate |
| **Dispatch** | The response and actions are executed                |

## Templates

New brands start from a template that pre-fills 14+ phases, rather than configuring the
pipeline from scratch:

| Template                | Motion                                |
| ----------------------- | ------------------------------------- |
| `support_control_tower` | Omnichannel CX with human-in-the-loop |
| `sales_concierge`       | Sales-led conversations               |
| `voice_receptionist`    | Voice-first reception                 |
| `ecommerce`             | Shopify commerce motion               |
| `subscription`          | Recharge subscription motion          |
| `knowledge_base`        | Knowledge-led answering               |
| `order_status`          | Workflow-narrow: order status         |
| `return_refund`         | Workflow-narrow: returns and refunds  |
| `subscription_pause`    | Workflow-narrow: pause a subscription |
| `order_cancellation`    | Workflow-narrow: cancel an order      |

The workflow-narrow templates are useful when you want an agent that does exactly one job well,
rather than a general assistant.

## Context sources

The Context phase gathers from whichever sources you enable:

| Source                   | Provides                       |
| ------------------------ | ------------------------------ |
| `response`               | Prior Response history         |
| `knowledge_base`         | The org's Qdrant KB collection |
| `stateset_agent_context` | Agent-level context            |
| `gorgias_ticket`         | The originating Gorgias ticket |
| `shopify_customer`       | Shopify customer record        |
| `shopify_orders`         | Shopify order history          |
| `recharge_customer`      | Recharge customer record       |
| `recharge_subscriptions` | Recharge subscriptions         |
| `loop_subscriptions`     | Loop subscriptions             |

### Gather strategy

`context_gather_strategy` controls what happens when a source is slow or unavailable:

| Strategy        | Behavior                                              |
| --------------- | ----------------------------------------------------- |
| `require_all`   | Every configured source must return before generating |
| `critical_only` | Only sources marked critical must return              |
| `best_effort`   | Generate with whatever arrived                        |

<Warning>
  `best_effort` keeps the pipeline moving when an integration is down, but the agent will answer
  from partial context — it may not know about a recent order. For flows that act on money or
  orders, prefer `require_all` or `critical_only` and let the gate escalate rather than answering
  on incomplete data.
</Warning>

## Review gate

The Review phase is the safety boundary between what the agent generated and what the customer
actually receives. Configured actions include:

| Action              | Effect                                  |
| ------------------- | --------------------------------------- |
| `auto_approve`      | Dispatch without human review           |
| `flag_and_dispatch` | Dispatch, but flag for later inspection |
| `tag_and_review`    | Tag and route into review               |
| `block`             | Do not dispatch                         |
| `escalate`          | Hand off to a human                     |
| `reject`            | Discard the generated response          |

`review_timeout_secs` bounds how long a decision can pend, and `escalation_always_review`
forces review on escalation paths regardless of other rules.

### High-Value Actions

By default any action valued at **\$100 or more** requires human approval before the engine
executes it. This is configured per brand in the Review Gate phase.

<Note>
  This threshold is the main lever between autonomy and control. Lower it while you build trust
  in a new brand's configuration, then raise it once the escalation and dispute rates look right.
</Note>

## Editing

The Studio editor supports:

* **List ↔ Graph** view toggle (`?view=graph` for the visual editor)
* **`⌘K`** phase jumper
* **`⌘S`** save
* Per-phase **`?` explainers**
* A **pending-changes diff** against the last saved config

<Tip>
  Read the pending-changes diff before saving. Because a template pre-fills 14+ phases, it is easy
  to change more than you intended — the diff is the only place the full effect is visible.
</Tip>

## Rollout

Workflow Studio is designed to be adopted in stages rather than switched on wholesale:

1. **Operator-led private beta** — operators drive, the pipeline shadows.
2. **Assisted onboarding** — configuration with support.
3. **Self-serve production** — the customer configures their own brands.

An `operator_shadow` phase supports running the pipeline alongside a human without dispatching,
so you can compare what the agent *would* have done against what the operator did.

## Related

* [ResponseCX Platform](/stateset-response/responsecx-platform)
* [ResponseCX Workflows](/stateset-response/stateset-responsecx-workflows)
* [Billing & outcomes](/stateset-billing)
