# Why I built two Cloudflare agent features myself

2026-11-27

Cloudflare offers Markdown for Agents and Search for Agents as switches. I tried both, and my Worker serves its own. One removed the ETag from every HTML page.

Markdown for Agents converts a page's HTML to Markdown when a client sends Accept: text/markdown. Search for Agents adds a search endpoint at /.well-known/search and four agent: meta tags to every HTML page. Each is a switch in the dashboard, and both run at Cloudflare's edge. Markdown for Agents is free on Pro plans and above. Search for Agents is in beta on all plans, with usage subject to AI Search pricing.

If your origin serves only HTML and you have no Worker of your own, the switches are worth trying, because they give you something you would otherwise have to build. Check your ETag before and after, as the last section shows. turva.dev is a special case, because its Worker holds every page as authored Markdown before anything is rendered. After trying both switches I serve both features from the Worker.

## Why the Worker serves Markdown itself

Every page here is Markdown in the Worker's source file. The Worker renders the prose of every HTML page from it and answers a request for text/markdown with the authored text, the page's Markdown twin, as [The twin is the page](/blog/the-twin-is-the-page) describes. On ten card pages, the home page among them, the layout around that prose stays code. The Markdown is the source of the text, so a converter that reads my HTML has to rebuild what the Worker already holds.

The Markdown also does more than answer an Accept header. I build llms-full.txt from it, the get_page tool of my MCP server reads it and the search route below searches it. I generate each page's FAQ structured data from it, and the parity test compares the HTML against it on every sitemap page except /auth.md and the two tool pages. Every page also answers at a .md address, and a request for a missing page that asks for Markdown gets a Markdown 404. A converter answers requests for pages. It gives me no source to build the rest from.

The Worker also puts a weak ETag on every cacheable 200 text response. The tag is a hash of the exact body, so a client that holds a page can send If-None-Match and get a 304 without the body. Cloudflare's documentation says a converted response loses its ETag and Last-Modified headers, because conditional requests cannot be honored for it.

## Markdown for Agents on 27 November

I switched it on at 09:39 UTC and compared the full dump of the site with what the Worker renders locally. All 174 HTML and Markdown responses in that dump were byte-identical to the Worker's local output, ETag included. For requests with a mixed Accept header, the Worker's own negotiation chose the response. None of the Markdown responses I probed for headers carried a Content-Signal header, which the documentation says a converted response gets when the origin sets none.

It changed nothing I could measure here, because the Worker answered every Markdown request in the dump itself and Cloudflare converts only HTML. The documentation says: "We only convert from HTML". I switched it off again after the measurement. The one effect I can name is hypothetical. If the Worker ever answered a Markdown request with HTML, the conversion would turn that HTML into Markdown and drop the tag, and a client would get Markdown that looks normal, so the mistake would be easy to miss.

## What a conversion of my pages looks like

The zone switch never showed me its Markdown, because the Worker answers first. So at 10:14 UTC I converted all 87 HTML pages with Workers AI toMarkdown instead. It is a REST API that Cloudflare's documentation lists beside Markdown for Agents as a separate conversion feature. The output had the layout that the Markdown for Agents documentation describes for its own responses: front matter from the meta tags, the body, and the JSON-LD as a fenced json block. That documentation also refers to the Workers AI conversion docs for its pre-processing. Neither page says the zone switch calls this API, so this shows what a conversion of my HTML looks like and does not prove what the zone switch would return.

The result is close to my own Markdown. The heading counts matched, 851 against 851, and so did the table rows, 401 against 401, and the FAQ sections on 58 of 58 pages. I compared each page's body text word by word with its twin. The median similarity was 0,991 and the lowest 0,9529, and 48 pages scored 0,99 or higher. That is expected when the prose of the HTML is rendered from the Markdown.

The differences were additions and small changes. Every page gained its JSON-LD as a json code block. Across the 87 pages that is 29 940 words, about 23 % of the 131 645 words in my twins. Every page also gained front matter and a Skip to content link. Outside the JSON-LD, toMarkdown added 495 backslash escapes on 64 pages. Of those, 345 sit before a period that follows a number, as in Level 2. Another 143, on 16 pages, sit inside field names: agent_auth came back with a backslash inside it, so a literal search for the name would miss. The 87 conversions total 1 112 111 bytes, against 789 368 for the twins.

For a site whose HTML is as clean as mine, this suggests a conversion loses little of the text. It says less about HTML built by hand or by a page builder. Cloudflare's documentation says toMarkdown is free for most format conversions. For a site that already has the source, the same output is a second copy with extra material in it.

## Search for Agents on 25 November

I switched it on at about 15:25 UTC and measured the whole site before and after. Every one of the 87 HTML pages grew by exactly 457 bytes, which is the four agent: meta tags in the head. Nothing else in the page changed, the Markdown twins were identical, and the isitagentready scanner read Level 5 with the switch on and off.

The ETag was gone. Cloudflare removed the Worker's weak ETag from all 87 HTML pages I fetched, and nothing replaced it. Markdown and JSON responses kept theirs.

I read the reason this way. The tag is a hash of the bytes the Worker sends, and once the edge adds four tags it delivers different bytes, so the tag would describe a body nobody received. Search for Agents converts nothing. It does change the body after the Worker has hashed it, so I expect the same reason applies as for a conversion. A client that fetched an HTML page while the feature was on got no tag, so it had nothing to send in If-None-Match. The Worker sends no Last-Modified date either, so If-Modified-Since had nothing to compare against and there was no way to get a 304 the next time.

The search endpoint was the other problem. /.well-known/search answered 503 with a try-again-later message about the index at 15:27 and again at 15:35, while every page already advertised it. Cloudflare's documentation says to wait for the crawl and indexing before searching, so that is expected for a new index. I switched the feature off at 15:37:35, about twelve minutes in, so I do not know how the endpoint answers once indexing has finished. The home page came back with the same ETag it had before.

## What I built, and what it costs

The Worker has its own route at /.well-known/search. It is a keyword search over every page in the sitemap except /auth.md. For each search word, a title match scores 10, a description match 3 and each body occurrence 1, at most 20 per word. The four meta tags are rendered by the Worker before the ETag is computed, so the tag is the hash of the final body and stays.

I left out the Accept-Query header. It would advertise the QUERY method, and this route answers GET and HEAD and turns QUERY away with a 405. The scanner accepts either that header or the results heading. Mine has the heading. The four agent: tags exist only in the HTML head. The Markdown twins carry no agent: front matter, and the scanner's pass note says so.

Three limits apply. My search is a plain substring match that does not stem words or know synonyms, while Cloudflare's documentation describes hybrid vector and keyword search, which is the better design for a question in natural language. Authoring the Markdown is work, and Cloudflare's switch saves it for a site that has none. I also did not measure how many clients send If-None-Match to turva.dev, so I cannot say what the lost tag would have cost.

The scanner's check for search is informational and does not affect the level or the score. Level 5 held with the switch on and with it off.

To check your own site, request an HTML page, copy its ETag and request it again with that value in If-None-Match. A 304 means conditional requests still work. If the first response has no ETag, there was nothing for a switch to remove.

## Frequently asked

**Does Cloudflare's Search for Agents remove the ETag?**

On turva.dev it did. With the switch on, Cloudflare removed the Worker's weak ETag from all 87 HTML pages, while Markdown and JSON responses kept theirs. A client that fetched an HTML page then had no tag to send in If-None-Match.

**Does Markdown for Agents change anything for a site that already serves Markdown?**

Nothing I could measure on turva.dev. Cloudflare converts only HTML, and the Worker answered every Markdown request itself. In a full dump of the site, all 174 HTML and Markdown responses matched the Worker's local output byte for byte, ETag included.

**How close is a Workers AI toMarkdown conversion to authored Markdown?**

Very close on prose. For the 87 pages of turva.dev, the median word-by-word similarity of body text was 0,991. The conversion added 29 940 words of JSON-LD, plus front matter, a skip link and 495 backslash escapes, 143 of them inside field names.

**How do I check whether a switch removed my ETag?**

Request an HTML page before and after you turn the switch on and compare the ETag headers. Then send the ETag in If-None-Match: a 304 means conditional requests still work. If the tag is missing only after the switch, the switch removed it.

Corrected 2026-11-28. The sentence on the missing tag now also says that the Worker sends no Last-Modified date, which is why a conditional request by date could not return a 304 either.

## Related

- [The twin is the page](/blog/the-twin-is-the-page)
- [HTML and Markdown can disagree](/blog/html-and-markdown-can-disagree)
- [Serving Markdown to AI clients](/guides/markdown-for-agents)
