# Try Agent First Browse: local perception audit

24 November 2026 · 25–35 minutes · **Source-reviewed / not executed**

## Goal and benefit

Compare the project's legacy and V2 browser observation engines with three local synthetic scenarios. Test whether V2 removes occluded controls, compresses a changed form and recovers a reference after a re-render. This tests perception and fixture recovery, not autonomous agent success or security.

## Prerequisites and cost

Python 3.11+, Git, pip, Chromium via Playwright, Linux/macOS/WSL and a disposable environment. Internet only for fetching public source, dependencies and browser. No model keys, subscriptions or paid inference. Review dependencies and source before running; run as an unprivileged user with no mounted secrets, personal browser profile or sensitive files. Disable outbound network after setup if possible. Do not run the autonomous mode, live URLs or real-site actions.

## 1. Pin the source

The repository was created 14 April; its older v1.0.0 tag is not the same as this November revision. Pin the actual reviewed commit.

```sh
git clone https://github.com/SandeepAi369/Agent-first-browse.git
cd Agent-first-browse
git checkout --detach 01f358a22f6c61103936d42928e721b563cb53b9
git rev-parse HEAD
```

Review LICENSE, pyproject.toml and scripts/benchmark_v2_vs_legacy.py. The local suite uses page.set_content for its synthetic fixtures. Do not use real credentials. Stop if the checked-out source differs.

## 2. Prepare an isolated environment

```sh
python3 -m venv .venv
source .venv/bin/activate
python -m pip install -e .
python -m playwright install chromium
python -m pip freeze > dependency-versions.txt
```

Install only after reviewing dependencies. If browser system libraries are missing, use a disposable supported environment with those prerequisites. No need to create an .env file or configure a model.

## 3. Run the local suite three times

```sh
mkdir -p audit-results
for n in 1 2 3; do
  python scripts/benchmark_v2_vs_legacy.py --suite local \
    --json-out "audit-results/run-$n.json" || break
done
```

The reviewed script defaults to headless Chromium and produces three paired rows (local:modal_occlusion, local:spa_form_step1_full, local:spa_form_step2_delta), plus stale_ref_test. Expect a comparison table and JSON, not specific numerical results. Do not use --urls or --e2e.

## 4. Score the results

Freeze the following expectations before reading output. Mark missing fields or failures as failures, not zero latency.

| Check | Evidence in JSON | Pass criterion |
| --- | --- | --- |
| Modal pruning | V2 occluded_filtered in modal row | Greater than zero |
| Delta mode | V2 snapshot_kind in second form row | Delta |
| Smaller form update | V2 vs legacy est_tokens in second form row | V2 lower |
| Stale reference recovery | stale_ref_test.v2_clicked_rerendered_button | True |

For each run, score 0–4 and report all failures. Use the same environment and viewport for both engines. Record median total_ms by scenario over the three repeats. Report the estimated token savings separately from latency and never translate the estimate directly into billing savings. Check whether the intended visible control remains available; if uncertain, inspect the fixture and the underlying snapshot output, rather than assuming pruning is correct.

```python
import json
from pathlib import Path
from statistics import median
latencies = {}
for p in sorted(Path("audit-results").glob("run-*.json")):
    j = json.loads(p.read_text())
    rows = {r["scenario"]: r for r in j["scenarios"]}
    m = rows["local:modal_occlusion"]["v2"]
    f = rows["local:spa_form_step2_delta"]
    s = j["stale_ref_test"]
    checks = [
        m["occluded_filtered"] > 0,
        f["v2"]["snapshot_kind"].lower() == "delta",
        f["v2"]["est_tokens"] < f["legacy"]["est_tokens"],
        s["v2_clicked_rerendered_button"] is True,
    ]
    print(p.name, sum(checks), "/4", checks)
    for k, row in rows.items():
        for mode in ("legacy", "v2"):
            latencies.setdefault((k, mode), []).append(row[mode]["total_ms"])
for k, vals in latencies.items():
    print(k, "median ms", median(vals), "n", len(vals))
```

Save the snippet as score.py and run python score.py. Require three complete reports for a full comparison; if fewer complete, label the result partial.

## Troubleshooting

- Import error: verify the active venv and editable install; record dependency versions rather than guessing.
- Missing Chromium binary: run the documented playwright install command in the same venv. If system dependencies are missing, stop and use a supported isolated environment.
- Timeout or absent JSON: record the error and stop after three total attempts. Do not substitute a live website.
- No delta or stale recovery: retain the negative result and check snapshot_kind, browser version and fixture state.

## Interpretation and limits

A passing fixture demonstrates only the checked behavior of this pinned version. Three repeats are a smoke test, not a statistical performance claim. The comparison order is fixed in the project script; warm-cache and setup effects may bias timing. Estimated token counts are not actual model usage. An end-to-end follow-up would need held-out pages, task success, action correctness and repeated runs with matched models and budgets.

**Validation:** source reviewed, not executed. No installations, browser sessions, model calls or benchmark runs performed for this edition.

Primary source: https://github.com/SandeepAi369/Agent-first-browse/blob/01f358a22f6c61103936d42928e721b563cb53b9/scripts/benchmark_v2_vs_legacy.py
