AI Training Opt-Out in robots.txt: Honor It in Your Crawler
The new AI training opt-out in robots.txt uses a __usage_ai-training token. Learn to read it correctly in Python, store it per page and filter training data.

The AI training opt-out in robots.txt now has a shared, cross-vendor form: a User-Agent: __usage_ai-training group. In November 2026, Anthropic, OpenAI, Google and Microsoft each said they would honor it. If your team collects web data that might end up training a generative model, you'll want to honor it too. The catch is that Python's standard robots.txt parser gives the wrong answer for it in every case we tested. This guide covers what the signal means, how to read it correctly, and how to carry it through your pipeline to the training set.
What the __usage_ai-training Token Says
The mechanism comes from an IETF Internet-Draft, draft-kelley-aipref-training-preference-signal, written by Kevin Kelley of Anthropic for the AI Preferences (aipref) working group. Revision -01 is dated November 16, 2026. It's an individual draft: the working group hasn't adopted it, so it has no formal standing yet.
The idea is deliberately small. A site writes an ordinary robots.txt group, but the User-Agent line names a policy token instead of a crawler:
User-Agent: __usage_ai-training
Disallow: /
Allow: /press-kit/
That expresses a preference against AI training for every path except /press-kit/, where it expresses a preference in favor. No new directives and no new grammar: paths, wildcards and longest-match precedence work exactly as RFC 9309 defines them.
Four rules from the draft matter for implementers:
- It's about use, not crawling. The draft says plainly: "This policy token is not a directive for crawling behavior." Your crawler's own User-Agent rules still decide what you may fetch.
- The
group doesn't count. "Wildcard groups (i.e., User-Agent: ) MUST NOT be interpreted as matching the policy token." - No group means no preference. If the file has no
User-Agent: __usage_ai-trainingline, nothing has been expressed either way. - The file in effect at retrieval time applies. Preferences attach to content as of when you fetched it, so you need to record them then.
"AI training" here follows the working group's vocabulary: using content to modify the learned parameters of a generative AI model. Training models used only for classification, ranking or scoring is out of scope.
Who Honors It, and When
According to TechRadar's November 8, 2026 report, the commitments look like this:
| Company | Commitment | Timing |
|---|---|---|
| Anthropic | Honors the token | Already implementing |
| OpenAI | Honors it for "foundational generative AI training" | "Over the next few months" |
| Microsoft | Honors it, plus a separate page-level grounding preference | Crawling from February 1, 2027 |
| Honors it; treats it as Google-Extended disallowed if Google-Extended isn't set | Targeting 2027 | |
| Meta | Called it "an important step" | No commitment |
None of them applies it to content already collected. If you're building datasets, that's your cue: the big labs are converging on this signal, and it will be the obvious baseline when anyone asks how your training data was sourced.
Scraping at scale? Skip the blocks.
Fast, unblockable datacentre proxies with unlimited bandwidth.
How Many Sites Use It Today
We fetched robots.txt from 51 large sites on November 19, 2026 (news, reference, retail and tech). 42 returned a file with HTTP 200. Here's what they contained:
| Signal in robots.txt | Sites (of 42) |
|---|---|
| `User-Agent: __usage_ai-training` group | 1 (IMDb) |
| Cloudflare `Content-Signal: ... ai-train=...` line | 2 |
| Named `ClaudeBot` group | 25 |
| Named `CCBot` group | 23 |
| Named `GPTBot` group | 22 |
| Named `Google-Extended` group | 17 |
So the shared token is brand new and almost nobody uses it yet, while vendor-specific groups are everywhere. IMDb's file shows the pattern you'll see more of: an allowlist of named crawlers, then User-Agent: __usage_ai-training with Disallow: /, then User-agent: * with Disallow: /.
Two practical conclusions. Build the token check now, because it costs almost nothing and adoption will grow as the vendors' deadlines arrive. And don't treat a missing token as "anything goes": the draft says consumers should keep interpreting proprietary tokens like GPTBot as they did before. A site that disallows every named AI crawler has told you something even without the new group.
Why urllib.robotparser Gets It Wrong
The obvious move is RobotFileParser().can_fetch("__usage_ai-training", url). We ran four small robots files through Python 3.14.2's urllib.robotparser and through Protego 0.7.0 (the parser Scrapy uses):
| Test file | Path | Correct answer | urllib.robotparser | Protego |
|---|---|---|---|---|
| Draft's own example (above) | `/press-kit/logo.png` | in favor | **against** | in favor |
| Only `User-agent: *` with `Disallow: /private/` | `/private/y` | no preference | **against** | **against** |
| `User-agent: ai` with `Disallow: /` | `/blog/x` | no preference | **against** | allowed (reads as in favor) |
| Token group with `Disallow: /*.pdf$` | `/docs/a.pdf` | against | **allowed** | against |
The standard library fails all four, for three separate reasons:
- First match instead of longest match. It applies rules in file order, so
Disallow: /beats the more specificAllow: /press-kit/. RFC 9309 says the most specific match must win. - Substring user-agent matching. It checks whether a group's name appears inside your token. "ai" is a substring of
__usage_ai-training, so a group meant for some bot called "ai" gets applied to you. - No wildcard support.
and$in paths are treated literally, so/.pdf$never matches.
Protego handles paths correctly, but it falls back to the * group when no group names the token, which the draft explicitly forbids. More fundamentally, any can_fetch() API returns a boolean, and this signal has three states: against, in favor, and nothing expressed.
A Correct Three-State Checker
The fix is to check for the token line yourself, then let Protego do the RFC-compliant path matching:
import re
from protego import Protego
TOKEN = "__usage_ai-training"
TOKEN_LINE = re.compile(r"^\s*user-agent\s*:\s*__usage_ai-training\s*(#.*)?$", re.I | re.M)
def training_preference(robots_txt: str, url: str):
"""Return 'against', 'in_favor', or None (no preference expressed)."""
# The draft forbids applying the * group to the policy token, so first make
# sure the file names the token explicitly. Protego would fall back to *.
if not TOKEN_LINE.search(robots_txt):
return None
allowed = Protego.parse(robots_txt).can_fetch(url, TOKEN)
return "in_favor" if allowed else "against"
Install it with pip install protego. Once the token group exists, Protego picks it over *, so the fallback problem goes away. We ran it against ten cases, all passing:
| Case | Result |
|---|---|
| Draft example, `/blog/x` and `/press-kit/logo.png` | against, in favor |
| Only a `*` group | None |
| `User-agent: ai` group | None |
| Upper-case token with trailing comment, `/*.pdf$` rule | against for `.pdf`, in favor for `.html` |
| Token sharing a group with `GPTBot` | against |
| Token says `Allow: /`, `*` says `Disallow: /` | in favor |
| Real imdb.com file, a title page | against |
| Real theatlantic.com file | None |
The last two rows came from the live files we surveyed. Note the "token allows, disallows" case: the token governs use, while governs crawling for bots without their own group. Both can be true at once, and the draft keeps them independent. If that line between fetching and using content is blurry on your team, our web scraping vs web crawling explainer separates the two.
Fetch robots.txt by the RFC, and Spot Blocks
The preference is only as good as the file you fetched. RFC 9309 sets the rules: follow at least five redirects, parse at least 500 KiB, treat 4xx as "unavailable" (you may crawl anything), and treat 5xx or network errors as "unreachable" (assume complete disallow). It also says not to use a cached copy for more than 24 hours.
One real-world wrinkle: during our survey, Stack Overflow answered our robots.txt request with HTTP 418 and a body containing Disallow: / and Content-signal: search=no, ai-train=no. Read literally, any 4xx means "no restrictions". Here that would be exactly backwards. So keep 404 and 410 as genuinely unavailable, but treat other 4xx codes as blocks, and parse any robots-looking body they carry:
import hashlib
import os
import requests
PROXY = (f"http://{os.environ['SPARKPROXY_USER']}:{os.environ['SPARKPROXY_PASS']}"
"@gateway.sparkproxy.io:11000")
MAX_BYTES = 500 * 1024 # RFC 9309: parse at least 500 KiB
def fetch_robots(origin: str, session: requests.Session) -> dict:
url = origin.rstrip("/") + "/robots.txt"
try:
r = session.get(url, timeout=20, allow_redirects=True,
proxies={"http": PROXY, "https": PROXY})
except requests.RequestException:
return {"state": "unreachable", "body": None}
body = r.content[:MAX_BYTES].decode("utf-8", errors="replace")
looks_like_robots = "user-agent" in body.lower() and "<html" not in body[:500].lower()
if 200 <= r.status_code < 300:
state = "ok"
elif 400 <= r.status_code < 500:
# RFC 9309 calls 4xx "unavailable", but a 403/418/429 here is often a bot
# block, sometimes with a deny-all file in the body. Don't read it as consent.
state = "blocked_with_body" if looks_like_robots else (
"unavailable" if r.status_code in (404, 410) else "blocked")
else:
state = "unreachable"
return {"state": state, "status": r.status_code, "body": body,
"sha256": hashlib.sha256(body.encode()).hexdigest()}
This routes through SparkProxy's rotating datacenter gateway on port 11000, the same way you'd route the page fetches. We tested the classification with stubbed responses: 200 gives ok, an HTML 404 gives unavailable, Stack Overflow's real 418 body gives blocked_with_body, an HTML 403 gives blocked, and both 503 and a timeout give unreachable. A 780 KB file was cut to exactly 512,000 bytes. Cache the result per origin for no more than 24 hours. The ethical scraping and rate limiting guide covers request pacing for the page fetches themselves.
Cloudflare's Content-Signal Line
A second, separate convention is spreading through Cloudflare's managed robots.txt: a Content-Signal line with search, ai-input and ai-train values. It's a different proposal from the aipref token, but ai-train=no expresses the same wish, so a careful pipeline reads both.
Placement is inconsistent in the wild. The Atlantic repeats the line inside its Googlebot, Bingbot, DuckDuckBot and Yahoo groups. Cloudflare's own file puts it after its last crawler group, and Stack Overflow puts it in the * group. So read every occurrence and let any no win:
import re
SIGNAL = re.compile(r"^\s*content-signal\s*:(.*)$", re.I | re.M)
def content_signal_ai_train(robots_txt: str):
"""Cloudflare's Content-Signal line -> 'no', 'yes' or None.
Sites place this line inconsistently (in the * group, in per-bot groups,
or after the last group), so read every occurrence and let any 'no' win.
"""
values = set()
for m in SIGNAL.finditer(robots_txt):
v = re.search(r"ai-train\s*=\s*(yes|no)", m.group(1), re.I)
if v:
values.add(v.group(1).lower())
if "no" in values:
return "no"
return "yes" if values else None
On the live files it returned yes for cloudflare.com, no for theatlantic.com and stackoverflow.com, and None for imdb.com and nytimes.com.
Store the Preference With Every Page
The draft ties preferences to the robots.txt in effect when the content was retrieved. Sites change their files, and you may build a training set months after crawling. So record the decision next to each document at crawl time, along with a hash of the exact file you based it on:
import sqlite3
from datetime import datetime, timezone
from aipref import training_preference # the checker above
from content_signal import content_signal_ai_train
db = sqlite3.connect("corpus.db")
db.executescript("""
CREATE TABLE IF NOT EXISTS docs (
url TEXT PRIMARY KEY,
fetched_at TEXT NOT NULL,
robots_state TEXT NOT NULL, -- ok | unavailable | blocked | blocked_with_body | unreachable
robots_sha256 TEXT,
aipref TEXT, -- against | in_favor | NULL (none expressed)
content_signal TEXT, -- no | yes | NULL
body TEXT
);
""")
def decide(robots: dict, url: str) -> tuple:
if robots["state"] in ("ok", "blocked_with_body"):
return (training_preference(robots["body"], url),
content_signal_ai_train(robots["body"]))
return None, None
def save(url: str, html: str, robots: dict):
pref, signal = decide(robots, url)
db.execute("INSERT OR REPLACE INTO docs VALUES (?,?,?,?,?,?,?)",
(url, datetime.now(timezone.utc).isoformat(), robots["state"],
robots.get("sha256"), pref, signal, html))
db.commit()
Keep the raw robots.txt files too, keyed by hash. If someone asks why a page is in your corpus, you can show the exact file and the decision it produced. For large corpora, store the bodies in object storage and keep only metadata in the table.
Filter at Dataset Build Time
Because the token governs use rather than crawling, the natural enforcement point is when you assemble a training set, not when you crawl. A page you're allowed to fetch for a price monitor or search index may still carry a preference against training. Filter on the stored columns:
-- Documents eligible for a generative-model training set
SELECT url FROM docs
WHERE robots_state IN ('ok', 'blocked_with_body', 'unavailable')
AND COALESCE(aipref, '') <> 'against'
AND COALESCE(content_signal, '') <> 'no';
-- What you are holding back, and why
SELECT CASE
WHEN robots_state IN ('blocked', 'unreachable') THEN 'robots unknown: refetch'
WHEN aipref = 'against' THEN 'aipref against'
WHEN content_signal = 'no' THEN 'content-signal ai-train=no'
END AS reason,
COUNT(*) AS docs
FROM docs
WHERE robots_state IN ('blocked', 'unreachable')
OR aipref = 'against' OR content_signal = 'no'
GROUP BY reason;
We loaded seven sample rows built from the surveyed files. The first query kept three: a nytimes.com page, a /press-kit/ page explicitly in favor, and a page whose robots.txt returned 404. The second reported one held for aipref against (IMDb), two for content-signal ai-train=no (The Atlantic, Stack Overflow), and one for robots unknown: refetch.
Look closely at that nytimes.com row. It passes both checks because the file has no token group and no Content-Signal line, yet the same file disallows GPTBot, CCBot, ClaudeBot and Google-Extended by name. Under the draft those named groups aren't a preference in this mechanism's sense, but the site's intent is hard to miss. Most teams will want a third stored column for "blocks named AI training crawlers" and exclude on it too.
Holding unknowns rather than including them is also our recommendation, not the draft's. A 5xx today might hide a Disallow: / you'd have honored. Refetch those origins, and only release the pages once you have a real file. See proxies for AI training data for the collection side, and remember that robots.txt sits alongside terms of service and the law, not in place of them. Our overview of whether proxies are legal for business use is a starting point, not legal advice.
If You Run the Site: Writing the Group
To opt your own site out of AI training while staying crawlable for search, add the group and leave your existing rules alone:
User-agent: *
Allow: /
User-Agent: __usage_ai-training
Disallow: /
Allow: /docs/
That keeps /docs/ available for training (useful if you want models to know your product) and opts everything else out. Check one side effect first. Google says that if you use the token without a separate Google-Extended group, it treats you as having disallowed Google-Extended. Google-Extended also governs grounding in Gemini Apps, so a site that only meant to stop training could lose Gemini citations. Add an explicit User-agent: Google-Extended group if you want grounding to continue.
Frequently asked questions
FAQ
It's a robots.txt group with User-Agent: __usage_ai-training, defined in an IETF Internet-Draft from the aipref working group. Disallow paths express a preference against using that content to train generative AI models, and Allow paths express a preference in favor.
No. The draft states it is not a directive for crawling behavior. It describes how content may be used. To limit crawling, keep using groups for each crawler's own user agent.
Anthropic, OpenAI, Google and Microsoft said in November 2026 that they will. Anthropic has started implementing, Microsoft begins on February 1, 2027, Google targets 2027 and OpenAI said "over the next few months". Meta has not committed.
No. In our tests it got all four sample files wrong, because it uses first-match ordering, substring user-agent matching and no wildcard support. Check for the token line yourself and use an RFC 9309 parser such as Protego for the path matching.
No. The draft says wildcard groups must not be interpreted as matching the policy token. If no group names the token, no preference has been expressed.
Content-Signal is a separate convention from Cloudflare, written as a line such as Content-Signal: ai-train=no inside robots.txt. The __usage_ai-training token is a robots.txt group defined in an IETF draft. They express similar wishes, so a careful data pipeline reads both.
Get 20% off your first month
Premium datacentre proxies with unlimited bandwidth. Use the code at checkout.
Save up to 15% more on quarterly, half-yearly and yearly plans
Related articles

Turnstile Token Missing, Rejected or Expired: Fixes
Fix Turnstile token errors on your own forms: missing-input-response, invalid-input-response, timeout-or-duplicate, the 300-second rule and test keys.

Claude Code Web Fetch 403: Why Agents Get Blocked
Why Claude Code's WebFetch gets 403 errors: the Claude-User agent, Cloudflare agent policies, JS challenges and no JS execution, plus fixes that respect sites.

Cloudflare Error 1020 Access Denied: Scraper Fixes
Cloudflare error 1020 means a site's security rule blocked you, not a rate limit. Tell it apart from 'Sorry, you have been blocked', 1010 and 1015, and fix it.
