Give AI Agents the Markdown They Actually Want Fastly released an open-source JavaScript service for its Compute platform that automatically converts web pages into clean Markdown for AI crawlers, reducing bandwidth and parsing overhead. The service, deployable in about 200 lines of code, detects AI user-agents and serves Markdown instead of HTML, addressing the fact that bots account for 49% of web requests. This approach improves efficiency for LLM training pipelines and retrieval systems that natively consume Markdown. AI crawlers are going to ask for your pages whether you're ready for them or not. Today they get HTML, same as any browser, and they spend CPU cycles stripping your nav and footer to find the article underneath. This post walks through a small Fastly Compute service that meets them in the middle: normal requests still get your site, while agents get a clean Markdown version of the same content. We can easily accomplish this with about 200 lines of JavaScript, which you can find in the repo here https://github.com/fastly/html-2-md . You can skim the pipeline section to see the shape, or clone and deploy if you want to get there faster. Why This Matters Our own Security Research report https://learn.fastly.com/Security-Threat-Insights-Report found that bots account for 49% of requests. The vast majority is unwanted traffic, and verified AI is only a sliver of what's left, but that sliver carries outsized business impact. A single hit from GPTBot, PerplexityBot, or ChatGPT-User isn't one user. It's every real user who'll eventually see your content through a large language model instead of on your site. Getting that experience right is worth a little engineering. The problem with serving those crawlers HTML: they don't want it. LLM training pipelines and retrieval systems operate on text. So when a crawler pulls your product documentation and needs to turn it into answers, HTML is overhead for them. It has to be parsed, stripped of boilerplate, de-noised of tracking pixels and menu chrome, and flattened into plain text. Some of that cleanup is lossy, especially tables, code blocks, and footnotes, which often show up mangled in downstream summaries. Markdown sidesteps most of that, it's what those existing pipelines already speak natively. And it's small, a typical article compresses to 20-30% of its HTML size, which means less bandwidth and fewer tokens burned on your structure instead of your ideas. The catch is that rewriting everything to serve Markdown at origin isn't realistic for most teams, and you don't want to anyway. Browsers still need the HTML. What you want is a transform that runs on the request path, doesn't slow things down, and caches well so you're not paying for the same work twice. What We're Building A small JavaScript service on Fastly Compute https://www.fastly.com/products/edge-compute that sits in front of your origin and does three things based on who's asking: A normal browser request gets HTML, passed through origin untouched. An AI crawler user-agent we detect 17 of them by default or a request with Accept: text/markdown gets a Markdown version of the same page.An explicit /md/