# Check that visitors use a real browser

Turn on the live Defense Agent's browser check. A script on your pages spots automated browsers, and a short-lived cookie proves real ones.

The browser check is part of the [live Defense Agent](/docs/live-defense-agent/). When it is on, the agent adds a small script to your app's HTML pages. The script looks for signs that the visitor's browser is driven by a program, and browsers that pass get a short-lived cookie that proves it on their next requests. The results feed the decision that blocks IP addresses for a while, and you can require the proof on routes you choose, such as your sign-in form. It is off until an owner or admin turns it on in **Settings > Live protection**, and it needs `@isagentproof/live` 0.2.0 or later.

## Turn on the browser check

### Open the settings
Open **Settings > Live protection**.

### Turn it on
Under **Browser check**, tick **Browser check**. Tick **Device fingerprint** as well if you want it (see [What the script collects](#what-the-script-collects)).

### Save
Press **Save**. Every container running the agent picks up the change within seconds.

From then on, each page load your app answers with `200` and `text/html` gets one tag, right after `<head>`:

```html
<script src="/.well-known/agentproof/check.js?v=…" data-n="…" async></script>
```

The script comes from your own site: the agent answers `/.well-known/agentproof/check.js` and `/.well-known/agentproof/check` itself, and your app never sees either path. Nothing is loaded from another host.

## Require browser proof on a route

### Add the route
In **Settings > Live protection**, under **Require browser proof**, press **Add route**.

### Choose the method and path
Choose the method, or **Any method**, and type the path: `/login` for one path, `/account/*` for a path and everything below it, `*` for any text inside one part of the path (`/users/*/edit`). Paths are compared without case, repeated slashes or a trailing slash.

### Start in Monitor
Leave **Monitor** selected and press **Add route**. Requests without proof are counted as **Would require proof** on the **Live** page and still reach your app.

### Switch to Enforce
When the counts look right, press **Enforce** on the route.

In **Enforce**, a request to the route without valid proof never reaches your app:

- A page load gets a **Protected by AgentProof** page that says **Checking your browser before you continue.** It runs the check and loads the page again once the browser passes. After a form `POST`, it goes back to the form instead, so the form is not sent twice. A browser that fails the check, or that does not keep the cookie, sees **This browser could not be checked.**
- Anything else, such as a `fetch` call or `curl`, gets `403` and `{"error":"browser_check_required","status":403,"protectedBy":"AgentProof","reference":"…"}`.

**Enforce** applies even while the agent is in **Monitor** mode, because you chose it for that route; **Pause blocking** turns it back into counting. Each route's button switches it between **Monitor** and **Enforce**, and **Remove** deletes it. A workspace can have 50 routes.

**Note:**
A visitor's first page load never carries proof: the script has not run yet. Require proof on the requests that follow a page, such as `POST /login`, not on your landing pages.

## How the proof works

The script runs its checks as soon as the page loads and sends the result to `/.well-known/agentproof/check` on your site. The agent decides there, in your process:

- **Pass**: no sign of automation, or only weak signs. The browser gets the cookie.
- **Bot**: the browser says it is controlled by a program, is a headless browser, or carries Selenium, Playwright or Puppeteer markers. The browser still gets the cookie, marked as a bot, so later requests are counted as from a bot and fail **Require browser proof**.

The cookie is `__Host-agentproof` (`agentproof` on plain `http`, which is development only). It is `HttpOnly`, `Secure` and `SameSite=Lax`, lasts 30 minutes, is signed with a key that belongs to your workspace, and only works with the browser it was given to. The agent checks it on every request without asking AgentProof and removes it before your app sees the request. A page left open refreshes the cookie before it runs out, while the page is visible.

Each page's tag carries a one-time code that is valid for 10 minutes and tied to the visitor's network. A page served from a cache with an old code still works: the check gets a fresh code and tries once more. Each IP address can send 30 checks in a row, then one more every 2 seconds; each check is at most 4 KB.

## What the script collects

The script never reads field values, typed characters, clipboard contents or the page's address, never records the screen or a session, sets no cookie itself, stores nothing in the browser and sends nothing to any host but your site.

- **Signs of automation**: `navigator.webdriver`, a headless browser, Selenium, Playwright, Puppeteer, PhantomJS and Nightmare markers, a browser window with no size, no languages, Chrome with no plugins or no `window.chrome`, inconsistent notification permissions, a user agent that does not match the platform, software graphics (SwiftShader or llvmpipe), browser functions replaced by a script, a script engine that does not match the user agent, and an attached DevTools protocol client.
- **Behaviour, as numbers only**: the time to the first interaction, how many pointer moves, scrolls, key presses, touches and clicks there were, how straight the pointer moved, how even the typing was (times between key presses, never the keys), pastes into forms, the time from the first field to submitting a form, and how often the tab was hidden or shown. These go in a second message when a form is submitted or the page is left.
- **Device fingerprint**, only when you tick **Device fingerprint**: how the browser draws a test image and renders a test sound, its graphics details, which of 20 common fonts it has, the screen size, time zone, languages, processor count, memory and touch support. The script mixes them with a value that belongs to your workspace and sends only a one-way hash, so the same device cannot be linked across different customers' sites.

**Warning:**
Tell your visitors about the browser check in your own privacy notice. In the European Union and the United Kingdom, a device fingerprint may need your visitors' consent even when you use it only against fraud; turn on **Device fingerprint** only if you have a basis for it. AgentProof processes these results for you, only to protect your app.

## What AgentProof does with the results

Each request's summary says whether it carried proof (none, pass, bot, expired, invalid or unsure), and each check's verdict, signs and behaviour go with the summaries. They join the [scores that decide which IP addresses to block for a while](/docs/live-defense-agent/#how-agentproof-decides-to-block-an-ip-address), shown as these reasons:

| Reason | What it means |
|---|---|
| **Failed the browser check** | The check found automation, or requests carried a bot's proof. |
| **Pages without the browser check, then form posts** | The address loaded pages with the script but never ran it, then posted forms without proof. |
| **Required browser proof missing** | Requests to a route that requires proof came without it, more than once. |
| **Robotic mouse or typing** | The pointer moved in perfectly straight lines, the typing was perfectly even, or clicks came with no movement. |
| **Clicks or keys made by a script** | Input events were made by a script, not a person. |
| **Device seen on many addresses** | The same device fingerprint came from 10 or more addresses in 10 minutes. |
| **Many devices on one address** | Six or more device fingerprints came from one address in 10 minutes. |

None of these blocks an address on its own: they add to the other reasons, and AI review sees them with the requests.

## The Browser check card

The **Live** page shows a **Browser check** card once the check is on. Its numbers are for today (UTC): **Pages checked**, **Passed**, **Bots**, **Requests without proof**, **Would require proof** and **Refused without proof**. Below them are the most common signs of automation, devices seen on many addresses in the last 10 minutes, your routes that require proof, and the pages where the script was left out, with the reason.

## When the script is left out

The agent never changes your page when it cannot do so safely. It leaves the tag out, and the card counts it under **Script left out**, when:

| On the card | What to do |
|---|---|
| **Content-Security-Policy refuses the script** | Allow `'self'` in `script-src` (or `default-src`), or send a `'nonce-…'`: the agent puts your header's nonce on its tag. It never changes your policy. A nonce in a `<meta>` tag is not used. |
| **Content-Security-Policy refuses the check** | Allow `'self'` in `connect-src` (or `default-src`). |
| **Cache-Control: no-transform** | The page asks not to be changed, so it is sent as your app wrote it. Remove `no-transform` from HTML pages if you want the check there. |
| **Already compressed** | Something compressed the page before the agent saw it. The agent asks your app for uncompressed HTML on page loads and compresses it itself, so this means your app compresses anyway; let the agent do it. |
| **Not a 200 answer** | Only `200` pages get the script. |
| **No <head> or </body>** | The page has neither tag within its first 64 KB, nor a closing `</body>`. |

Pages that get the script lose their `ETag`, because their bytes change on every load, and are compressed by the agent with Brotli or gzip, as the browser asks.

- [Live Defense Agent](/docs/live-defense-agent/) Install the agent and turn on blocking.
- [Troubleshooting](/docs/troubleshooting/#live-defense-agent) Messages and what to do.
- [Safety and your data](/docs/safety-and-data/) What AgentProof keeps and for how long.
