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

# Workflows

> The visual decision graph: what runs when, what variables carry between nodes, how versions and runs are tracked.

A **workflow** in Frayme is a directed graph that turns events into decisions. Nodes are the building blocks; edges define the order and the conditional routing.

```mermaid theme={null}
flowchart LR
  In[Input] --> Rule
  Rule --> DS[Data Source]
  DS --> AI
  AI --> DT[Decision Table]
  DT --> MR[Manual Review]
  DT --> Act[Auto Action]
  MR --> Out[Output]
  Act --> Out
```

## What lives at the top of a workflow

Each workflow declares:

| Field                                   | Purpose                                                                            |
| --------------------------------------- | ---------------------------------------------------------------------------------- |
| `id`                                    | Stable identifier.                                                                 |
| `name`                                  | Human label shown in the workflow list.                                            |
| `description`                           | One-paragraph product summary.                                                     |
| `status`                                | `draft` · `active` · `archived`                                                    |
| `version`                               | Monotonic integer — bumped on every save.                                          |
| `createdBy` / `createdAt` / `updatedAt` | Authorship + edit history.                                                         |
| `parameters`                            | Top-level tunables shared across nodes (thresholds, callback URLs, feature flags). |
| `nodes`                                 | The list of nodes (see [node reference](/workflows/nodes/overview)).               |
| `edges`                                 | Directed connections — source, target, optional `sourceHandle`, optional `label`.  |

## Node taxonomy

<CardGroup cols={2}>
  <Card title="Flow control" icon="route">
    `input`, `output`, `split`, `decisionTable`, `assignment`, `condition`
  </Card>

  <Card title="Computation" icon="calculator">
    `rule`, `scorecard`, `code`, `ai`
  </Card>

  <Card title="Integration" icon="plug">
    `dataSource`, `customApi`
  </Card>

  <Card title="Human + outcome" icon="user">
    `manualReview`, `action`
  </Card>
</CardGroup>

## Variables and templating

Every node writes outputs to the run context. Downstream nodes read them via `{{path.to.variable}}` interpolation.

```text theme={null}
{{input.declared_country}}                ← workflow input
{{sumsub_identity.review_answer}}         ← upstream dataSource output
{{ai_risk_synthesis.risk_band}}           ← upstream AI output
{{workflow_run_id}}                       ← system-injected
```

Full reference in [Variables & templating](/workflows/variables-templating).

## Parameters

Top-level `parameters` are the tunable surface — what compliance can change without touching the graph.

```jsonc theme={null}
[
  { "name": "max_address_length", "type": "integer", "value": 100 },
  {
    "name": "false_positive_confidence_threshold",
    "type": "integer",
    "value": 85,
  },
  {
    "name": "notification_callback",
    "type": "string",
    "value": "https://api.example.com/webhook",
  },
]
```

Parameters are referenced like variables (`{{params.max_address_length}}`) and are version-controlled together with the graph.

## Runs and history

Every execution writes to the workflow's run history with per-node input, output and elapsed time. The Workflow Run Inspector replays this for any run.

## Editing safely

<Steps>
  <Step title="Branch the graph">
    Use the Workflow Editor's "Duplicate as draft" to fork a workflow into a draft you can edit freely.
  </Step>

  <Step title="Test with fixtures">
    Pin a known-good input from a recent run. Click "Test workflow" — every node executes against the fixture without writing decisions.
  </Step>

  <Step title="Promote">
    When the draft passes, flip `status: active` and the engine cuts over on the next event. The old version stays addressable via `version` for replay.
  </Step>
</Steps>
