RFC 9457-Compliant Error Responses Cut Agent Token Costs by 98%
Key point
Cloudflare returns 1xxx errors as Markdown and JSON, cutting token usage by over 98%.
Details
Cloudflare now provides structured Markdown and JSON error responses compliant with RFC 9457 for AI agents. For requests with Accept: text/markdown, application/json, or application/problem+json, it responds in a machine-readable format instead of the traditional heavy HTML error page, while browsers continue to receive HTML as before.
The primary target is Cloudflare's 1xxx class errors. For platform errors such as DNS issues, access blocks, and rate limits, fields like error_code, error_name, error_category, retryable, retry_after, owner_action_required, ray_id, timestamp, and zone are provided together, allowing agents to immediately determine whether to retry and what backoff strategy to use.
The Markdown response consists of YAML frontmatter and a descriptive body, while the JSON response contains both the base fields of RFC 9457 and extension fields. For example, a 1015 rate limit error includes an explicit instruction to "wait 30 seconds, then retry with exponential backoff," while errors that should not be retried, like 1020 or 1009, prompt the agent to stop and escalate.
The impact is significant. For a 1015 error, the HTML response was 46,645 bytes / 14,252 tokens, while the Markdown version was reduced to 798 bytes / 221 tokens and the JSON version to 970 bytes / 256 tokens, each representing roughly a 98% reduction in size and tokens compared to HTML.
Cloudflare has automatically applied this structure across its global network. Site operators need no separate configuration, and going forward, this contract is planned to expand beyond 1xxx errors to cover the 4xx/5xx errors that Cloudflare generates.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.