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

# Save as Flow

> Turn an ad-hoc run into a persisted, re-runnable Flow.

Any run started from a natural-language prompt can be saved as a Flow. The Flow captures the **exact graph** Xura walked — same data queries, same actions.

## How it works

While a Flow runs, Xura records each tool call as a node and each transition as an edge. On completion, the server sends a single `graph` SSE event with the full `{ nodes, edges, prompt }` payload. The client stashes it and enables the **Save as Flow** button on the completion card.

Click it once:

1. `POST /api/agent-studio/flows` with `{ name, description, nodes, edges, enabled: false }`.
2. Server returns the created flow's id.
3. Button flips to **Open in Flows** — click through to the editor.

## What gets saved

* **name** — the workflow's display name (or first 60 chars of the prompt).
* **description** — the original prompt text. Used by the planner if you re-plan later.
* **enabled: false** — saved as Draft. Turn on when ready.
* **nodes / edges** — the exact graph. Approval nodes retain their proposed action, action nodes retain their `toolName` + args.

## Fallback: graph event never arrived

If the `graph` SSE event drops (network hiccup, run cancelled early), Save as Flow still works — it saves an **outline flow**: name + description with only a Trigger node. You can then click **Plan from description** in the editor to regenerate the graph, or add nodes manually.

## Re-running a saved Flow

Open the Flow → click **Run now**. The same 4-stage panel appears. Approval gates behave identically. Actions execute with fresh interpolation over the new data.

<Note>
  Data nodes in a saved Flow use the same `query_data` step type. They re-query your live data — they don't snapshot it.
</Note>
