# Understudy An understudy learns a part by watching once, then performs it exactly, and never improvises. That is discovery and replay in this project: a language model drives a real browser once to work out how to do something in an application with no API, the successful run is recorded as a typed, versioned capability, and every later invocation replays that capability deterministically, with no model anywhere in the decision loop. ## Setup Requires Python 3.11, pinned deliberately: the machine default on a recent install is often newer, and part of this stack does not have wheels for it yet (docs/adr/0001). Which command reaches 3.11 depends on how it was installed; run py -0 on Windows or python3.11 --version anywhere to see which of the three below applies. If python --version reports anything other than 3.11.x, install 3.11 separately and point the venv creation step at it. ```bash python3.11 -m venv .venv # if `python3.11` is on your PATH # py -3.11 -m venv .venv # Windows, if 3.11 is registered with the py launcher # python3 -m venv .venv # if python3 already reports 3.11.x .venv/Scripts/pip install -e ".[dev]" # Windows # .venv/bin/pip install -e ".[dev]" # Linux/macOS .venv/Scripts/playwright install chromium # Windows # .venv/bin/playwright install chromium # Linux/macOS copy .env.example .env # Windows # cp .env.example .env # Linux/macOS ``` There is no console script this project installs; `pyproject.toml` declares no `[project.scripts]` entry point. Every command below runs as a module: ``` .venv/Scripts/python.exe -m understudy.cli # Windows .venv/bin/python -m understudy.cli # Linux/macOS ``` **Every example in this file uses the Windows venv path, `.venv/Scripts/python.exe`. On Linux and macOS substitute `.venv/bin/python` throughout.** Nothing else changes except the `--params` quoting, which is shown per shell at every example that passes JSON. `.env` holds two things that matter. `GEMINI_API_KEY` is required only for `discover` (and for `record` when it wants to name the capability with a real model call instead of falling back to the goal text). `GEMINI_MODEL` selects which model runs discovery and defaults to `gemini-3.1-flash-lite`; the free tier is 20 requests per day, per model, and one discovery run costs 8 to 9 requests, so switching the model opens a fresh daily budget if you run out (`docs/adr/0003`). Nothing else in `.env.example` needs changing to run the demo path below. ## Running without live services Everything except `discover` runs with no API key and no network access at all. **The fixture app** is a local Flask process, not a hosted service. Start it in its own terminal: ```bash .venv/Scripts/python.exe -m fixtures.legacy_bank --port 5055 ``` It serves `http://127.0.0.1:5055`, deliberately built as a hostile legacy back office: an HTML 4.01 frameset, no ARIA, no `