Skip to content

Usage

Minimal usage example (standalone harness)

Export your API key, then call the CLI. This example uses the OpenAI backend to search Google Flights:

bash
export OPENAI_API_KEY=sk-...

python -m webwright.run.cli \
    -c base.yaml -c model_openai.yaml \
    -t "Search for flights from SEA to JFK on 2026-08-15 to 2026-08-20" \
    --start-url https://www.google.com/flights \
    --task-id demo_openai \
    -o outputs/default

To use Anthropic instead, swap the config file and key:

bash
export ANTHROPIC_API_KEY=sk-ant-...

python -m webwright.run.cli \
    -c base.yaml -c model_claude.yaml \
    -t "Search for flights from SEA to JFK on 2026-08-15 to 2026-08-20" \
    --start-url https://www.google.com/flights \
    --task-id demo_claude \
    -o outputs/default

CLI flags

FlagDescription
-cConfig file(s) from src/webwright/config/ (stackable, applied left to right)
-tTask instruction in natural language
--start-urlInitial URL the browser opens
--task-idName for the output subfolder
-oOutput directory root

Output artifacts

Each run writes to <output>/<task-id>/:

  • final_script.py - the complete, re-runnable Playwright script for the task
  • trajectory.json - full agent trajectory with tool calls and observations
  • final_runs/run_<id>/ - screenshots captured during the run
  • raw_responses.jsonl - raw model responses (loadable in the trajectory viewer)

Usage as a Claude Code plugin

After installing the plugin and restarting Claude Code, invoke Webwright in plain English or with slash commands:

text
/webwright:run search Google Flights for flights from SEA to JFK on 2026-08-15 to 2026-08-20
text
/webwright:craft search a ticket on Google Flights from LAX to SFO depart June 7 return June 14

/webwright:run produces a one-shot final_script.py for the exact task values.

/webwright:craft produces a reusable parameterized CLI tool. The resulting script accepts argparse flags so you can rerun it with different values:

bash
python final_script.py --origin JFK --destination LAX --depart-date 2026-07-01

Task Showcase (optional web dashboard)

To render task results in a Flask dashboard, add the task_showcase.yaml overlay:

bash
pip install flask

python -m webwright.run.cli \
    -c base.yaml -c model_openai.yaml -c task_showcase.yaml \
    -t "Find the cheapest direct flight from BOS to LAX next Friday" \
    --task-id my_task \
    -o outputs/default

python assets/task_showcase/app.py \
    --tasks-dir outputs/default/my_task/task_showcase/tasks

Open http://127.0.0.1:5005 in your browser.