Repository navigation
Workflows as Scripts
For people who would rather write a workflow as text than drag blocks, and for anyone asking an LLM (Claude, ChatGPT, a coding agent) to write one. Every workflow in BlockFlow is a JSON file; this page explains that file, how to get it in and out of the extension, and how it compares to a Playwright script.
The canonical reference is the usage guide. This page summarises it and adds the practical parts: a prompt template, the edit-run-fix loop, and a Playwright mapping.
A workflow file is usually called something.blockflow.json. It holds one or more workflows, each a list
of blocks (nodes) and connections (edges). This one opens a search page, types a query, presses Enter
and checks that results appear:
{
"format": "blockflow-workflows",
"version": 1,
"workflows": [
{
"schemaVersion": 1,
"id": "search-test",
"name": "Search shows results",
"enabled": false,
"nodes": [
{ "id": "open", "type": "open-url", "position": { "x": 0, "y": 0 },
"config": { "url": "https://example.com/search", "where": "window" } },
{ "id": "query", "type": "fill", "position": { "x": 260, "y": 0 },
"config": { "locator": "role=searchbox", "value": "blue shoes" } },
{ "id": "submit", "type": "press-key", "position": { "x": 520, "y": 0 },
"config": { "key": "Enter", "locator": "role=searchbox" } },
{ "id": "results", "type": "assert", "position": { "x": 780, "y": 0 },
"config": { "subject": "count", "locator": ".result", "operator": "greater", "expected": "0" } }
],
"edges": [
{ "id": "e1", "source": "open", "target": "query" },
{ "id": "e2", "source": "query", "target": "submit" },
{ "id": "e3", "source": "submit", "target": "results" }
]
}
]
}What each part means:
| Part | Meaning |
|---|---|
format, version
|
Always "blockflow-workflows" and 1. A single workflow object without this wrapper also imports. |
id |
Any unique string. Import replaces it with a fresh id (references between workflows in the same file, from Run Workflow, are kept). |
enabled |
Ignored on import: imported workflows always arrive off. |
nodes[].type |
The block type, e.g. open-url, click, assert. Must exist in the block reference. |
nodes[].config |
The block's settings. Keys come from the block reference; missing keys take the default. |
nodes[].position |
Where the block sits on the canvas. About 260 px apart left to right reads well. |
nodes[].step |
Optional per-block settings: timeoutSeconds, retries, onError, screenshot, disabled, note, realInput. See step settings. |
edges |
Connections. sourcePort picks an output on blocks that have several: "true"/"false" on If, "each"/"done" on loops, "error" when the source has "step": { "onError": "port" }. |
A block with no incoming edge is a start block. The first block here, Open Tab, runs once when you
press ▶ Run. To run on a schedule, start with a timer or schedule block instead (see
Concepts).
Data flows along edges as a JSON object. A block's settings can use earlier data with {{name}}, secrets
with {{secret.name}}, and expressions with {{ price * 1.1 }}. Details:
data and templates.
These are generated by npm run guide:sync from the block definitions, so they are always in step with
the extension. Give them to an LLM rather than retyping them.
| File | Use it for |
|---|---|
| blocks.md | Every block: type, every config key with type and default, outputs, default timeout. Human-readable. |
| blocks.json | The same, machine-readable. |
| workflow.schema.json | JSON Schema of an import file, with every block's config. Use it in an editor (VS Code: "$schema") or a validator. |
| examples/ | Eight importable workflows. A test checks that each imports without errors. |
| llms.txt | The short index an AI tool should read first. |
The schema checks shapes and allowed values. It does not reject unknown config keys (they are
silently ignored by BlockFlow too), so a typo like "locater" passes both. Check key names against
blocks.md.
The full list is in the guide: Rules for AI tools. In short:
- Output the export format above.
- Use only block
types andconfigkeys from blocks.md. - Every page block (Click, Fill, Assert on the page, Extract List…) needs an Open Tab earlier on the
same path, with the same
tabname (defaultmain). - Connect with
edges; usesourcePortonly on blocks with several outputs. - Prefer readable locators:
role=button[name="Sign in"],label=Email,text=Welcome,testid=…. Actions are strict: a locator that matches two elements fails. See locators. - Never put passwords or tokens in the file. Use
{{secret.name}}and tell the user which secrets to create. - Do not add waits "just in case": every action already waits for its element.
- Check results with Assert (tests) or If + Notify (monitoring).
- Template values are strings. Compare numbers with
greater,lessand friends.
Copy this, fill in the bracketed parts, and attach (or paste) docs/guide/README.md and
docs/guide/blocks.md. Models do best with both files in context.
You are writing a BlockFlow workflow file. BlockFlow is a browser extension that runs
automations made of blocks inside my own browser. Attached are its usage guide
(README.md) and its block reference (blocks.md). Follow the guide's
"Rules for AI tools" section exactly.
Task: [what the workflow should do, step by step, e.g. "Log in to https://app.example.com/login
with my email me@example.com, open Settings, and check that the heading says 'Account'"]
Page details I know: [labels, button texts, test ids, URLs. Say "unknown" if you don't know]
How it should start: [by hand with Run / every N minutes / daily at 09:00 / when I visit a URL]
What should happen on failure: [fail the run / send a notification / continue]
Output:
1. One JSON file in the "blockflow-workflows" export format, nothing else in the code block.
Use only block types and config keys from blocks.md.
2. A list of secrets I must create (name and what goes in it).
3. A list of locators you guessed, so I can check them with Pick on page.
Tips that make the first try more likely to work:
- Give the model real labels and button texts from the page. Locators it has to guess are the most common reason a generated workflow fails.
- Ask for one workflow at a time, short, ending in Asserts. Add branches once the straight path passes.
- If the model writes
"locater","selector"on a Click, or a type that does not exist, the file will still import but the setting is ignored or the block is flagged. Compare againstblocks.md.
Import (sidebar top, or the All workflows page): pick one or more .blockflow.json files. Each
workflow gets a fresh id, a unique name ("Login test 2" if the name is taken) and arrives off, so an
import can never start something by surprise or overwrite a workflow.
Export: hover a workflow in the sidebar → export, or select several on All workflows → Export.
You get <name>.blockflow.json (several workflows: blockflow-workflows.blockflow.json). Exported
workflows are always marked off. Secrets are never part of the file, only their {{secret.name}}
references.
+ New ▾ offers the files in examples/ as templates.
Known issue (November 2026): import, templates and Duplicate currently drop each block's
stepsettings and each edge'ssourcePort. After import, connections from Iffalse, loopdoneanderroroutputs are attached to the block's first output instead, andonError: "port"is lost. Until this is fixed, re-check branching blocks on the canvas after importing (drag the connection to the right output, set On error again). Tracked as P0 in the product plan.
There are two stages.
1. Reading the file. If the file cannot be read at all, nothing is imported and a notice says why:
| Notice | Cause |
|---|---|
Import failed: This file is not valid JSON. |
Syntax error: trailing comma, comments, unquoted key. |
Import failed: This file does not look like a BlockFlow workflow. |
A workflow without nodes and edges arrays. |
Import failed: A block in this file is malformed. |
A node without a string id or type. |
Import failed: No workflows found in this file. |
"workflows": []. |
Edges whose source or target is not a node id in the file are dropped silently at this stage. The
block they pointed to then has no input and becomes an extra start block. Double-check edge ids.
2. Checking the workflow. After import the editor validates the workflow (the same check runs all the time while you edit):
- The header shows N problems, ▶ Run is disabled ("Fix the problems first") and turning the workflow on is refused with the list of reasons.
- Blocks with problems get a badge; click the block to see the messages in its settings panel.
| Message | Fix |
|---|---|
Unknown block type "x" |
Use a type from blocks.md. |
<Setting> is required |
Add the config key. |
<Setting> must be a valid http(s) URL |
Full URL with https://, or a {{template}}. |
<Setting> has an invalid choice |
Use one of the listed values for that key. |
<Setting> must be a number / must be at least …
|
Numbers as JSON numbers ("5" is also accepted). |
<Setting>: … (expression error) |
A broken {{ … }} expression. |
Schedule cannot take input from another block |
Schedule is the one block that only works at the start. Remove its incoming edge. |
Nothing can start this workflow: every block has an input. |
Remove a connection so one block has no input. |
This block can never run: no start block leads to it (warning) |
Connect it, or delete it. |
The "x" output is not in use, so its connection never runs (warning) |
sourcePort names an output the block does not have (e.g. error without onError: "port"). |
This workflow contains a loop. A run stops after 1000 blocks. (warning) |
Usually a mistake; use For Each / Repeat instead. |
Some checks only happen when the block runs, because they depend on other settings or on data: Assert
without a locator on an element check (Element is required for this check), Wait For text mode without
text, a page block with no Open Tab before it (No tab named "main" in this run. Put an Open Tab block (tab name "main") before this block.), a bad locator (Invalid role locator: …). These appear as a failed step
in the run. See Troubleshooting.
- Import the file and open it. Fix anything the editor flags.
- Press ▶ Run. Blocks light up ✓ / ✕ / ↪ as the run goes.
- Click the failed block: its settings panel shows the input and output of that run, and the error.
- Open Reports for the whole run: every step with status, duration, attempts, error, screenshot (taken on failure by default), and Export JSON for the full record.
- Fix the workflow (in the editor, or in the JSON and re-import) and run again.
To let an LLM fix its own workflow, give it the failing step's error text, or the exported JSON report, together with the workflow file. Two things to tell it:
- The run record names blocks by the new ids created on import, not the ids in its file. Match steps
by
blockTypeand order, or export the workflow again (the export has the current ids). - Error texts are written for people but are specific:
role=button[name="Save"] matches 2 elements (button#save, button.save-2). Make it more specific, or add ">> nth=0" for the first one.tells the model exactly what to change.
There is no API or CLI yet for a program to import, run and read results on its own; a person has to do the import and press Run. That loop is planned (see Roadmap).
BlockFlow's locators follow Playwright's, so a Playwright test usually translates step by step. Rows marked no equivalent yet have no block today; Run Script (your own JavaScript in the page, Chrome 135+) covers some of them.
| Playwright | BlockFlow |
|---|---|
const page = await context.newPage(); await page.goto(url) |
Open Tab open-url (url, tab name, where, waitUntil) |
page.goto(url) on an open page |
Navigate navigate, action: "goto"
|
page.goBack() / goForward() / reload()
|
Navigate action: "back" / "forward" / "reload"
|
page.waitForEvent('popup') |
Click, then Wait for Popup wait-for-popup; later blocks use "tab": "popup"
|
page.close() |
Close Tab close-tab
|
page.frameLocator('#pay').getByLabel('Card') |
locator frame=#pay >> label=Card
|
page.setViewportSize, emulateMedia, geolocation, locale |
no equivalent yet |
new browser context per test, storageState
|
no equivalent yet (runs share your browser profile) |
| Playwright | BlockFlow locator |
|---|---|
getByRole('button', { name: 'Save' }) |
role=button[name="Save"] ([exact] for exact) |
getByText('Sign in') / { exact: true }
|
text=Sign in / text="Sign in"
|
getByLabel, getByPlaceholder, getByTestId, getByAltText, getByTitle
|
label=, placeholder=, testid=, alt=, title=
|
locator('css'), locator('xpath=…')
|
the CSS itself, xpath=…
|
a.locator(b), .first(), .last(), .nth(n)
|
a >> b, >> nth=0, >> nth=-1, >> nth=n
|
filter({ hasText }), has, or, and, visible
|
no equivalent yet |
| Playwright | BlockFlow |
|---|---|
locator.click() / dblclick() / click({ button: 'right' }) / hover()
|
Click click, action: click / double / right / hover
|
click({ force: true }) |
Click force: true
|
click({ modifiers }), click({ position }), middle button |
no equivalent yet |
locator.fill(value) |
Fill fill
|
locator.pressSequentially(text), keyboard.type
|
Fill mode: "type"
|
several fills and a submit click |
Fill Form fill-form (fields, submit) |
locator.selectOption(label) |
Select Option select-option (text or value; a|b for multi) |
check() / uncheck() / setChecked()
|
Check check, state
|
locator.press('Enter'), keyboard.press('Control+A')
|
Press Key press-key (locator optional) |
setInputFiles |
Upload File upload-file (one file, from text or a URL) |
page.on('dialog', d => d.accept()) |
Dialogs dialogs, placed before the click that opens the dialog |
scrollIntoViewIfNeeded(), mouse.wheel
|
Scroll scroll (to: element, end, bottom, top) |
page.evaluate(fn) |
Run Script run-script (Chrome 135+, needs the userScripts permission) |
dragTo, focus, blur, clear, dispatchEvent
|
no equivalent yet |
isTrusted input (Playwright's input is always trusted) |
step setting "realInput": true (Chromium only) |
| Playwright | BlockFlow |
|---|---|
| auto-waiting before actions | built in: visible, enabled, stable, not covered, exactly one match |
locator.waitFor({ state }) |
Wait For wait-for, mode: visible / hidden / attached / detached / enabled
|
page.waitForURL(pattern) |
Wait For mode: "url" (contains, */** globs, /regex/) |
page.waitForLoadState('load' | 'networkidle') |
Wait For mode: "load" / "networkidle"
|
page.waitForResponse(url) |
Wait For mode: "response", url, status (201, 2xx). Status only, no body |
page.waitForRequest |
no equivalent yet |
page.waitForEvent('download') |
no equivalent yet |
page.waitForTimeout(ms) |
Timer after a block delays the flow, but this splits the run record and is not meant for tests; avoid it |
| Playwright | BlockFlow |
|---|---|
expect(l).toHaveText / toContainText
|
Assert assert, subject: "text", operator: "equals" / "contains" (also matches, starts-with…) |
toHaveValue |
Assert subject: "input"
|
toHaveAttribute(name, v) |
Assert subject: "attribute", name
|
toHaveClass |
Assert subject: "attribute", name: "class", operator: "contains"
|
toHaveCount |
Assert subject: "count"
|
toBeVisible / toBeHidden / toBeChecked / toBeEnabled / toBeDisabled
|
Assert subject of the same name (unchecked for not checked) |
expect(page).toHaveURL / toHaveTitle
|
Assert subject: "url" / "title"
|
expect(value).toBe(x) |
Assert subject: "value", value: "{{key}}"
|
expect.soft |
Assert soft: true
|
toBeFocused, toHaveCSS, toBeEditable, toBeInViewport, toHaveScreenshot, ARIA snapshots |
no equivalent yet |
textContent(), inputValue(), getAttribute(), count(), isVisible()
|
Read Element read-element with tab (no url), read: text / value / attribute / has-class / exists / count
|
page.title(), meta tags, context.cookies(), localStorage |
Page Info page-info (read only; setting cookies: no equivalent yet) |
page.screenshot() |
step setting "screenshot": "always" (visible tab only) |
| Playwright | BlockFlow |
|---|---|
request.get/post(...) |
HTTP Request http-request
|
page.route (mock, block, modify) |
no equivalent yet |
test.beforeEach login, shared helpers |
Run Workflow run-workflow calls another workflow in the same tab |
| parameterised tests | Data Table → For Each (see Recipes) |
test.retries |
per-block "step": { "retries": 2 }
|
try { … } catch |
"step": { "onError": "port" } and an edge with "sourcePort": "error"
|
page.pause() |
Manual Step manual-step
|
test.describe, projects, parallel workers, headless, CI |
no equivalent inside BlockFlow; export to Playwright for CI (below) |
Sidebar row or All workflows → 🎭 Playwright downloads <name>.spec.ts, a Playwright test you run
with npx playwright test. A workflow exported from the editor was run green this way in the Phase F
end-to-end test (see README).
What it does:
- One
test()per exported workflow. Every start block is walked in turn and written as statements. - Locators are translated to
getByRole,getByLabel,frameLocator,.nth()and so on. -
{{key}}and{{a.b[0]}}become reads from adataobject;{{secret.name}}becomesprocess.env.NAME(upper-cased). The header comment lists the environment variables needed. - If becomes
if/else; For Each, Repeat and Paginate become loops;onError: "port"with a connectederroroutput becomestry/catch. - Run Workflow becomes a call to a generated function for the called workflow.
- Helper functions (
read,compare,extractList,extractTable,setField…) are appended so the test keeps BlockFlow's behaviour.
Known limits (from src/core/playwright.ts):
| Not exported, or exported differently | What you get |
|---|---|
| Notify, Save to Dataset, Download, Transform, Filter, Dialogs, Upload File, Wait for Popup, Run Script | a comment // <Block>: no Playwright equivalent, skipped. Later steps that need their data will not get it. |
| Triggers (Timer, Schedule, Page Visited, Context Menu, Watch Element) | a comment; the test starts there. A Timer used as a delay mid-flow is also just a comment. |
Expressions in templates ({{ price * 1.1 }}) |
/* TODO expression */ '' |
Wait For mode: "response"
|
written as waitForLoadState('load'), which does not wait for the request. Fix by hand. |
Extract List from HTML (source: "html") |
a TODO comment |
Open Tab where (window, current tab, workflow tab) |
always context.newPage()
|
Read Element previous / changed
|
not available (no state between test runs) |
Assert on url, title, value or with operators other than equals/contains |
a one-off compare(...) check, without Playwright's retrying |
Step settings retries, timeoutSeconds, onError: "continue", realInput
|
ignored |
| Loops back to an earlier block | a comment (loop back … not exported)
|
| Data Table CSV | a simple comma split; quoted fields, semicolons and tabs are not handled |
{{$json.x}} and keys with dashes |
not translated correctly |
Treat the export as a strong first draft: read it, run it once, fix the TODOs.
- Recipes: task-by-task examples, each linked to an importable file
- Troubleshooting: what error messages mean and how to fix them
- Usage guide and block reference
- Concepts, Using the Editor
- Capabilities and Limitations
- Locators (internals of the locator engine)
Generated from docs/wiki in the repo by npm run wiki:publish. Edit the repo files, not this wiki.
Using BlockFlow
- What is BlockFlow
- Installing
- Getting Started
- Concepts
- Using the Editor
- Workflows as Scripts
- Recipes
- Capabilities and Limitations
- Troubleshooting
- Roadmap
Reference
Internals: engine
Internals: browser
Outside access (M4)
Internals: page and editor
Project