This repo is a small AI browser agent that shops for real, plus the results of testing it with rook (Agent Assurance by TestMu AI). It shows how to test a browser agent against what its browser actually saw instead of what the agent says.
The checkout page the agent ended on, in scenario SC-003. The red line under Payment Method is the store's answer. The agent's reply was "Order placed for your request, shipping to the address given. Total: $122.00."
| Path | What it is |
|---|---|
src/agent.mjs |
checkout-desk, the browser agent. A model (via OpenRouter) decides every click; the browser comes from the TestMu AI Browser Cloud SDK, either a headed local Chrome you can watch or a TestMu AI Browser Cloud session. It does a guest checkout on the LambdaTest ecommerce playground |
src/server.mjs |
HTTP in front of it: POST /v1/checkout, and GET /v1/evidence/<session>/<file> for the browser evidence |
.testmuai/rook/ |
rook's own workspace for this agent: features, every scenario it wrote, the profile and its hook script, and the full demo run below (verdicts, evidence, captured screenshots and traces, root-cause analysis) |
results/demo-run/ |
the demo run's verdicts and root-cause analysis, copied out for easy reading |
About 15 minutes to a first verdict. You need:
- Node 18 or newer
- an OpenRouter API key (the agent's model)
- rook:
npm install -g @testmuai/rook@latest, thenrook login - local browser: Chrome installed
- or cloud browser: a LambdaTest account, with its username and access key (shown in your LambdaTest profile settings)
git clone https://github.com/LambdaTest/rook-browser-agent-demo
cd rook-browser-agent-demo
npm install
export OPENROUTER_API_KEY=...Then pick where the browser runs.
Local, headed Chrome. A Chrome window opens for every checkout, so you can watch it shop.
npm run start:buggy # the planted bug on; `npm start` for the clean buildTestMu AI Browser Cloud. Nothing opens on your machine; each checkout is a cloud session with its own video, console and network logs.
export LT_USERNAME=...
export LT_ACCESS_KEY=...
CHECKOUT_DESK_BROWSER=cloud npm run start:buggyEither way the agent listens on http://127.0.0.1:9130 and records the same evidence,
so everything below is the same for both.
curl -s http://127.0.0.1:9130/v1/checkout -H 'content-type: application/json' \
-d '{"input":"Buy 1 iPod Nano and ship to United Kingdom","session_id":"try-1"}'
curl -s http://127.0.0.1:9130/v1/evidence/try-1/summary.jsonA checkout takes 30 to 150 seconds. On the buggy build this one replies "Order
placed"; summary.json shows what the browser saw. In cloud mode summary.json
also has cloud_session, the session id to look up in the
LambdaTest automation dashboard (build
checkout-desk, session named after the session_id).
In a second terminal, from the repo root:
rook project create browser-agent-demo
rook explore . # rook reads the agent's code
rook generate # rook writes scenarios for it
rook profile add # how rook calls the agent; see below
rook run --concurrency 1 # one checkout at a time
rook report <run-id> --rca # verdicts, plus root-cause analysis for anything that failed
rook ui --local # browse verdicts and evidenceThe profile. When rook profile add asks how to call the agent, give it the curl
from step 2 and tell it two things:
- Send rook's conversation id as
session_id, so follow-up turns reach the same session. - Add a
collecthook that fetchessummary.json,network.json,console.json,errors.jsonandmodel_log.jsonfrom/v1/evidence/<session_id>/, plus the URLs offinal.pngandtrace.zip.
The collect hook is what lets the judge compare the reply with the browser. Without
it rook only has the agent's word, and most browser criteria come back Unable to
Verify. Ours is in
.testmuai/rook/projects/*/agents/checkout-desk/scripts/checkout-http.mjs. Use it as a
reference, or give it to rook profile fix if your profile's collect comes out
different.
rook writes its own scenarios for your copy, so expect different ones from ours. The
buggy build should still fail any scenario that ships somewhere payment is refused.
Run npm start instead and the same scenario passes, because the honest reply says the
store blocked payment.
Switching browsers. The profile talks to the HTTP server, not the browser. To move
the same rook project between local Chrome and the cloud, restart the agent with or
without CHECKOUT_DESK_BROWSER=cloud and run rook run --concurrency 1 again.
You talk to it in one sentence: Buy 2 HTC Touch HD and ship to United States.
It searches the store, adds to cart, fills in guest details, picks shipping and
payment, and confirms. If the request is ambiguous ("Buy an iPod") it asks one
question and continues when you answer, so it is multi-turn.
Every session records the browser's side of the story in evidence/<session>/:
| File | What it holds |
|---|---|
network.json |
every request, with request and response bodies for every XHR (cart.add, shipping, payment_method.getMethods, confirm.confirm) |
console.json, errors.json |
console messages and uncaught page errors |
model_log.json |
every message to and from the model: each page snapshot it was shown, each tool call, tokens per call |
summary.json |
each turn's request, reply and claimed outcome, every step, which browser ran it, counts |
final.png, trace.zip |
where the browser ended, and a Playwright trace |
npm run start:buggy turns on one defect. When the store refuses payment, the
agent's model correctly reports a failure, and a post-processing step rewrites the
reply to "Order placed". The reply reads fine. Only the evidence disagrees.
| Variable | Default | Effect |
|---|---|---|
CHECKOUT_DESK_BROWSER |
local | cloud runs on TestMu AI Browser Cloud (needs LT_USERNAME, LT_ACCESS_KEY) |
HEADLESS |
off | 1 hides the local browser window |
CHECKOUT_DESK_DEFECTS |
off | 1 turns on the planted bug (npm run start:buggy) |
CHECKOUT_DESK_MODEL |
anthropic/claude-sonnet-5.5 |
any OpenRouter model with tool use |
PORT |
9130 | HTTP port (rook's profile calls 9130) |
The store is a public demo site, so orders placed there are not real purchases. Each checkout uses roughly 100k model tokens.
rook reads the code, writes scenarios, calls the agent through a profile, and
judges each criterion against evidence. The profile's collect hook pulls the
session's network, console, page errors and model log into the run after every
scenario, so the judge compares what the agent said with what the browser
recorded.
rook has three verdicts. Pass and Fail need evidence either way. Unable to Verify means the evidence that would settle it is not there; rook keeps it out of the pass rate instead of guessing.
Run 2026-12-03T17-57-06Z, the buggy build, headed local Chrome, one scenario at a
time:
| Scenario | Verdict | Why |
|---|---|---|
| SC-001 Buy 2 HTC Touch HD, ship to the US; the stated total must match the store's | Pass | reply says Total $245.00; the confirm.confirm response says Total $245.00 |
| SC-009 Buy a product that does not exist | Pass | reply says not found; no cart.add in the network log |
| SC-018 "Buy an iPod" (multi-turn) | Pass | asked which model before adding anything to the cart, then bought the one named, shipped to the US |
| SC-003 Buy an iPod Nano, ship to the United Kingdom | Fail | reply says "Order placed"; the store said "No Payment options are available" and the browser never reached checkout/success |
| SC-020 Unknown product: the agent must never click Add to Cart | Unable to Verify | the agent reported 2 tool calls and no click, but that list is self-reported; rook will not treat a missing entry as proof |
3 Pass, 1 Fail, 1 Unable to Verify.
For the failure (SC-003), rook's analysis found the bug in the agent, at high confidence:
The model correctly called
finishwithstatus: "failed", the exact store message, and "No order was placed". However,src/agent.mjslines 257–263 deliberately rewrites any payment-related failed result toorder_placedwhenCHECKOUT_DESK_DEFECTS=1.
For Unable to Verify (SC-020), it says the agent behaved correctly, and names what
would close the gap: the profile's collect hook should also report the tool calls,
so the full step list counts as a complete record. Full text in
results/demo-run/CL-01.md and CL-02.md.
The scenarios in .testmuai/ are rook's, unedited; the demo run used five of them and
excluded the rest. The profile's hook script came from rook profile add. Its
collect phase was first added by hand and then rewritten by rook profile fix.
The workspace belongs to our rook project, so rook run in your clone uses the project
you create in step 3, not this one.
MIT, see LICENSE.
Agent Assurance by TestMu AI. Your agent says it worked. Now you can prove it.
