File DA-025 View as Markdown
Agent Detector
The detection engine inside the script is open source: github.com/doubleagent-so/agent-detector (MIT). Read this page if you want to see how a verdict is made, run the engine yourself, or help improve it.
- It runs in the page, with no dependencies and no network requests.
- It returns
human,botoragent, with probabilities, the agent's identity, the reasons and a recommendation. - It knows 226 named bots and agents (catalog)
and uses 76 signal codes.
Script or Agent Detector
Script (doubleagent.js) | Agent Detector | |
|---|---|---|
| Install | One tag | Code |
| Verdict in the page | Yes | Yes |
| Sessions across pages, consent | Yes | You build it |
| GA4, Meta, Shopify and 14 more tools | Yes | You build it |
| Your own tools and backend | Plugins | engine.payload() |
| Server re-scoring, the portal, signed tokens | With the cloud | No |
The script runs Agent Detector. With data-cloud="off" it stays in the page, like Agent Detector on its own. See Plugins.
Use it
Before you start: Node.js 22.18 or later to run the example.
git clone https://github.com/doubleagent-so/agent-detector && cd agent-detector && npm ci
npm run example # live verdict page
import { createEngine } from '@doubleagent-so/agent-detector';
const engine = createEngine(window, { onVerdict: (v) => console.log(v.class, v.reasons) });
const verdict = await engine.ready;
Getting started covers the options, the verdict and sending engine.payload() to your backend.
How it works
Probes and input events become signals. Each signal is a log-likelihood ratio inside a capped group, so tells that go together can't pile up. Fusion adds them to your site profile's starting odds. A policy then turns the result and the action into a recommendation. Details: How it works.
With the cloud on, the server scores every session again with evidence the browser can't forge (request headers, IP ranges, Web Bot Auth signatures). It never trusts the browser's own verdict.
Improve it
- A real browser labelled automated, or an agent that got through: report a misclassification.
- A new agent or bot: add it to the catalog.
- A new probe, better weights, fewer false positives: Extending
and Contributing.
Found a way past it? Report it privately through Security.
Next: Verdict for every field the engine returns.