Flows
A flow is a TOML file that lists steps. Each step runs one saved request. Steps can depend on other steps and can pull values out of a response for later steps to use. Use flows for multi-step scenarios such as “log in, then fetch the profile and the bills”.
A complete example
Section titled “A complete example”This example runs against the demo workspace from recon init --demo. It lists students, then enrolls the first student and fetches a page of students in parallel.
flows/enroll.flow.toml:
name = "Enroll First Student"description = "List students, then enroll the first one and fetch a page in parallel"
[[steps]]id = "list"request = "List Students"fail_fast = true
[steps.extract]FIRST_ID = "$.students[0].student_id"CONTENT_TYPE = "header:content-type"SESSION = { from = "$.session_token", secret = true, allowed_hosts = ["127.0.0.1", "localhost"] }
[[steps]]id = "enroll"request = "flows/requests/enroll.http"depends_on = ["list"]
[[steps]]id = "page"request = "flows/requests/paged.http"depends_on = ["list"]flows/requests/enroll.http uses two of the extracted values:
### Enroll Extracted Student# @name Enroll Extracted Student# @assert status == 201POST {{base_url}}/v1/enrollmentsContent-Type: application/jsonAuthorization: Bearer {{SESSION}}
{ "student_id": "{{FIRST_ID}}", "course": "CS-401"}flows/requests/paged.http:
### Students Page 1# @name Students Page 1GET {{base_url}}/v1/students-paged?page=1&per_page=2List the flows in the workspace:
recon flow listEnroll First Student (3 steps) — flows/enroll.flow.tomlRun it:
recon flow run "Enroll First Student"Flow `Enroll First Student` (local) [PASS] in 17.1ms [wave 0] list -> HTTP 200 (7.8ms) [wave 1] enroll -> HTTP 201 (8.8ms) [wave 1] page -> HTTP 200 (8.8ms)enroll and page both depend only on list, so they run together in wave 1.
File location and discovery
Section titled “File location and discovery”Recon discovers flows in the flows/ directory at the workspace root, including subdirectories. Only files whose names end in .flow.toml count. Files are sorted by path.
File format
Section titled “File format”Top-level keys
Section titled “Top-level keys”| Key | Type | Required | Description |
|---|---|---|---|
name |
string | yes | Display name. Also used to find the flow with recon flow run <name>. |
description |
string | no | Free text shown in recon flow list --format json and the UI. |
steps |
array of tables | no | The steps, written as [[steps]]. A flow with no steps runs and passes. |
Step keys
Section titled “Step keys”| Key | Type | Default | Description |
|---|---|---|---|
id |
string | required | Unique step ID within the flow. |
request |
string | required | A saved request ID or name, or a workspace-relative path to a .http file. |
depends_on |
array of strings | [] |
Step IDs that must finish before this step starts. Listing the same ID twice has no extra effect. |
extract |
table | {} |
Variables to pull from this step’s response. See Extracting values. |
fail_fast |
bool | false |
If this step fails, skip every later wave. |
That is the whole schema. There are no keys for retries, timeouts, conditions, loops or per-step environments. Unknown keys are ignored without an error, so a typo such as depends-on is silently dropped.
How request is resolved
Section titled “How request is resolved”- Recon looks for a saved request in the workspace collections with that ID or name.
- If none, it treats the value as a path relative to the workspace root. If that file exists, it parses it as a
.httpfile and uses the first request in it. The file does not need to be inside the collections directory. - Otherwise the run stops with
step `<id>` references unknown request `<request>`.
Resolution happens when a wave starts, not up front. If a step in wave 2 names an unknown request, waves 0 and 1 have already run (and been recorded) when the command fails.
Extracting values
Section titled “Extracting values”Each entry under [steps.extract] defines one variable. The key is the variable name. Later steps use it like any environment variable, as {{NAME}}.
The value is either a string (shorthand) or an inline table:
[steps.extract]FIRST_ID = "$.students[0].student_id"CONTENT_TYPE = "header:content-type"SESSION = { from = "$.session_token", secret = true, allowed_hosts = ["127.0.0.1", "localhost"] }| Table key | Type | Default | Description |
|---|---|---|---|
from |
string | required | Where to read the value. |
secret |
bool | false |
Store the value as a secret. |
allowed_hosts |
array of strings | [] |
Hosts the secret may be sent to. Only used when secret = true. |
The from expression (or the shorthand string) works like this:
header:<Name>(orHEADER:<Name>) reads a response header. The name match is case-insensitive.- Anything else is a JSONPath evaluated on the response body. The body must be valid JSON. The first match is used.
Values are converted to strings. Strings are used as is, numbers and booleans are printed, null becomes an empty string, and objects or arrays become JSON text.
If an expression fails (missing header, body not JSON, zero matches), the step fails with extract `<NAME>` failed: ... and the remaining extract rules of that step are not evaluated.
Secret extracts
Section titled “Secret extracts”A secret extract is stored with host scoping. The Outbound Secret Firewall then blocks any later step that would send the value to a host outside allowed_hosts. In reports and output the value is shown as [SECRET:<NAME>], and it is scrubbed from the request URL, headers and body that the step records in the Flight Recorder.
"extracted_vars": { "CONTENT_TYPE": "application/json", "FIRST_ID": "001001", "SESSION": "[SECRET:SESSION]"}When values become visible
Section titled “When values become visible”Variables are applied at the end of each wave. A step sees the environment as it was when its wave started, plus everything extracted in earlier waves. Steps in the same wave cannot see each other’s values. If two steps in one wave extract the same name, the step listed later in the file wins.
Execution model
Section titled “Execution model”Waves and ordering
Section titled “Waves and ordering”Recon validates the graph with Kahn’s algorithm and groups steps into waves:
- Wave 0 holds every step with no dependencies, in file order.
- Each later wave holds the steps whose dependencies are all in earlier waves, in file order.
recon flow list --format json shows the waves:
{ "flows": [ { "description": "List students, then enroll the first one and fetch a page in parallel", "file": "flows/enroll.flow.toml", "name": "Enroll First Student", "step_count": 3, "waves": [ [ "list" ], [ "enroll", "page" ] ] } ]}Concurrency
Section titled “Concurrency”All steps in a wave start at the same time. There is no limit on how many run at once. The next wave starts only after every step in the current wave has finished.
Validation errors
Section titled “Validation errors”| Problem | Message |
|---|---|
| Two steps share an ID | duplicate workflow step id `a` |
depends_on names a missing step |
step `a` references unknown dependency `ghost` |
| Cycle | dependency cycle detected involving workflow step(s): a, b |
Missing name |
parse error: invalid flow ...: TOML parse error ... missing field `name` |
The cycle message lists every step that could not be scheduled, which includes steps that only depend on a cycle.
When a step passes
Section titled “When a step passes”A step passes when all of these hold:
- its request template resolves;
- the firewall allows it;
- the HTTP call completes;
- its
# @assertlines all pass, or, if it has none, the status is below400; - every extract rule succeeds.
Possible error values on a failed step:
| Error | Cause |
|---|---|
| Template error text | A {{variable}} could not be resolved. |
E_FIREWALL_BLOCKED: ... |
The firewall blocked the request. |
E_AGENT_POLICY_DENIED: ... |
Agent policy denied the request (MCP only). |
| Transport error text | The connection or request failed. |
unexpected HTTP status <N> |
No assertions and status >= 400. |
<assertion>: <detail>; ... |
One or more assertions failed. |
extract `<NAME>` failed: ... |
An extract rule failed. |
Failure behaviour
Section titled “Failure behaviour”- A failed step without
fail_fastdoes not stop anything. Steps that depend on it still run. - A failed step with
fail_fastlets the rest of its own wave finish, then marks every step in every later wave as skipped, whether or not it depends on the failed step. - The flow passes only if every step passed. Skipped steps count as not passed.
recon flow run ../flowtests/failfast.flow.tomlFlow `Fail Fast Demo` (local) [FAIL] in 4.5ms [wave 0] leak -> FAIL (0.4ms) — E_FIREWALL_BLOCKED: outbound secret firewall blocked 1 violation(s) [wave 0] list -> FAIL (4.4ms) — extract `MISSING` failed: JSONPath `$.does_not_exist` returned zero matches [wave 1] after -> SKIP (0.0ms) — skipped due to upstream fail_fast failureEnvironment
Section titled “Environment”--env picks the environment. It defaults to the workspace default_env. If the named environment does not exist, the flow runs with an empty variable set rather than failing, so requests that need {{base_url}} fail at template resolution.
Recording
Section titled “Recording”Each executed step is recorded in the Flight Recorder. The actor label is flow for the CLI, you for the Web Studio and agent-flow for MCP. Request headers, body and URL have secret values scrubbed before they are stored. The global transport flags apply, and the cookie jar is saved after the run when cookies are enabled.
recon flow list
Section titled “recon flow list”Lists discovered flows. Human output shows one line per flow: name, step count and workspace-relative file. JSON output wraps a list of objects with name, description, file, step_count and waves. Exit code 0, or 2 if discovery fails.
recon flow run
Section titled “recon flow run”recon flow run <FLOW> [--env <NAME>]<FLOW> is matched in this order:
- A file path, relative to the current directory.
- A file path, relative to the workspace root.
- A discovered flow whose
namematches (case-insensitive) or whose path ends with<FLOW>.
If nothing matches: workflow `<FLOW>` not found.
| Flag | Default | Description |
|---|---|---|
--env <NAME> |
workspace default_env |
Environment for variables. |
Exit codes
Section titled “Exit codes”| Code | Meaning |
|---|---|
0 |
The flow passed. |
1 |
The flow ran and at least one step failed or was skipped. |
2 |
The flow could not run: not found, invalid file, unknown request, workspace error (E_CLI_RUNTIME). |
JSON report
Section titled “JSON report”--format json prints the full report:
{ "flow_name": "Enroll First Student", "env_name": "local", "passed": true, "total_duration_ms": 6.622229, "waves": [ [ "list" ], [ "enroll", "page" ] ], "steps": [ { "id": "list", "request_name": "List Students", "wave": 0, "status": 200, "duration_ms": 5.1354169999999995, "passed": true, "skipped": false, "error": null, "assertions": [ { "assertion": "status == 200", "passed": true, "detail": "observed status 200" }, ... ], "extracted_vars": { "CONTENT_TYPE": "application/json", "FIRST_ID": "001001", "SESSION": "[SECRET:SESSION]" }, "run_id": "01a22d24-7564-75d5-95ce-38a7ea21cca1" }, ... ]}| Step field | Meaning |
|---|---|
id |
Step ID. |
request_name |
Name of the request that ran (the step’s request value for skipped steps). |
wave |
0-based wave index. |
status |
HTTP status, or null if the step never reached the network or was skipped. |
duration_ms |
Step duration. |
passed, skipped, error |
Outcome. |
assertions |
Assertion results from the request’s # @assert lines. |
extracted_vars |
Extracted values. Secrets show as [SECRET:<NAME>]. |
run_id |
Flight Recorder run ID, if recorded. |
Steps appear wave by wave, in file order within each wave.
Also available via
Section titled “Also available via”- Web Studio: the Flows button in the top bar (or “Run Workflow DAG” in the command palette) opens the “Declarative DAG Workflow Runner”. It lists discovered flows with step and wave counts, shows each wave, and runs the selected flow against the active environment with Run DAG. Results show status, duration, errors and extracted values per step. See Web Studio.
- HTTP API:
GET /api/v1/flowsandPOST /api/v1/flows/runwith body{flow_path, env?}. See HTTP API. - MCP:
recon_run_flowwithflow_pathand optionalenv. It matches a flow by path, byname, or by exact file name. Every step is checked against the agent policy, and plain extracted values are masked in the report. See MCP Tools.