[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-111840":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":16,"stars30d":17,"stars90d":15,"forks30d":15,"starsTrendScore":18,"compositeScore":19,"rankGlobal":10,"rankLanguage":10,"license":20,"archived":21,"fork":21,"defaultBranch":22,"hasWiki":21,"hasPages":21,"topics":23,"createdAt":10,"pushedAt":34,"updatedAt":35,"readmeContent":36,"aiSummary":37,"trendingCount":15,"starSnapshotCount":15,"syncStatus":38,"lastSyncTime":39,"discoverSource":40},111840,"agent-traffic","mintlify\u002Fagent-traffic","mintlify","Tell agents, AI crawlers, search crawlers and bots apart from people","https:\u002F\u002Fagent-traffic.mintlify.site",null,"TypeScript",88,4,53,0,8,35,1,49.6,"MIT License",false,"main",[24,25,26,27,28,29,30,31,32,33],"ai-agents","analytics","bot-detection","bots","claude-code","crawlers","gptbot","llm","user-agent","web-bot-auth","2026-11-10 18:43:20","2026-11-21 12:35:06","# agent-traffic\n\nTell agents, AI crawlers, search crawlers and bots apart from people.\n\nMintlify hosts documentation for thousands of companies, and those sites serve hundreds of millions of requests a month. For years almost all of that came from developers reading docs in a browser. Now a growing share comes from agents: Claude Code pulling a page into a coding session, ChatGPT answering a question with your docs, Cursor checking an API reference before it writes a call.\n\nAs that traffic grew, we kept needing to answer questions our tools couldn't. How much of our traffic is agents, and which ones? Is that request from GPTBot really OpenAI, or someone borrowing the name? Is a coding agent reading the docs, or is an AI company crawling them for training data, or a script mirroring `llms.txt` every hour? The bot lists we started with matched user agent substrings, put everything automated into one bucket, and believed whatever a request claimed to be.\n\nSo we built our own. We studied our traffic, tested the existing open-source bot lists against it, and kept track of which signals actually separate one kind of request from another. agent-traffic is what came out of that: a tested dataset of the user agents, headers and official verification sources of real agents and crawlers, plus a small classifier that applies it. We're open-sourcing it so you don't have to learn all of this from scratch.\n\n## Get started with your agent\n\nInstall the skill in Claude Code, Cursor, Codex or any agent the [skills CLI](https:\u002F\u002Fskills.sh) supports:\n\n```\nnpx skills add mintlify\u002Fagent-traffic\n```\n\nThe [skill](skills\u002Fagent-traffic\u002FSKILL.md) teaches your agent how classification works and how to use the package and dataset, from request handlers to stored logs. Then ask it for whatever you need. You can also paste the skill's URL straight into any agent.\n\n## What it does\n\n```js\nimport { classify } from '@mintlify\u002Fagent-traffic'\n\nclassify({ userAgent: 'Claude-User (claude-code\u002F2.1.308; +https:\u002F\u002Fsupport.anthropic.com\u002F)' })\n\u002F\u002F { category: 'agent', kind: 'coding', name: 'Claude Code', operator: 'Anthropic', version: '2.1.308', ... }\n\nclassify({ userAgent: 'axios\u002F1.13.2' })\n\u002F\u002F { category: 'bot', kind: 'http-client', name: 'axios', ... }\n```\n\n- A curated, tested dataset of the user agents, headers and official verification sources of real agents and crawlers\n- Verifies crawlers against their operators' published IP ranges and catches impersonators\n- Every result explains itself\n- Zero dependencies, and runs anywhere `fetch` does: Node, Bun, Deno, Cloudflare Workers, Vercel Edge\n\n## Install it yourself\n\n```\nnpm i @mintlify\u002Fagent-traffic\n```\n\n## Usage\n\nIn a Cloudflare Worker, pass the request headers and the real client IP:\n\n```js\nimport { classify, loadIpRanges } from '@mintlify\u002Fagent-traffic'\n\nlet ipRanges\n\nexport default {\n  async fetch(request) {\n    ipRanges ??= loadIpRanges()\n\n    const result = classify(\n      { headers: request.headers, ip: request.headers.get('cf-connecting-ip') },\n      { ipRanges: await ipRanges, headersComplete: true }\n    )\n\n    if (result.category === 'agent') {\n      return serveMarkdown(request)\n    }\n\n    return fetch(request)\n  }\n}\n```\n\nThe ranges load on the first request because Workers can't fetch at startup, and caching the promise keeps concurrent requests from each downloading them. `headersComplete` turns on the fake-browser checks, which is safe when browser headers reach the Worker untouched over HTTPS; leave it off if plain HTTP or a proxy in front can strip them.\n\nSomeone spoofing a crawler gets caught:\n\n```js\nclassify({ userAgent: 'Mozilla\u002F5.0 (compatible; GPTBot\u002F1.4; +https:\u002F\u002Fopenai.com\u002Fgptbot)', ip: '73.12.4.9' }, { ipRanges })\n\u002F\u002F { category: 'bot', kind: 'impersonator', verified: false, confidence: 'high',\n\u002F\u002F   reasons: [\"claims to be GPTBot but 73.12.4.9 is outside OpenAI's published ranges\"] }\n```\n\nAgents that hide behind a browser user agent still ask for markdown:\n\n```js\nclassify({ headers: { 'user-agent': 'Mozilla\u002F5.0 (Macintosh; ...) Chrome\u002F149.0.0.0 Safari\u002F537.36', accept: 'text\u002Fmarkdown, text\u002Fhtml;q=0.9' } })\n\u002F\u002F { category: 'agent', kind: 'unidentified', confidence: 'medium',\n\u002F\u002F   reasons: ['Accept header prefers markdown over HTML, which browsers never do'] }\n```\n\nJust need a quick check? Each category is also available as a single regular expression:\n\n```js\nimport { patterns } from '@mintlify\u002Fagent-traffic'\n\npatterns.agent.test(userAgent)\npatterns['ai-crawler'].test(userAgent)\n```\n\n## Querying your logs\n\nYour agent can do this for you with the [skill](skills\u002Fagent-traffic\u002FSKILL.md). It translates the patterns for your database; ClickHouse, DuckDB and Postgres are verified.\n\nTo do it yourself, classify each distinct user agent once and join the results:\n\n```js\nimport { classify } from '@mintlify\u002Fagent-traffic'\n\nconst rows = distinctUserAgents.map((ua) => ({ user_agent: ua, ...classify({ userAgent: ua }) }))\n\u002F\u002F load rows into a table, then: SELECT ... FROM logs JOIN user_agent_classes USING (user_agent)\n```\n\nLogs usually keep only the user agent. That still identifies known agents, crawlers and HTTP clients, but agents that borrow a browser user agent will look like people unless you also log the `Accept` header.\n\n## Categories\n\n| `category` | Meaning | `kind` |\n|---|---|---|\n| `agent` | An AI product fetching a page right now, for a person | `assistant`, `coding`, `browser`, `unidentified` |\n| `ai-crawler` | An AI company collecting pages ahead of time | `training`, `ai-search`, `ingest` |\n| `crawler` | A search engine | `search` |\n| `bot` | Any other automation | `seo`, `preview`, `ads`, `monitor`, `scanner`, `archiver`, `feed`, `http-client`, `headless`, `fake-browser`, `impersonator`, `unidentified` |\n| `human` | A person in a browser | |\n| `unknown` | Nothing to classify (no user agent or headers) | |\n\n## API\n\n### `classify(request, options?)`\n\n`request`:\n\n| Field | Type | |\n|---|---|---|\n| `userAgent` | `string` | Read from `headers` when omitted |\n| `headers` | `Headers \\| Record\u003Cstring, string \\| string[]>` | Any casing |\n| `ip` | `string` | The real client IP. Ports and IPv4-mapped IPv6 addresses are handled |\n\n`options`:\n\n| Field | Default | |\n|---|---|---|\n| `ipRanges` | none | From `loadIpRanges()`. Turns on IP verification |\n| `headersComplete` | `false` | Set when browser headers reach you untouched over HTTPS. Turns on fake-browser checks |\n| `maxRangeAgeDays` | `180` | An operator's range file older than this can verify a request, but never flag it as an impersonator |\n\nReturns:\n\n```ts\n{\n  category: 'agent' | 'ai-crawler' | 'crawler' | 'bot' | 'human' | 'unknown'\n  kind?: string\n  id?: string\n  name?: string\n  operator?: string\n  version?: string\n  verified: boolean | null\n  confidence: 'high' | 'medium' | 'low'\n  reasons: string[]\n}\n```\n\n- `verified: true` means the IP is in the operator's published ranges.\n- `verified: false` means it's provably not who it claims to be.\n- `verified: null` means it wasn't checked, or can't be. Coding agents like Claude Code run on the user's own machine, so they're never IP-checked.\n\n### `loadIpRanges(fetch?)`\n\nDownloads the IP range files published by OpenAI, Anthropic, Google, Perplexity, Apple, Microsoft, Common Crawl and DuckDuckGo. Call it once at startup, refresh it about daily, and pass the result to `classify`. Files that fail to load are skipped, so requests from those operators come back unverified rather than flagged.\n\n### `agents`, `httpClients`, `headers`\n\nThe dataset, also importable as plain JSON from `@mintlify\u002Fagent-traffic\u002Fdata\u002F*.json` for use from other languages or SQL:\n\n- [`agents.json`](data\u002Fagents.json) lists known agents and crawlers. Each entry has user agent patterns, Accept and `Signature-Agent` fingerprints, verification sources, docs, real example user agents, and the date it was last verified.\n- [`http-clients.json`](data\u002Fhttp-clients.json) lists generic HTTP libraries and headless browsers.\n- [`headers.json`](data\u002Fheaders.json) says what each request header tells you, and who controls it.\n\n### `patterns`, `userAgents`\n\n`patterns` is one case-insensitive `RegExp` per category: `agent`, `ai-crawler`, `crawler` and `bot`. `userAgents` holds the same patterns as arrays of strings, for building your own matchers. They match user agents only. Use `classify` to get verification, `Accept` and header checks.\n\n### `prefersMarkdown(accept)`\n\n`true` when an `Accept` header ranks `text\u002Fmarkdown` above `text\u002Fhtml`.\n\n## How it works\n\nChecks run in order, and the first one that answers wins:\n\n1. Known agent or crawler, verified by IP when possible\n2. Asks for markdown\n3. Generic HTTP client or headless browser\n4. Browser, unless its headers contradict it\n5. Otherwise a bot\n\n[GUIDELINES.md](GUIDELINES.md) covers the full rules, why they work this way, and how to apply them without this package.\n\n## Caveats\n\n- **Some products share an identity.** Codex has been reported to fetch as `ChatGPT-User`, and Cursor through Exa as `ExaUser`. Results name only what can be proven.\n- **Some agents are invisible at the HTTP level.** Agentic browsers that run inside a person's own Chrome (Atlas, Comet, Claude in Chrome) look exactly like that person.\n\n## Contributing\n\nAgents change their fetchers often. If you see one that's missing or wrong, open a PR against [`data\u002Fagents.json`](data\u002Fagents.json) with a real example user agent and a source. See [CONTRIBUTING.md](CONTRIBUTING.md).\n\n## License\n\nMIT © [Mintlify](https:\u002F\u002Fmintlify.com)\n","agent-traffic 是一个用于精准识别网络请求来源类型的轻量级工具，专为区分真实用户、AI 代理（如 Claude Code、Cursor）、搜索引擎爬虫（如 GPTBot）和通用自动化机器人而设计。它基于实测的 User-Agent 模式、HTTP 头部特征及官方 IP 地址段验证（如 OpenAI、Anthropic 公布的爬虫 IP 范围），支持实时分类并拒绝伪装请求；零依赖，兼容 Node.js、Deno、Cloudflare Workers 等边缘运行环境。适用于文档站点、API 服务、开发者平台等需精细化流量分析与反滥用策略的场景。",2,"2026-11-24 04:41:56","CREATED_QUERY"]