Ask an LLM agent to explore a web application and it will happily come back with a list of bugs. Then try to reproduce them.
Which page was it on? Which button did it click, and with which selector? Was that error real, or a misread of the DOM? Without answers, a bug report written by an AI is just an opinion, and developers are right to ignore opinions.
That is the real problem with AI-driven testing. Finding "bugs" is easy. Finding bugs a developer will believe is hard.
So I built Agentic Test Explorer around one rule: the agents think, but they never touch the browser. Everything they do goes through a deterministic engine that records it, and every bug ends up as a Playwright test you can run on your machine.
TL;DR
- Eight LangGraph agents, each playing a different kind of user, explore any web app configured with a small
config.yaml. - Agents emit JSON intents. A Playwright engine validates them, executes them and appends them to an immutable Action Tape.
- When an agent finds a bug, the tape is translated into a runnable
reproduction_*.spec.ts. - The engine rejects brittle selectors (XPath,
nth-child, positional chains) before they reach the browser. - A SQLite-backed memory remembers pages, flaky selectors and known bugs between runs, and can generate regression missions from them.
- Point it at a GitHub pull request and it writes test missions for the UI areas the diff touches.
The architecture in one picture
flowchart TD
M[Mission YAML or PR URL] --> S{Supervisor<br/>routing LLM}
S -->|next agent| A1[Persona agents<br/>ReAct loop]
A1 -->|JSON intent| E[Browser engine<br/>validate + execute]
E -->|DOM snapshot| A1
E --> T[(Action Tape<br/>JSONL)]
A1 --> SUM[Summarizer<br/>compacts history]
SUM --> S
S -->|FINISH| R[Report + .spec.ts + screenshots]
T --> R
It is a supervisor-worker swarm built with LangGraph. A supervisor decides which persona acts next; the persona runs a ReAct loop with its tools; a summarizer keeps the conversation bounded; control goes back to the supervisor until it decides the mission is done.
This is the actual graph for the standard swarm. I didn't draw it by hand: it is the Mermaid diagram that the tool's own Visual Mode generates, with the active agent highlighted.
stateDiagram-v2
new_user_agent : New User
power_user_agent : Power User
adversarial_user_agent : Adversarial
[*] --> Supervisor
Supervisor --> new_user_agent
Supervisor --> power_user_agent
Supervisor --> adversarial_user_agent
Supervisor --> FINISH
new_user_agent --> Summarizer
power_user_agent --> Summarizer
adversarial_user_agent --> Summarizer
Summarizer --> Supervisor
FINISH --> [*]
classDef active fill:#10b981,stroke:#047857,stroke-width:4px,color:#000
class power_user_agent active
Rule #1: the brain is not the hands
Agents get exactly one way to act on the page: the execute_browser_command tool, which takes a strict JSON object:
{"action": "fill", "selector": "input[aria-label='Search']", "value": "hello"}
Eleven actions are allowed: navigate, click, fill, press, select_option, hover, wait_for, scroll, extract_text, snapshot and check_page_health. Anything else is rejected with an error the agent can read. The raw Playwright toolkit tools are explicitly filtered out of every agent's tool list, so there is no back door.
For every command, the engine:
- Parses and validates the JSON.
- Checks the selector against the resilience policy (more on that below).
- Executes it with Playwright.
- Takes a fresh DOM snapshot.
- Appends an entry to the per-mission Action Tape, in memory and in
action_tape.jsonl. - Returns a plain-text block to the agent:
STATUS: ERROR
ACTION: click {"selector": "[data-test-subj='checkout']"}
DURATION_MS: 5012
ERROR: TimeoutError: ... (Recoverable — try a different selector or action.)
DOM_SNAPSHOT:
URL: https://app.example.com/cart
TITLE: Cart
SOURCE: accessibility_tree
* [0] role=button name='Update'
- [1] role=heading name='Your cart'
...
Errors are returned as text, not raised. That is what makes the agents self-healing: a failed click is just another observation, and the agent can try a different selector on its next step.
The check_page_health action deserves a mention: it scans the live DOM for visible error banners, role="alert" elements and spinners that never stop (aria-busy="true"), so "the page is quietly broken" becomes something an agent can detect.
What the agent actually "sees"
Feeding raw HTML to an LLM is slow, expensive and noisy. The engine builds a compact digest instead:
-
Primary: Playwright's accessibility tree. It already excludes scripts, styles and hidden nodes, so it is the smallest faithful picture of what a user can perceive. It is flattened to at most 150 elements, and the agent receives up to 80 of them, with interactive roles marked with
*. -
Fallback: a pruned JavaScript DOM walk that skips
script,style,svginternals and invisible elements, and keeps buttons, links, inputs,data-test-subjattributes and short visible text.
flowchart TD
P[Page] --> AX{Accessibility tree<br/>available?}
AX -->|yes| F1[Flatten tree<br/>max 150 nodes]
AX -->|no| JS[Pruned JS DOM walk]
F1 --> D[Digest for the LLM<br/>max 80 elements]
JS --> D
Rule #2: no brittle selectors, ever
LLMs love selectors like div > div:nth-child(3) > button. They work once and break with the next CSS change, and a reproduction script full of them is useless a week later.
So the engine refuses them before touching the browser. A regular expression catches XPath, :nth-child, :nth-of-type and bare positional div/span/li chains. These are real results from the validator:
| Selector | Verdict |
|---|---|
//div[@id='x']/button |
rejected |
div > div:nth-child(3) > button |
rejected |
ul > li:nth-of-type(2) |
rejected |
main > div > span |
rejected |
[data-test-subj='saveButton'] |
accepted |
button:has-text('Save') |
accepted |
role=button[name='Submit'] |
accepted |
The rejection message tells the agent what to use instead, in order of preference: data-test-subj, then aria-label, then visible text, then semantic role, and suggests taking a DOM snapshot to find a stable attribute.
From Action Tape to a runnable test
When an agent decides something is wrong, its instructions are to call two tools immediately: capture_bug_screenshot and generate_reproduction_spec. The second one translates the tape into Playwright code. For a tape like this one:
navigate https://app.example.com/cart
fill input[aria-label='Quantity'] = "-1"
click button:has-text('Update')
click [data-test-subj='checkout'] -> TimeoutError
the generator writes:
import { test, expect } from '@playwright/test';
test.use({ storageState: 'auth.json' });
test('reproduce: Checkout button disappears after negative quantity', async ({ page }) => {
test.setTimeout(120_000);
await page.goto('https://app.example.com/cart');
await page.fill('input[aria-label=\'Quantity\']', '-1');
await page.click('button:has-text(\'Update\')');
// FAILED AT RECORD TIME (kept to reproduce error): click {"selector": "[data-test-subj='checkout']"}
// Error: TimeoutError: locator not visible
await page.click('[data-test-subj=\'checkout\']');
});
(The URL and steps are an example; the generated lines are the real output of the translator for that tape.)
My favourite detail is the comment: failed steps are kept, annotated with the error seen at record time. The failure is the reproduction, so dropping it would defeat the purpose.
Eight ways to use (and abuse) your app
Each agent is the same ReAct loop with a different system prompt. The mission's thread_id decides which swarm runs:
| Swarm | Persona | What it tries |
|---|---|---|
| Standard | New User | Onboarding, discoverability, default and empty states |
| Standard | Power User | Keyboard shortcuts, bulk operations, advanced filters, chained workflows |
| Standard | Adversarial User | Invalid input, injection-like strings, rapid clicks, back-button abuse |
| Advanced | Accessibility | Keyboard-only navigation, labels, WCAG issues |
| Advanced | Data Heavy | Large inputs, long strings, many records |
| Advanced | Impatient | Cancelling mid-flight, refreshing during submissions, double clicks |
| Advanced | Returning User | Stale sessions, cached pages, old bookmarks |
| Advanced | Explorer | Open-ended exploration and cross-feature regressions |
A mission is just YAML:
missions:
- thread_id: test_adversarial_user_01
prompt: 'Persona: adversarial_user_agent
Test <APP_URL> adversarially. Enter malformed strings, manipulate the URL parameters
manually, abuse the browser back/forward buttons constantly, and check if the
app degrades securely without exposing sensitive info.'
Keeping a swarm on a leash
Multi-agent systems fail in boring ways: they loop, they forget the goal, or they blow up the context window. Most of the code in the orchestration layer is about preventing that.
Routing is structured. The supervisor doesn't free-text its decision. It uses structured output with a JSON schema whose next field is an enum of the agent names plus FINISH, so it cannot route to an agent that doesn't exist.
The supervisor reads a brief, not the whole transcript. Before each decision it gets a bounded summary: the mission, the last 12 progress lines, the last 10 browser actions, up to 8 bugs found and up to 8 explored URLs. That is enough to pick the next worker, and it doesn't grow with the length of the mission.
A step limit forces diversity. After --max-steps cycles (30 by default), the supervisor injects a reset directive: "Navigate back to {app URL}, reset state, and pick a COMPLETELY DIFFERENT area of the application. Do not repeat any interaction already tried." It includes the list of areas already explored.
History is compacted without an LLM call. After every agent turn, a Summarizer node keeps the original mission and the 20 most recent messages, and replaces everything in between with a one-message textual digest. The state also keeps only the last 50 tape entries; the full tape lives in the JSONL file.
flowchart TD
A[Agent turn ends] --> B{More than 21 messages?}
B -->|no| S[Supervisor]
B -->|yes| C[Keep mission + last 20 messages]
C --> D[Replace the middle with<br/>a compact text summary]
D --> S
S --> E{Step limit reached?}
E -->|yes| F[Inject reset directive:<br/>go home, explore a new area]
E -->|no| G[Route to next agent or FINISH]
F --> G
Counting bugs is harder than finding them
An unexpected amount of work went into a question that sounds trivial: how many bugs did we find?
Agents describe the same finding in three different shapes: a snake_case slug in the screenshot tool, a structured entry in their closing message, and prose like "BUG FOUND: Empty cart lacks messaging." Counting all three triples the number.
The fix has two parts. First, a contract in the system prompt: every agent must finish its turn with a <bugs_found> block containing one JSON object per issue (title, summary, location, severity), or an explicit empty list. Second, a deduplication step that normalises each entry to a lowercase title key and treats two entries as the same bug when one key is a prefix of the other and the shorter one has at least 12 characters. "Login error" and "Login redirect" stay separate; three phrasings of the empty cart issue collapse into one.
Memory: the second run is smarter than the first
Exploration without memory is groundhog day: every run rediscovers the same pages and trips over the same flaky selectors. The framework keeps a LangGraph store in SQLite, namespaced by a hash of the app URL:
flowchart TD
R[Mission run] --> SEM[Semantic memory<br/>pages, selector reliability, quirks]
R --> EPI[Episodic memory<br/>session summaries, bug catalog]
EPI --> PRO[Procedural memory<br/>LangMem prompt optimizer]
SEM --> RISK[Risk-ranked pages<br/>for the supervisor]
EPI --> RISK
EPI --> REG[--regression<br/>missions from known bugs]
PRO --> NEXT[Prompt supplements<br/>for the next run]
- Semantic memory tracks every page visited, the success and failure count of every selector, and application quirks.
- Episodic memory stores a summary of each session and a bug catalog, deduplicated with a fingerprint of page plus summary, that counts how many sessions have seen each bug.
- Procedural memory runs after a batch of missions: LangMem's prompt optimizer reviews the session trajectories and writes prompt supplements for the agents and routing rules for the supervisor, which are injected on the next run.
The supervisor also receives a list of high-risk pages, scored with a simple formula: twice the number of times a bug was seen there, plus confirmed quirks, plus 1.5 times the selector failures. And --regression turns the bug catalog into missions, one per page with open or recurring bugs: "Verify whether these bugs still exist and look for related regressions."
Test what the pull request changed
Exploring a whole application on every PR is wasteful. With --pr-url, the framework fetches the PR (through the GitHub MCP server if configured, otherwise the gh CLI) and asks the LLM to act as a test architect and write 3 to 8 missions for the UI areas the diff is likely to affect.
agent-explorer --pr-url https://github.com/org/repo/pull/123 --execute --headed
Two details keep this from turning into a prompt-size problem or a hallucination problem:
- Diff budgeting. The prompt gets at most 40,000 characters of diff. For large PRs, each file gets its own slice with its headers and changed lines, so one huge generated file can't eat the whole budget. If the memory store has historical bugs for the app, they are added to the prompt.
-
Output validation. The generated YAML is rejected unless every mission has a
thread_idnamespaced to the PR (pr_123_...), targets an existing persona, and keeps its prompt under 1,200 characters.
Watching it work
Running with --visual launches a Streamlit dashboard that polls the agent state every second. It shows the live browser screenshot, the stream of agent thoughts, the bugs found so far and the swarm diagram above with the active node highlighted, which makes it easy to see where a mission is spending its time.
Every mission also leaves a report folder:
report_<thread_id>/
├── traces.log # every thought, plan and tool call
├── test_report.md # executive summary: objective, actions, bugs, PASS/FAIL
├── action_tape.jsonl # every browser command, in order
├── reproduction_*.spec.ts # one Playwright test per bug
└── screenshots/ # evidence for each bug
Bring your own app, model and knowledge
-
Any web app. A
config.yamlwith the app name, URL, description and auth settings, plusagent-authto save a logged-in session. -
Claude or Gemini. The provider is detected from the credentials available, or forced with
--provider. -
MCP servers listed in
mcp_servers.jsonbecome tools the agents can query for domain knowledge, such as API specs or documentation. -
Agent Skills under
AGENT_SKILLS_ROOTare exposed automatically, including running their scripts with a timeout.
The agents are told to use all of this with progressive disclosure: start with the mission and the current page, and only fetch extra context for the specific feature under test.
Lessons from building it
- Separate deciding from doing. The LLM chooses; deterministic code executes and records. Every trustworthy property of the system (reproducible specs, selector policy, audit trail) comes from that split.
- Make errors observations. Returning failures as text lets agents recover on their own, and keeps the failure on the tape for the reproduction.
- Bound everything. Snapshots, history, routing context, diffs, the tape kept in state. Long missions fail because context grows, not only because models make mistakes.
-
Specify the output of agents like an API. The
<bugs_found>contract and the PR mission validator turn free text into data the rest of the system can trust. - Test the framework itself. The repository has 115 unit tests covering the engine, bug extraction, PR analysis, config and the dashboard state.
Try it
git clone https://github.com/srbarrios/agentic-test-explorer.git
cd agentic-test-explorer
pip install -e .
playwright install chromium
cp config.yaml.example config.yaml # point it at your app
agent-auth # save an authenticated session
agent-explorer --missions missions/new_user_agent.yaml --headed
There is a demo video in the README, and the architecture guide walks through the LangGraph concepts behind every part of the code.
👉 Code (MIT): github.com/srbarrios/agentic-test-explorer
If you are an SDET or a QE engineer experimenting with agents: what would make you trust a bug report written by an AI? I'd love to hear it in the comments, and issues and pull requests are welcome.
Originally published at oscarbarrios.tech.
Top comments (15)
To answer your question: I trust an AI bug report when it ships with something that replays without the model, which is exactly what your Action Tape and generated spec do. Rejecting positional selectors before they reach the browser is a good rule too. For the cheap, no-LLM end of the same idea, a deterministic crawl that opens every route at three viewports and fails on console errors, 5xx responses and horizontal overflow gives you reproducible findings with zero agent judgment, and works as a pre-pass before the persona swarm spends tokens. We open sourced ours: github.com/avivgerz-hue/ghost-qa
Thanks! "Replays without the model" is exactly the bar I was aiming for. A deterministic pre-pass is a good idea: console errors, 5xx responses and overflow are cheap to detect and need no agent judgment, so the persona tokens only get spent once that pass is clean. Today the engine only has a
check_page_healthaction for visible error banners and stuck spinners. I'll take a look at ghost-qa to see how a pre-pass like that could sit in front of the swarm.One thing I'd change in the generated spec: the failing step is a plain click, so the test can sit until the 120 s test timeout before it fails. Turning that last step into an assertion, like expect(page.getByTestId('checkout')).toBeVisible(), fails in about 5 s with a message that says what was missing. It also gives you a regression test for free. Once the bug is fixed the spec passes and can go straight into the suite. Setting testIdAttribute to data-test-subj in the Playwright config makes getByTestId match your selectors. Do you plan to keep the reproduction specs after the fix, or throw them away?
Well, I guess this gonna depends on how the team works and how they want to use this tool. But keeping in mind this tool has been designed for a exploratory test phase, I'd just use it to catch bugs during development, so in most cases in does not make sense to keep the steps to reproduce it once it's fixed.
Keeping the failed step in the tape is useful. I'd also replay the generated spec in a clean session and distinguish a reproduced failure from a setup failure: an expired auth.json or missing fixture can produce a timeout before the reported bug is reached. Recording the app revision and initial test data alongside the tape would make that distinction easier.
Really useful, thank you. You're right, and it's a gap today: the spec uses
storageState: 'auth.json'and the tape doesn't record the app revision or the starting data, so a timeout from a stale session looks the same as the reported bug. I'll look into recording both in the tape header, and into running the spec once in a clean session before reporting, so a reproduced failure can be told apart from a setup failure.For me, two things. The report quotes the exact value it saw and where on the page it read it, next to what it expected; a bug with no observed value is an opinion. And it says "couldn't tell" instead of rounding up. Does your engine record what the persona saw at the failing step, or only the steps to reproduce?
Fair question, and the honest answer is: partly. Each tape entry stores the action, the result text (for
extract_text, up to 4,000 characters), the error, and the page URL and title; bugs also get a full-page screenshot. The DOM snapshot the agent reasoned from isn't persisted, and a bug report doesn't carry an "observed vs expected" pair or a "couldn't tell" verdict. I'll study how to add both, since they're good requirements. Thanks for putting them so clearly.When a saved auth.json session expires mid-mission or hits a login step that requires 2FA, can a tester step into the live browser to re-authenticate without discarding the current Action Tape?
Not live, no... But if the saved auth.json expires, the run now detects the login redirect, stops at a safe point (exit 130) and tells you to re-run agent-auth. Then it resumes from the checkpoint with the tape intact.
Thanks for the detail on detecting the login redirect, exiting with code 130 at a safe checkpoint to re-run agent-auth, and resuming with the Action Tape intact, I'm building Bumblebeez (hosted BrowserBox cloud browsers over MCP) so an agent run can also hand a direct live viewer link to a tester when a session hits an interactive login or 2FA step and resume in that same remote browser: bumblebeez.ai/go/forum-20261126-de...
Here's a small case for rule #1 from the hands side. I once typed a reply on X while the text box hadn't taken focus, so the page read the sentence as keyboard shortcuts: n opened a new post, g then e jumped to Explore. Nothing got liked or muted, and that was luck, since l and u are exactly those. What I meant to do and what the page did were two different things, and nothing recorded the second one. Now I check where the focus is before typing and read the field back before sending. Your tape records the effect instead of the intent, which is the part I was missing.
That's a great real-world example, thanks for sharing it. One precision: the tape records the command the agent sent, its result or error, and the resulting page URL and title. The engine also targets elements by selector (
fillandpressboth take one), so typing can't land on whatever happens to have focus. The gap you describe between what you meant and what the page did is exactly why I wanted that record.The 80-element cap is the part I'd test before trusting a generated spec. The digest shows the agent at most 80 elements from a tree of 150, and a failed click comes back as text so the agent can try another selector. The tape records a data-test-subj click the same way whether that element was in the digest or chosen after a miss. I'd add one line on the failing entry: elements in the full tree, elements the agent was shown, and whether the target was in that set. If it wasn't, the spec replays a selector the model never saw. Do you drop those actions, or does the tape treat them like the ones it was shown?
AI helped draft this comment.
what does a persona do with an icon button that has no test id, no aria label and no text? logging that as an accessibility bug instead of skipping it would be a fun side effect