Workflows

Chain requests that depend on each other — shared variables, waiting, retries, polling, conditions and loops, drawn as a flow chart.

A workflow runs saved requests that depend on each other: log in, create a submission, upload its files, wait until it’s processed, then submit it. Each step can pull values out of its response (an id, a token) for the steps after it, and can wait, retry, poll, run only when a condition holds, or repeat for every item in a list. Mitey draws the workflow as a flow chart and lights it up as it runs.

Create a workflow

In the sidebar’s Workflows section, use ⋮ → New workflow (or New workflow in the command palette).

A workflow tab is laid out like a request’s. The left pane has the workflow’s tabs: Steps (the flow chart), Variables and Settings (name, description and how it runs), with Add step, save and Run at the end of the tab strip. The right pane, where a response would be, shows the selected step with its own tabs (Request, Vars, Extract, Expect, Retry, Poll, If, Each, Response), or the run’s results when no step is selected. As on a request, a dot on a tab means it’s set.

On Steps, click Add step and pick a saved request, or choose New request at the top of the list to create a blank one (named after what you typed in the search box) and edit it from the step’s Request tab. Each step links a request rather than copying it, so the request stays in one place: edit, rename or move it and every workflow that uses it follows.

Only HTTP requests can be steps for now.

Passing values between steps

Select a step and, on its Extract tab, name a value and say where it comes from:

FromPathExample
BodyA JSON pointer or a simple path/data/id, $.data.id, $.items[0].name
HeaderThe header nameLocation
Status—the status code

After a run, the step’s Response tab shows its last response. Click any field in it to extract that value.

Now use the variable anywhere in a later request as usual, {{submissionId}}: in the URL, headers, body or auth, or in a folder’s settings the request inherits. You never connect steps by hand. A step that uses a variable runs after the step that extracts it, and the arrow between them is labelled with the variable’s name. If two steps have nothing to share but must still run in order, tick the earlier one under Request → Also run after (drawn dashed).

Steps that don’t depend on each other run at the same time, up to the workflow’s Settings → Steps at once (4 by default).

A step’s Vars tab sets variables for that step only, in the same table as a request’s Params.

Values a pre/post script sets with mt.environment.set join the workflow’s variables too.

A workflow’s values win over a request’s own variables. A request can keep a sample submissionId for running on its own, and a workflow run replaces it with the real one.

Workflow variables

Each workflow has its own variables, on its Variables tab. The table is the same as an environment’s, so values can be plain, secret (stored encrypted on your device, never in the workflow file) or ƒx (computed by a script). Every step can use them, and they override the requests’ own variables and the environment. Values extracted during the run override them in turn, and so does --var name=… on the command line. A workflow variable’s ƒx script asks for review before the first run, like a request’s scripts.

Generated values

{{$guid}}, {{$randomUUID}}, {{$timestamp}} and {{$randomInt}} are generated once per run: every step, and every item of a repeated step, gets the same value. A new run generates new ones. Put one in a workflow variable to give it a name, for example requestId = {{$guid}}, and send it as an X-Request-Id header on every step.

Secret values

Tick the lock on an extract to mask its value wherever the run is shown. It’s still sent to the steps that use it.

Waiting, retrying and polling

Each step can:

  • Wait before sending (the step’s Request tab).
  • Retry when it fails. Set the number of attempts, the delay, fixed or exponential backoff, and which failures to retry: no response, 5xx, 429, 4xx, or a failed expectation. A server’s Retry-After is honoured, up to the maximum delay.
  • Poll: send again until a condition holds, for example until body /status = done. Set an interval and a time limit, and optionally a condition that stops early and fails (status = failed). Each poll’s send is retried as configured.

Pass or fail

By default a step passes on any 2xx with every script test (mt.test) passing. On the step’s Expect tab, list the accepted status codes (201, or 200, 204) and add checks on the response. A step also fails if a value it should extract isn’t in the response.

When a step fails, the run stops and starts nothing new. Choose Settings → When a step fails → Skip only what depends on it to let independent branches carry on.

Conditions and loops

  • If: the step runs only when a condition on the workflow’s variables holds ({{mode}} = full). Secret and ƒx variables aren’t visible to conditions. If it doesn’t, the step is skipped, and so is every step that needs its variables. A step that only runs after it still runs, so an optional branch can rejoin.
  • Each: point it at a variable holding a JSON list (an extracted array, or a workflow variable like ["a.pdf", "b.pdf"]). The step runs once per item, with {{item}} and {{itemIndex}} set (rename item as you like), several at once if you allow it. Each extract collects into a list, which a later step can loop over in turn.

Conditions are made from checks you pick from lists (body /status = done, header Location exists, {{count}} > 3, matches a regular expression), not code. So they need no script approval and behave the same from the app, the command line and an AI agent.

Running

Press Run. Each step shows its state as the run goes: sending, retrying (with the attempt), polling (with the round), passed with its status code, failed, or skipped. Select a step to see why, its attempts, and its last response. With no step selected, the right pane shows the run: Run values fills in as values are extracted (each marked with the step it came from), Steps lists every step’s outcome, and Problems lists anything that stops the workflow from running.

Requests that carry pre/post scripts ask for review before the run, as they do in the collection runner.

From the command line and AI agents

Run a workflow headless by its name or file:

mitey run "Submission lifecycle" --env Local
mitey run .flows/submission-lifecycle.flow.yaml --var title="Q3 report" --json

It prints each step as it finishes and exits 0 only when the workflow passed. --var overrides any variable, the workflow’s own included. See Command line.

AI agents connected over MCP can list workflows (list_workflows) and run them (run_workflow). Every step gets the same checks as a single request an agent runs: write requests may need your approval, and secrets are only sent for requests you approved. Values from responses hidden from agents never reach the agent, not even inside an error message. See MCP server.

How workflows are stored

Each workflow is a YAML file in the workspace’s .flows/ folder, named after the workflow, so it’s versioned with the rest of the workspace. Its secrets aren’t in it: steps point at requests by id, secret workflow variables keep only a vault reference, and positions on the chart aren’t saved (the layout is automatic), so diffs stay small.

name: Submission lifecycle
variables:
- { key: files, value: '["report.pdf", "appendix.pdf"]', enabled: true }
- { key: requestId, value: '{{$guid}}', enabled: true }
steps:
- id: log-in
  request: 3b0f6c1e-…          # the saved request's id
  extract:
  - { name: token, from: body, path: /token, secret: true }
- id: create
  request: 4c1a7d2f-…
  expect: { status: [201] }
  extract:
  - { name: submissionId, from: body, path: /id }
- id: upload
  request: 5d2b8e3a-…
  forEach: { items: files, as: file, concurrency: 2 }
- id: wait
  request: 6e3c9f4b-…
  after: [upload]
  poll:
    until: { all: [{ from: body, path: /status, op: eq, value: done }] }
    intervalMs: 1000
    timeoutMs: 30000

The example workspace in mitey-support has this Submission lifecycle workflow, and its mock server has the job API it runs against.