# The Closed Agentic QA Loop: Cypress Agents That Run, Read the Evidence, and Fix

> Source: <https://dev.to/daniil-qa/the-closed-agentic-qa-loop-cypress-agents-that-run-read-the-evidence-and-fix-1ppd>
> Published: 2026-11-26 10:05:51+00:00

**Recommendation:** When building QA agents, make each one prove failures with a real Cypress run and Test Replay, and isolate concurrent sessions by unsetting ELECTRON_RUN_AS_NODE and using cypress open --headless.
More in the playbook "Designing agent systems": <https://wpnews.pro/playbooks/agent-architecture>

Most AI testing tools stop at writing tests. Ours have to **run** them.

At AppliedAI, our QA team tests **Opus**, an AI workflow platform. Over the last few months we turned our Cypress framework into a **closed agentic QA loop**: a team of AI agents takes a nightly failure, a new feature or an explored bug all the way to a verified fix. A human stays in the loop and makes the decisions.

This post covers what the loop looks like, which Cypress features it uses, and the main lesson: **an agent that runs the test does not have to guess.**

One agent sits in the centre: the **Team Lead**. It starts every run and delegates the work to specialised agents. Each agent has one job:

| # | Agent / stage | What it does | 
|---|---|---|
| 01 | **Nightly Results** | Pulls last night's run from Cypress Cloud, including Test Replay | 
| 02 | **Product Explorer** | Explores the live app as a brand-new user, looking for bugs nobody wrote a test for | 
| 03 | **Test Planner** | Designs manual test cases for a new feature and stores them in Qase | 
| 04 | **Test Generator** | Turns approved cases into UI and API Cypress specs | 
| 05 | **Test Executor** | Runs the specs headless and diagnoses failures | 
| 06 | **Test Auditor** | Checks specs against our conventions and coverage, read-only | 
| 07 | **Test Healer** | Fixes broken *tests* (stale selectors, changed flows) and opens a PR | 
| 08 | **Bug Analyzer** | Triages every failure with a confidence score, files Jira tickets, routes work to the healers | 
| 09 | **App Healer** | Takes confirmed *application* bugs and proposes the fix | 

The loop closes on itself. A fix shipped by a healer is checked again by the next nightly run, and that run is stage 01 again.

**The human in the loop.** A QA engineer talks only to the Team Lead. They scope each run, approve the test cases before any code is written, and approve every PR. Agents do the repetitive work: triage, healing and re-runs. People keep the judgement calls.

The biggest change was not *writing* tests faster. It was making agents **prove** what they say.

An agent that reads a stack trace and the spec source will produce a plausible explanation, and plausible explanations are often wrong. So every claim in our loop needs a run behind it:

The result is less ambiguity. When an agent reports "app bug, 90 % confidence", you can open the replay and see why.

None of this needs exotic tooling. It is mostly what Cypress ships today:

`cy-cloud`). The Bug Analyzer uses it to list runs, failed tests, errors and screenshots, which is the raw material for triage.
Until now, when an agent drove Cypress through cypress-tap on your machine, the Cypress window and a browser opened on your screen and could pull focus from your editor. **Cypress 16.4.0** adds a `--headless` flag to `cypress open`:

```
cypress open --e2e --headless --browser chrome
```

The agent gets a live session it can inspect with tap, and nothing appears on the screen. 16.4.0 also makes `cypress tap status` report when the config stops loading or a spec won't compile, so the agent reads the actual error instead of guessing why the session hangs. That fits "run, don't guess" well.

A few things to know: a person can't watch a headless session, it runs until the process is stopped, and after fixing a config error the agent has to restart Cypress. Docs: [cypress open --headless](https://docs.cypress.io/app/references/command-line#cypress-open-headless).

Several agents running Cypress at the same time sounds like a recipe for flaky chaos. It works for us because **each run is isolated from the others**:

`ELECTRON_RUN_AS_NODE=1` from their parent process, and that breaks Cypress, which is itself an Electron app. Every Cypress command we run starts with `env -u ELECTRON_RUN_AS_NODE`. It's a small detail that took a long time to find.
With `cypress open --headless`, the last visible part (a browser window per live session) goes away too.

One caveat: **isolation doesn't help against a rate-limited backend.** When parallel runs hit a downstream service that throttles, the agents run those specs one after another. Knowing when *not* to parallelise is part of the guidelines.

The agents are only as good as the rules they follow. What makes the loop work is the boring part:

`cy.wait()` sleeps are banned. If an agent breaks a rule, a linter fails, not a reviewer's patience.
With that in place, agents do more than turn tickets into test cases. They **test the new feature**: they explore it as a real user, refute their own findings with a second agent before filing, and only file what they can reproduce.

For us, the role of the QA automation engineer moved from *writing and fixing specs* to *designing the system that writes and fixes them*, and to owning the decisions at the gates.

Next posts in this series will go deeper on individual parts: the Product Explorer, LLM assertions with [cypress-verify-llm](https://www.npmjs.com/package/cypress-verify-llm), and how the healers decide between a test bug and an app bug.

*How are you using agents with Cypress? I'd like to compare notes in the comments.*
