Markdown for Agents delivers AI‑optimized, token‑efficient content by converting HTML pages to markdown on‑the‑fly.
When an AI agent requests a page with an Accept: text/markdown header, Cloudflare fetches the original HTML, transforms it into clean markdown, and returns the result instantly. This approach treats agents as first‑class citizens, cutting token usage dramatically while preserving the author’s intent.
How the conversion process works
The system hinges on standard content negotiation and Cloudflare’s edge computing layer. After detecting the markdown request, the edge worker runs a parser, strips non‑semantic markup, and produces a lightweight markdown document.
- Client sends
Accept: text/markdownheader. - Edge node retrieves original HTML from the origin server.
- HTML is parsed; extraneous tags (divs, scripts, nav) are removed.
- Semantic elements are mapped to markdown syntax (e.g.,
<h2>→##). - Response includes
x-markdown-tokensheader for token‑count insight.
Implementation steps for site owners
Activating Markdown for Agents requires only a few clicks in the Cloudflare dashboard and a modest update to your HTTP headers.
- Log into Cloudflare, select the target zone, and toggle **Markdown for Agents** under Quick Actions.
- Ensure your origin serves valid HTML (well‑formed tags, proper
doctype). - Optionally add
Cache‑Controldirectives to control markdown cache freshness. - Test with
curl -H "Accept: text/markdown" https://example.com/pageand verify thecontent‑type: text/markdownheader. - Monitor
x-markdown-tokensto gauge token savings for downstream AI models.
Benefits for AI crawlers and agents
Providing markdown directly improves parsing speed, reduces token consumption, and aligns with the format most large‑language models prefer (Markdown).
- Lower token cost: markdown trims markup overhead by up to 80%.
- Faster ingestion: agents skip HTML‑to‑markdown conversion.
- Clear semantics: headings, lists, and links are explicit, aiding context extraction.
- Content‑Signal headers (e.g.,
ai‑train=yes) inform agents of permissible uses. - Improved ranking in AI‑driven discovery platforms that prioritize structured content.
Monitoring, analytics, and policy control
Cloudflare Radar now surfaces AI‑specific traffic metrics, letting you track markdown consumption across bots and agents.
- Use the AI Insights dashboard to view
content_type=text/markdowndistribution. - Set custom Content‑Signal policies to restrict training or commercial use.
- Leverage the public API for automated reporting on markdown request volumes.
- Combine with agentic AI strategies for end‑to‑end AI‑first workflows.
- Integrate with Zero‑Trust controls (see guide) to secure markdown endpoints.