← Back
Cloudflare
Cloudflare cuts agent error token costs by 98% with RFC 9457-compliant responses
Cloudflare · featureapiintegrationperformance · blog.cloudflare.com ↗

Machine-Readable Errors for the Agentic Web

AI agents making billions of HTTP requests daily now encounter a fundamental problem: when they hit a Cloudflare error, they receive HTML pages designed for humans. These pages contain hundreds of lines of markup, CSS, and narrative copy that waste tokens and provide only clues rather than actionable instructions.

Starting today, Cloudflare returns RFC 9457-compliant structured error responses to agents that request them via Accept: text/markdown, Accept: application/json, or Accept: application/problem+json. Instead of parsing HTML, agents now receive machine-readable instructions with stable fields for classification and control flow.

Token Efficiency and Structured Guidance

The efficiency gains are dramatic: structured error responses cut payload size and token usage by more than 98% compared to HTML, measured against real 1015 (rate-limit) error responses. For agents navigating complex workflows that encounter multiple errors, savings compound quickly.

More importantly, the responses include explicit operational guidance:

  • retryable: Whether to attempt again
  • retry_after: How long to wait before retrying
  • owner_action_required: Whether the error requires human escalation
  • error_code, error_name, error_category: Machine-readable classification fields
  • ray_id, timestamp, zone: Deterministic identifiers for logging and support handoffs

Markdown responses include YAML frontmatter for machine parsing plus What happened and What you should do sections in prose. JSON responses follow RFC 9457 standards so any HTTP client understanding Problem Details can parse errors without Cloudflare-specific code.

Automatic, Network-Wide Rollout

This feature is live across the Cloudflare network automatically—no site owner configuration required. Browsers continue receiving HTML responses unless they explicitly request alternative formats. The rollout covers all 1xxx-class errors (DNS failures, access denials, rate limits) today, with support for 4xx and 5xx errors coming next.

What developers need to do: Agent frameworks and HTTP clients can immediately adopt RFC 9457-compliant structured errors by requesting the appropriate Accept header. No changes to Cloudflare configuration are needed.