This example records one form fill in a small expenses app, compiles it with
openadapt-flow, and serves it to Claude Code as an MCP tool through
openadapt-agent. Claude Code
passes a description and an amount. OpenAdapt fills in the form in a headless
browser, with no model calls, and then reads the app's SQLite table itself. The
tool returns success only when exactly one new row with those two values is
there.
You need macOS or Linux, Python 3.10 to 3.12 (or uv), and Claude Code for the last step. The OpenAdapt side makes no model calls and needs no API key.
./demo.sh # install, start the app, record, compile
claude --mcp-config mcp.json # then ask: Add an 18.75 expense for parking
./demo.sh rows # the newest rows, read from SQLiteThe first ./demo.sh installs openadapt-flow[browser]==1.35.1 and
openadapt-agent==2.0.1 into .venv and downloads Chromium for Playwright
(about 150 MB). After that, a rebuild takes about 15 seconds. The app listens
on port 8642 (set PORT to use another one) until ./demo.sh down.
To record the demonstration yourself in a visible browser, run
./demo.sh --by-hand. To send one prompt without the interactive session, run
./demo.sh ask "Add an 18.75 expense for parking".
app.pyserves a form athttp://127.0.0.1:8642/and writes each expense towork/expenses.db. It uses only the Python standard library and knows nothing about OpenAdapt.build.pyfills in the form once in a headless browser, through Flow's recorder (--by-handlets you do it instead). While it records, it reads theexpensestable (read-only) to see which row the save added.- The compiler turns the recording into a 5-step program with two parameters,
descriptionandamount. From the row it saw appear, it proposes a check with the recorded values ("Team lunch", "42.50") written in.effect_contract.yamlreplaces that proposal with a reviewed check that uses the parameters: after the click on Add expense, exactly one new row must have the given description and amount. openadapt-flow certifychecks the program againstpolicy.yaml. Before each click, the program checks that the target still matches the recording. For Add expense, that includes the "Filed under Dana Demo, Engineering" text next to the button.mcp.jsonstartsopenadapt-agent serve, which exposes arun_workflow_<id>tool withdescriptionandamountparameters, plus read-only tools such asget_run_report. Each call runsopenadapt-flow run, which fills in the form and then runs the SQL check. In our runs, the browser part took about 12 seconds per call.
./demo.sh break # the app keeps saying "Expense saved." but writes nothing
claude --mcp-config mcp.json # ask for another expense
./demo.sh rows # no new row
./demo.sh fix # back to normalThe page shows the same success banner, so a check that reads the screen would
pass. The SQL check finds no new row, so the tool returns halt instead of
success.
| File | What it is |
|---|---|
app.py |
The expenses app (standard library and SQLite) |
build.py |
Records, compiles, attaches the SQL check, certifies, and writes mcp.json |
effect_contract.yaml |
The reviewed check that runs after the save |
policy.yaml |
The rules the compiled program must pass before it runs |
demo.sh |
Installs, starts and stops the app, and runs the build |
demo.tape, halt.tape |
VHS scripts for the two recordings |
Everything the scripts create goes into work/, .venv/, and mcp.json.
./demo.sh clean removes them. In an openadapt-flow checkout, run it before
scripts/check_release_consistency.py, which rejects those generated files.
- The runs use Flow without an execution profile. The Standard profile also needs a signed qualification for the workflow, which this local demo doesn't create.
mcp.jsonpasses--allow-protected-export, so Claude Code can read the full local run report, including the typed values. The data here is made up. Without that flag the tool returns only the status and step counts.- The bundle isn't encrypted at rest (
--allow-unencrypted). - The SQL check compares text. The app stores the amount as typed, so
42.5and42.50are different values. - In our tests, a restyle that changed only colors and borders still ran. One that also renamed the form's element ids halted at the first click. Record again after a change like that.
- Whether Claude Code asks before it calls the tool depends on your permission mode. The recordings used auto mode, which allowed the call.
- Tested on macOS (Apple silicon) with Python 3.12, openadapt-flow 1.35.1, openadapt-agent 2.0.1, and Claude Code 2.1.299.
To make new recordings after ./demo.sh, run vhs demo.tape and
vhs halt.tape.
Flow 2 asks a person to approve each save by default. When Claude Code calls the tool, the result is needs_review with the reason waiting_for_approval until someone approves on this computer (openadapt-flow item-approval show <run_dir>, then approve). The recordings above were made with Flow 1.35, before that default. To run the demo unattended, as they show, start the server with --approval-mode not_gated. The run report records that choice.

