Skip to content
Verification Engine Guide

Reagent Documentation

Architecture, sandbox verification stages, trust model statuses, and machine-readable JSON reporting for human teams and coding agents.

What is Reagent?

Reagent is an automated verification tool for modern software teams. It connects to your GitHub repositories and tests pull requests before you merge them into main. Instead of just reading your code diff and guessing if it looks good, Reagent boots your app in a fresh sandbox runner, clicks through real user journeys in a headless browser, and shows you proof of what works and what broke.

Note

Core philosophy: Don't just review what was written. Verify what was built. Reading a diff tells you what lines changed. Running the built app tells you if your feature actually works when clicked.

The Core Mission

Writing code has changed completely over the last two years. Tools like Cursor, Claude Code, and Codex can write hundreds of lines of code in seconds. Developers can run multiple coding tasks at the same time. Writing code is now faster and cheaper than ever.

The problem is that checking this code has not gotten any faster. Pull request queues are backed up. Developers skim huge diffs because they do not have time to pull down every branch and test it by hand. Unit tests stay green even when buttons fail to click. Reagent solves this review bottleneck by giving you an automated check that tests real app behavior on every pull request.

What Reagent Does (and What It Does Not Do)

Here is a quick look at where Reagent fits and what it focuses on:

What Reagent DoesWhat Reagent Does Not Do
Boots your real app and runs browser tests in an isolated sandbox runner.Not an AI chat bot that leaves subjective code style nitpicks on your PR.
Tests code from both human engineers and AI coding agents with the same rigor.Not a coding agent that writes your app features or steals merge power.
Gives you hard evidence for every failure: error logs, screenshots, and line numbers.Not a bare-bones CI runner that exits with code 1 without telling you what broke.
Tests existing pages to make sure your new code did not break old features.Not a linter or syntax checker; Reagent tests compiled, running software.

Where It Fits in Your Workflow

Reagent runs directly on GitHub as a GitHub App. You do not have to throw away your current CI pipelines, rewrite your tests, or change how you build. When someone opens or updates a pull request, Reagent runs alongside your existing checks. If a bug or regression is caught, Reagent comments on the pull request with the exact line number, screenshot, and reproduction command.

Why Code Review is Broken in the AI Era

Software teams used to rely on two main safety nets: manual code review and automated test suites. In a world where AI agents can write entire features in seconds, both safety nets are breaking down.

Why Reading Code Diffs Fails

When a reviewer reads a pull request diff on GitHub, they are just reading text on a screen. They check for clean style, good naming, and obvious mistakes. But code on screen is not code in action. An implementation can look completely fine in a diff and still crash the moment a user clicks it.

Here is a common React bug: a developer refactors a shared button and forgets to pass the click event into an onClick handler. In the diff, everything looks clean. TypeScript compiles with zero errors. But in production, clicking 'Pay Now' throws: TypeError: event.preventDefault is not a function. A human reviewer reading the diff cannot see this crash, because it only happens when a real browser dispatches a real click event.

Why Unit Tests Lie (Mock Drift)

Unit tests are helpful, but modern web tests rely heavily on mocks. Components mock their API calls, pages mock their data fetchers, and test runners mock browser window APIs. Over time, those mocks drift away from how the real app works.

Warning

Mock Drift happens when your mock passes inside a test runner, but the real backend returns a slightly different JSON shape or the real browser handles state differently. Your test suite stays green, but your live app crashes.

On top of that, tests only check things developers explicitly thought to test. If an AI coding agent creates a new page but forgets to write tests for an existing checkout flow, existing test suites will not warn you when the checkout flow breaks.

Four Common Ways Pull Requests Break Apps

ProblemWhy Static Tools Miss ItWhat Actually Happens at Runtime
Shared Component BreakageThe updated component compiles and passes its own unit test.Other pages across the app import that same component and crash because an optional prop became required.
API Shape ChangesLocal test mocks assume an older JSON shape stored in test fixtures.The live API returns a different key name or null value, causing an unhandled crash on page load.
Silent Layout & Button ShiftsCSS classes and Tailwind strings look completely valid to linters.A z-index or overflow tweak hides the primary submit button behind a modal overlay on mobile screens.
Two PRs CollidingEach pull request passes its own tests alone against main.When PR A and PR B are both merged, their changes clash and break core application flows.

The Verification Engine

Reagent does not guess. It follows a clean six-step verification process that runs every time code is pushed to a pull request.

Step 1: Webhook Trigger

Reagent connects to your GitHub repository using a GitHub App. When a developer or AI agent opens a pull request or pushes new commits, Reagent receives a webhook. It grabs the pull request info, source commit hash, target branch commit hash, and the exact file changes.

Step 2: Change Analysis & Route Mapping

Running a full 30-minute test suite on every commit is slow. Reagent inspects your changed files to figure out what actually needs to be tested. By tracing your imports and routing structure (like Next.js App Router or Pages Router), Reagent identifies:

  • Pages and components that were directly modified.
  • Other pages across the app that import any modified components.
  • Core user journeys that pass through those affected routes.
  • Existing tests that cover the changed files.

Step 3: Isolated Sandbox Runner

To test your code safely without touching production, Reagent spins up a fresh, isolated runner. This runner checks out the pull request branch, installs project dependencies, and builds the application.

Note

Security by default: Repository code is always treated as untrusted input. The sandbox runs with strict CPU limits, memory limits, and timeouts so test runs cannot mess with our servers or leak data.

Step 4: Real Browser & User Journey Testing

Once your app is running inside the sandbox, Reagent launches headless Chrome using Playwright. It opens the affected routes and tests real user actions:

  • Page load check: Does the page load with HTTP 200 without throwing hydration bugs or server crashes?
  • DOM clicks & typing: Clicks buttons, fills out forms, opens modals, and checks state updates.
  • Console error trap: Catches any unhandled JavaScript errors, React crashes, or broken scripts.
  • Network monitor: Watches outgoing API requests and flags failed 4xx or 5xx responses.

Step 5: Visual Layout Inspection

Reagent takes high-resolution screenshots of the affected pages on desktop and mobile screen sizes. It compares them against baseline screenshots taken from your target branch (main). This catches broken CSS grids, shifted text, and hidden buttons before you merge.

Step 6: Evidence & GitHub Reporting

When testing finishes, Reagent packages all results into a clean report. It posts the status to GitHub Checks and leaves a comment on the pull request. If something broke, it includes the exact component name, the line number, a screenshot, and a one-line CLI repro command.

How Results Are Reported

A testing tool is only useful if developers can trust its output. If a tool reports false alarms, developers ignore it. If a tool says everything passed when a test was actually skipped, developers get burned. Reagent uses five clear statuses with strict rules.

The Five Verification Statuses

StatusExit CodePull Request ImpactWhat It Means
PASSEDexit 0Merge UnlockedThe app built, booted, and finished all browser user journeys with zero crashes.
FAILEDexit 1Merge BlockedA real, reproducible bug was caught (broken button, crashed route, or unhandled error).
WARNINGexit 2Advisory OnlyNon-breaking warnings found (deprecated packages, console warnings) that do not break user flows.
NOT VERIFIEDexit 78Explicitly SkippedA check could not run (like a missing Stripe secret). Never faked as passed.
RUNNER ERRORexit 127Automatic RetryAn issue happened on our end (like npm install timing out). Isolated so your code is not blamed.

The Rule of Honest Reporting

One of the worst things a CI system can do is silently skip a test and mark the check green. If your app needs an external database or payment key that is not set up in the runner, Reagent explicitly marks that test as NOT VERIFIED.

Warning

Reagent never pretends a skipped check was successful. If an integration was not tested, we say so plainly so your team knows exactly what was verified.

The Evidence Bundle for Every Bug

When Reagent catches a bug, it never leaves vague comments like 'checkout looks suspicious'. Every bug report comes with hard proof:

  • Line annotations: Pinned directly to the offending line in your GitHub pull request diff.
  • Console error logs: The exact error text and stack trace captured from the browser session.
  • Screenshot proof: Screenshots showing what the user saw right when the bug occurred.
  • Playwright trace (trace.zip): A full trace archive you can open locally to step through DOM clicks and network requests.
  • CLI repro command: A single command (e.g., npx reagent repro pr-142) that lets any engineer replay the failure locally in seconds.

Autonomous Coding Agents

Reagent is built for the modern development world where code is written by both human engineers and AI coding agents like Cursor, Claude Code, and Codex. Reagent tests pull requests with the exact same rigor regardless of who or what wrote the code.

Fixing the Review Bottleneck

When teams start using AI coding tools, their pull request volume shoots up. But human engineers become the bottleneck. Developers spend hours pulling down agent branches, finding broken buttons, and prompting the agent to fix them. Reagent automates this entire loop.

Machine-Readable JSON Report (reagent.report.json)

Along with friendly GitHub comments, Reagent generates a clean JSON report. Coding agents can read this file directly, see the exact runtime error and line number, and fix their own PR before a human reviewer even opens the notification.

json
{
  "pr": 142,
  "branch": "feat/checkout-mutation",
  "status": "FAILED",
  "exit_code": 1,
  "summary": {
    "journeys_evaluated": 4,
    "regressions_detected": 1,
    "duration_ms": 7820
  },
  "regressions": [
    {
      "route": "/checkout",
      "type": "RUNTIME_EXCEPTION",
      "component": "components/PaymentButton.tsx:18",
      "locator": "button#submit-payment",
      "error": "TypeError: e.preventDefault is not a function",
      "evidence": {
        "trace": "traces/trace-142.zip",
        "screenshot": "artifacts/checkout-fail.png"
      }
    }
  ],
  "agent_instruction": "Preserve React.MouseEvent in PaymentButton"
}

The Autonomous Self-Healing Loop

With structured JSON reports enabled, the review cycle heals itself:

  • 1. Agent writes code: An agent like Cursor or Claude Code creates a pull request for a new feature.
  • 2. Reagent runs in sandbox: Reagent boots the app, runs browser journeys, and catches a runtime bug.
  • 3. JSON report created: Reagent writes reagent.report.json with the failing component name, line number, and stack trace.
  • 4. Agent fixes itself: The coding agent reads the JSON report, updates button.tsx, and pushes a fix commit.
  • 5. Clean final review: Reagent re-tests the new commit, confirms the bug is fixed, and turns green. Only then does a human engineer do a quick final check.

Cross-PR & Future Vision

Testing individual pull requests is just step one. As teams use multiple coding agents at once, the next big problem is cross-PR conflicts.

The Multi-Agent Branch Collision Problem

In an active team, several agents and developers work on different features at the same time. Each pull request is tested alone against main and passes its checks. But when both branches get merged together, the app breaks.

For example: Agent A optimizes an API response format. Agent B builds a new dashboard component that calls that API. Both PRs pass their individual tests cleanly. But once both are merged into main, the dashboard crashes in production. Reagent is building cross-PR testing to spin up a combined test branch, test both pull requests together, and catch clashes before you merge.

Expanding Beyond Frontend

Reagent is starting with React and Next.js apps because that is where component regressions hurt most. But the engine is built to grow into full-stack and backend systems:

  • API contract testing: Checking OpenAPI and GraphQL schemas against real running server endpoints.
  • Database migration checks: Testing schema migrations against test database copies in isolated runners.
  • Service dependency checks: Testing how backend changes affect other microservices.
  • Design system checks: Catching differences between your live components and Figma design tokens.
Core Philosophy

The bottom line: When writing code becomes fast and cheap, knowing that your code actually works is the most valuable thing in engineering. Reagent is built to be the independent verification layer for modern software.