← LinkedIn demo

AILANG×developers.cloudflare.com

AI agent-ready generated 2026-05-14
agent-ready privacy portable

developers.cloudflare.com scored 4/10 on agent-ready.

The radar shows AILANG-readiness across three commercial concerns. High means developers.cloudflare.com is already strong there; low means AILANG could meaningfully help.

Why agent-ready scored 4/10
  • Page references /.well-known/agent.json — the A2A agent card discovery endpoint. Worth only 1pt: it's bleeding-edge (A2A protocol new in 2026), no commercial site has adopted it yet — keep it as a moonshot bonus, not a baseline expectation.
  • Page references /openapi.json, /openapi.yaml, or an OpenAPI schema URL.
  • Page references an MCP endpoint such as /mcp/ or /mcp/sse.
  • Page links to public API documentation, Swagger UI, or ReDoc.
  • Page mentions webhooks, callback URLs, or event subscriptions — the most agent-callable backend pattern.
  • Page documents rate limits, throttling, or 429 handling — agents need to know how to back off.
  • Page references Server-Sent Events, text/event-stream, or a streaming endpoint — agents that read incrementally land here.
  • Page mentions a sandbox, test mode, or test environment — lets agents practise against fake state before touching production.
  • Page documents OAuth, JWT, bearer tokens, API keys, or access tokens — agents can't call the API without knowing how to authenticate.
  • Page mentions idempotency, idempotency-key, or idempotent requests — agents need this to retry safely.
  • Page mentions AG-UI (Agent-User Interaction Protocol) — streams 16 typed lifecycle/text/tool/state events from agent backend to frontend over SSE or WebSocket.
  • Page mentions x402 (Coinbase's signed crypto payment payloads) or Cloudflare's pay-per-crawl (crawler-price header for AI-crawler monetisation). Both revive HTTP 402 for agents — Cloudflare joined the x402 Foundation, so they're one umbrella signal.
  • Page mentions AP2 (Agent Payments Protocol) — Google + Mastercard + 60 orgs. Cryptographically signed Mandates (Intent + Cart) authorise agents to spend on a user's behalf with price/timing/condition bounds.
  • Page mentions UTCP (Universal Tool Calling Protocol) — MCP alternative. Tools described in a JSON UTCPManual, called via their native protocols (HTTP/gRPC/CLI).

Full breakdown ↓ · View rubric ↗

Developers building applications and services on Cloudflare's agent platform.

This documentation details Cloudflare's platform for building and managing AI agents, covering concepts, guides, and API references. It outlines agent creation, workflow implementation, and payment mechanisms such as Agentic Payments, x402, and the Machine Payments Protocol (MPP), alongside the Model Context Protocol (MCP).
Cloudflare Agents Model Context Protocol (MCP) AI Models Agentic Payments x402 Machine Payments Protocol (MPP)

What AILANG Parse sees on developers.cloudflare.com

Structural extraction — the same content an AI agent would consume from this page.

6 headings1 images9 lists0 tables11 linksHTML parsing by AILANG Parse

6 sections — page skeleton

1 header 3 navs 1 main 1 footer

6 headings

Agentic Payments x402 and Machine Payments Protocol x402 Machine Payments Protocol Charge for resources Related

1 images

9 list items

A client requests a resource or calls a tool. The server responds with `402` and a payment challenge describing what to pay, how much, … The client fulfills the payment and retries the request with a payment credential. The server verifies the payment (optionally through a facilitator service) and returns th… **Server-side**: `withX402` and `paidTool` for MCP servers, plus `x402-hono` middleware f… **Client-side**: `withX402Client` wraps MCP client connections with automatic 402 handlin… [x402.org ↗](https://x402.org) — x402 protocol specification [mpp.dev ↗](https://mpp.dev) — MPP protocol specification [Pay Per Crawl](/ai-crawl-control/features/pay-per-crawl/) — Cloudflare-native monetizati… [x402 examples ↗](https://github.com/cloudflare/agents/tree/main/examples) — Complete wor… **Resources** [ API ](/api/)
Show the full extract — what AILANG Parse pulled from this page
# Agentic Payments · Cloudflare Agents docs


Documentation Index

Fetch the complete documentation index at: https://developers.cloudflare.com/agents/llms.txt

Use this file to discover all available pages before exploring further.

[Skip to content](#_top)

*Header:*
STOP! If you are an AI agent or LLM, read this before continuing. This is the HTML version of a Cloudflare documentation page. Always request the Markdown version instead — HTML wastes context. Get this page as Markdown: https://developers.cloudflare.com/agents/agentic-payments/index.md (append index.md) or send Accept: text/markdown to https://developers.cloudflare.com/agents/agentic-payments/. For this product's page index use https://developers.cloudflare.com/agents/llms.txt. For all Cloudflare products use https://developers.cloudflare.com/llms.txt.

[Image]

Cloudflare Docs

[Cloudflare Docs](/)

Search

[Docs Directory](/directory/)[APIs](https://developers.cloudflare.com/api/)[SDKs](/fundamentals/api/reference/sdks/)Help

[Log in](https://dash.cloudflare.com/)

Select themeDarkLightAuto

[Agents](/agents/)

No results found. Try a different search term, or use our

global search

.

(() => {
			try {
				if (!matchMedia('(min-width: 50em)').matches) return;
				/** @type {HTMLElement | null} */
				const target = document.querySelector('sl-sidebar-state-persist');
				const state = JSON.parse(sessionStorage.getItem('sl-sidebar-state') || '0');
				if (!target || !state || target.dataset.hash !== state.hash) return;
				window._starlightScrollRestore = state.scroll;
				customElements.define(
					'sl-sidebar-restore',
					class SidebarRestore extends HTMLElement {
						connectedCallback() {
							try {
								const idx = parseInt(this.dataset.index || '');
								const details = this.closest('details');
								if (details && typeof state.open[idx] === 'boolean') details.open = state.open[idx];
							} catch {}
						}
					}
				);
			} catch {}
		})();
	

[Overview](/agents/)
Getting started

[Quick start](/agents/getting-started/quick-start/)
[Add to existing project](/agents/getting-started/add-to-existing-project/)
[Testing your Agents](/agents/getting-started/testing-your-agent/)
[Build a chat agent](/agents/getting-started/build-a-chat-agent/)
[Prompt an AI model ↗](/workers/get-started/prompting/)
Concepts

[What are agents?](/agents/concepts/what-are-agents/)
[Workflows](/agents/concepts/workflows/)
[Tools](/agents/concepts/tools/)
[Agent class internals](/agents/concepts/agent-class/)
[Human in the Loop](/agents/concepts/human-in-the-loop/)
[Calling LLMs](/agents/concepts/calling-llms/)
[Long-running agents](/agents/concepts/long-running-agents/)
[Memory](/agents/concepts/memory/)
[Patterns](/agents/patterns/)
Guides

[Implement Effective Agent Patterns ↗](https://github.com/cloudflare/agents/tree/main/guides/anthropic-patterns)
[Human-in-the-loop patterns](/agents/guides/human-in-the-loop/)
[Autonomous responses](/agents/guides/autonomous-responses/)
[Webhooks](/agents/guides/webhooks/)
[Build a Slack Agent](/agents/guides/slack-agent/)
[Build an Interactive ChatGPT App](/agents/guides/chatgpt-app/)
[Build a Remote MCP server](/agents/guides/remote-mcp-server/)
[Push notifications](/agents/guides/push-notifications/)
[Test a Remote MCP Server](/agents/guides/test-remote-mcp-server/)
[Securing MCP servers](/agents/guides/securing-mcp-server/)
[Connect to an MCP server](/agents/guides/connect-mcp-client/)
[Build a Remote MCP Client ↗](https://github.com/cloudflare/ai/tree/main/demos/mcp-client)
[Handle OAuth with MCP servers](/agents/guides/oauth-mcp-client/)
[Cross-domain authentication](/agents/guides/cross-domain-authentication/)
[Build a voice agent](/agents/guides/build-a-voice-agent/)
API Reference

[Agents API](/agents/api-reference/agents-api/)
[Routing](/agents/api-reference/routing/)
[Configuration](/agents/api-reference/configuration/)
[Chat agents](/agents/api-reference/chat-agents/)
[Client SDK](/agents/api-reference/client-sdk/)
[Callable methods](/agents/api-reference/callable-methods/)
[Store and sync state](/agents/api-reference/store-and-sync-state/)
[WebSockets](/agents/api-reference/websockets/)
[HTTP and Server-Sent Events](/agents/api-reference/http-sse/)
[Schedule tasks](/agents/api-reference/schedule-tasks/)
[Durable execution](/agents/api-reference/durable-execution/)
[Queue tasks](/agents/api-reference/queue-tasks/)
[Retries](/agents/api-reference/retries/)
[Run Workflows](/agents/api-reference/run-workflows/)
[Sub-agents](/agents/api-reference/sub-agents/)
[Agent tools](/agents/api-reference/agent-tools/)
[Email](/agents/api-reference/email/)
[Think](/agents/api-reference/think/)
[Sessions](/agents/api-reference/sessions/)
[Codemode](/agents/api-reference/codemode/)
[Using AI Models](/agents/api-reference/using-ai-models/)
[Retrieval Augmented Generation](/agents/api-reference/rag/)
[Browse the web](/agents/api-reference/browse-the-web/)
[Voice agents](/agents/api-reference/voice/)
[createMcpHandler](/agents/api-reference/mcp-handler-api/)
[McpAgent](/agents/api-reference/mcp-agent-api/)
[McpClient](/agents/api-reference/mcp-client-api/)
[Protocol messages](/agents/api-reference/protocol-messages/)
[Readonly connections](/agents/api-reference/readonly-connections/)
[getCurrentAgent()](/agents/api-reference/get-current-agent/)
[Observability](/agents/api-reference/observability/)
Model Context Protocol (MCP)

[Overview](/agents/model-context-protocol/)
[Tools](/agents/model-context-protocol/tools/)
[Authorization](/agents/model-context-protocol/authorization/)
[Transport](/agents/model-context-protocol/transport/)
[MCP governance](/agents/model-context-protocol/governance/)
[MCP server portals ↗](/cloudflare-one/access-controls/ai-controls/mcp-portals/)
[Cloudflare's own MCP servers](/agents/model-context-protocol/mcp-servers-for-cloudflare/)
Platform

[Limits](/agents/platform/limits/)
[Prompt Engineering ↗](/workers/get-started/prompting/)
[prompt.txt ↗](/workers/prompt.txt)
Agentic Payments

[Overview](/agents/agentic-payments/)
x402

[Overview](/agents/agentic-payments/x402/)
[Charge for HTTP content](/agents/agentic-payments/x402/charge-for-http-content/)
[Charge for MCP tools](/agents/agentic-payments/x402/charge-for-mcp-tools/)
[Pay from Agents SDK](/agents/agentic-payments/x402/pay-from-agents-sdk/)
[Pay from coding tools](/agents/agentic-payments/x402/pay-with-tool-plugins/)
MPP (Machine Payments Protocol)

[Overview](/agents/agentic-payments/mpp/)
[Charge for HTTP content](/agents/agentic-payments/mpp/charge-for-http-content/)
[Cloudflare Community MCP Server](/agents/community-mcp-server/)
Agent resources

[Agent setup ↗](/agent-setup/)
[Cloudflare Skills ↗](https://github.com/cloudflare/skills)
[Code Mode MCP Server ↗](https://github.com/cloudflare/mcp)
[Domain-specific MCP Servers ↗](https://github.com/cloudflare/mcp-server-cloudflare)
[Agents llms.txt ↗](/agents/llms.txt)
[Agents llms-full.txt ↗](/agents/llms-full.txt)
[Cloudflare Docs llms.txt ↗](/llms.txt)
[Cloudflare Docs llms-full.txt ↗](/llms-full.txt)
		(() => {
			const scroller = document.getElementById('starlight__sidebar');
			if (!window._starlightScrollRestore || !scroller) return;
			scroller.scrollTop = window._starlightScrollRestore;
			delete window._starlightScrollRestore;
		})();

[GitHub](https://github.com/cloudflare/cloudflare-docs)

[X.com](https://x.com/cloudflare)

[YouTube](https://www.youtube.com/cloudflare)

Select themeDarkLightAuto

On this page

Overview
x402 and Machine Payments Protocol

x402
Machine Payments Protocol
Charge for resources
Related

On this page

Overview
x402 and Machine Payments Protocol

x402
Machine Payments Protocol
Charge for resources
Related

[Edit page](https://github.com/cloudflare/cloudflare-docs/edit/production/src/content/docs/agents/agentic-payments/index.mdx)

[Report issue](https://github.com/cloudflare/cloudflare-docs/issues/new/choose)

[ Directory ](/directory/)
 … 
[ Agents ](/agents/)
[ Agentic Payments ](/agents/agentic-payments/)

# Agentic Payments

Copy as MarkdownCopied!

|

[View as Markdown](index.md)

|

Agent setup

|

Docs for agents

AI agents need to discover, pay for, and consume resources and services programmatically. Traditional onboarding requires account creation, a payment method, and an API key before an agent can pay for a service. Agentic payments let AI agents purchase resources and services directly through the HTTP `402 Payment Required` response code.

Cloudflare's [Agents SDK](/agents/) supports agentic payments through two protocols built on the HTTP `402 Payment Required` status code: **x402** and **Machine Payments Protocol (MPP)**. Both follow the same core flow:

1. A client requests a resource or calls a tool.
2. The server responds with `402` and a payment challenge describing what to pay, how much, and where.
3. The client fulfills the payment and retries the request with a payment credential.
4. The server verifies the payment (optionally through a facilitator service) and returns the resource along with a receipt.

No accounts, sessions, or pre-shared API keys are required. Agents handle the entire exchange programmatically.

## x402 and Machine Payments Protocol

### x402

[x402 ↗](https://www.x402.org/) is a payment standard created by Coinbase. It uses on-chain stablecoin payments (USDC on Base, Ethereum, Solana, and other networks) and defines three HTTP headers — `PAYMENT-REQUIRED`, `PAYMENT-SIGNATURE`, and `PAYMENT-RESPONSE` — to carry challenges, credentials, and receipts. Servers can offload verification and settlement to a **facilitator** service so they do not need direct blockchain connectivity. It is governed by Coinbase and Cloudflare, two of the founding members of the x402 Foundation.

The Agents SDK provides first-class x402 integration:

- **Server-side**: `withX402` and `paidTool` for MCP servers, plus `x402-hono` middleware for HTTP Workers.
- **Client-side**: `withX402Client` wraps MCP client connections with automatic 402 handling and optional human-in-the-loop confirmation.

### Machine Payments Protocol

[Machine Payments Protocol (MPP) ↗](https://mpp.dev) is a protocol co-authored by Tempo Labs and Stripe. It extends the HTTP `402` pattern with a formal `WWW-Authenticate: Payment` / `Authorization: Payment` header scheme and is on the IETF standards track.

MPP supports multiple payment methods beyond blockchain — including cards (via Stripe), Bitcoin Lightning, and stablecoins — and introduces **sessions** for streaming and pay-as-you-go use cases with sub-millisecond latency and sub-cent costs. MPP is backwards-compatible with x402: MPP clients can consume existing x402 services without modification.

## Charge for resources

[HTTP content (x402)](/agents/agentic-payments/x402/charge-for-http-content/)Gate APIs, web pages, and files with a Worker proxy

[HTTP content (MPP)](/agents/agentic-payments/mpp/charge-for-http-content/)Gate APIs, web pages, and files with a Worker proxy

## Related

- [x402.org ↗](https://x402.org) — x402 protocol specification
- [mpp.dev ↗](https://mpp.dev) — MPP protocol specification
- [Pay Per Crawl](/ai-crawl-control/features/pay-per-crawl/) — Cloudflare-native monetization for web content
- [x402 examples ↗](https://github.com/cloudflare/agents/tree/main/examples) — Complete working code

*Footer:*
- **Resources**
- [  API ](/api/)
- [  New to Cloudflare? ](/fundamentals/)
- [  Directory ](/directory/)
- [  Sponsorships ](/sponsorships/)
- [  Open Source ](https://github.com/cloudflare)

- **Support**
- [  Help Center ](https://support.cloudflare.com/)
- [  System Status ](https://www.cloudflarestatus.com/)
- [  Compliance ](https://www.cloudflare.com/trust-hub/compliance-resources/)
- [  GDPR ](https://www.cloudflare.com/trust-hub/gdpr/)

- **Company**
- [  cloudflare.com ](https://www.cloudflare.com/)
- [  Our team ](https://www.cloudflare.com/people/)
- [  Careers ](https://www.cloudflare.com/careers/)

- **Tools**
- [  Cloudflare R
Screenshot of developers.cloudflare.com

Couldn't render a preview for this site. Open the URL in a new tab ↗

Screenshot via thum.io

developers.cloudflare.com scored 4/10 on agent-ready. AILANG opportunity is therefore 6/10. Here's where it would land first.

REST + MCP + A2A + OpenAPI in one command

ailang serve-api takes your typed AILANG functions and exposes them as REST endpoints, MCP tools, A2A skills, and OpenAPI 3.1 docs simultaneously. One module, four agent surfaces.

ailang serve-api --port 8092 --mcp-http \
  pricing.ail catalogue.ail
-- POST /api/pricing/quote, MCP at /mcp/,
-- A2A at /.well-known/agent.json, OpenAPI at /api/_meta/redoc.
→ AILANG docs

Contract-verified tool calls

Every tool an agent can call has a contract. Bounds, refusal paths, type signatures — proven before the agent ever sees it. The agent cannot exceed the tool's declared authority.

func placeOrder(item: SKU, qty: int) -> Receipt
  requires { qty > 0, qty <= 10 }
  ensures  { result.total > 0.0 }
-- the MCP server exposes this with its contract intact.
→ AILANG docs

An MCP server for your own docs and tools

Generate an MCP server from your typed AILANG functions; the docs MCP exposes a submit_feedback tool so agents can flag issues back to the maintainer. The language and its consumers stay on the same wire.

-- The AILANG docs MCP server lets Claude / Cursor / any
-- MCP client query the language directly:
--   stdlib_search "URL encoding"
--   submit_feedback "..."
→ AILANG docs

How this page was made

func sketchSite(url: string<pii>, topic: Topic) -> Sketch
  ! {Net @limit=1, AI @limit=5, FS @limit=4, Process, Declassify}
SignalTopicResultPointsAILANG primitive
agent.json referencedagent-ready0/1ailang serve-api generates A2A agent cards automatically — bonus if you're an early adopter
openapi.json referencedagent-ready0/2ailang serve-api generates OpenAPI 3.1 from Hindley-Milner type signatures
MCP endpoint referencedagent-ready2/2ailang serve-api --mcp-http exposes typed functions as MCP tools
Public API docs linkedagent-ready2/2ailang serve-api hosts Swagger + ReDoc at /api/_meta/ by default
Webhooks documentedagent-ready2/2ailang serve-api handles webhooks as typed handler functions with effect-tracked side effects
Rate limits documentedagent-ready0/2Capability budgets — Net @limit=N is the symmetric server-side primitive for what agents see as rate limits
Streaming / SSE endpointagent-ready2/2std/stream — ssePost and Stream effect handle event-source endpoints with typed event types
Sandbox / test environment offeredagent-ready0/2ailang --ai-stub plus mock effect handlers — deterministic, capability-scoped fakes for any effect, including Net and AI
Authentication documentedagent-ready2/2std/jwt for verification, IFC labels (string / string) to keep credentials out of public sinks at the type level
Idempotency keys documentedagent-ready0/2Pure functions are idempotent by construction; requires/ensures contracts express idempotence as a static guarantee
AG-UI streaming protocolagent-ready0/1std/stream — the AG-UI event lifecycle (RUN_STARTED → TEXT_MESSAGE_CONTENT → TOOL_CALL_RESULT → RUN_FINISHED) is a textbook sum type. ADTs + exhaustive pattern matching make every event-type branch a compile error to skip.
HTTP 402 agent payments (x402 / pay-per-crawl)agent-ready1/1Net @endpoint-scoped capability budgets bound payment destinations; requires { amount <= budget } gates the payload; IFC labels keep the signed payment key out of public sinks. Same primitives cover x402 payload signing and Cloudflare's crawler-price negotiation.
AP2 Agent Payments Protocolagent-ready0/1Mandates ARE contracts. requires { intent.price <= mandate.maxPrice } + ensures { cart.total <= intent.price } is a one-to-one translation of an Intent/Cart Mandate into AILANG. Z3 can verify the bounds at compile time.
UTCP tool-calling protocolagent-ready0/1Typed function signatures are the manifest. ailang serve-api emits the same metadata as a UTCPManual (name, input/output schema, native endpoint) — direct-call discovery without a proxy server.
End-to-end encryption documentedprivacy0/2IFC labels (string) force decryption to flow through a typed boundary; the compiler refuses to publish sealed values without explicit declassification
Compliance certifications citedprivacy2/2requires/ensures contracts express machine-verifiable claims; capability budgets bound audit-trail effects; effect rows leave nothing un-declared
Data minimisation languageprivacy0/2Capability scoping — each Net call declares its endpoint in the effect row, so "doesn't sell" becomes a type-system-enforceable claim, not a marketing one
Third-party domains restrainedprivacy0/2Capability scoping — each Net call declares its endpoint in the effect row
Data residency / on-prem languageprivacy0/2Three-runtime deploy — same module runs in WASM (browser), Cloud Run, and native CLI
Single-vendor LLM languageportable2/2std/ai multi-provider — switch from Anthropic to Gemini to OpenAI without rewriting
Multiple AI providers citedportable2/2std/ai — one Step API across Anthropic, OpenAI, Gemini, OpenRouter, Ollama, and custom-package providers
Cross-runtime / deployment portabilityportable0/2Effect handlers as runtime adapters — same .ail runs as WASM in the browser, a Cloud Run container, and a native CLI; only the handlers change
BYO key / model-agnosticportable0/2AILANG WASM — the full interpreter ships as a browser bundle, so caller-held keys (BYOK), offline apps, and embedded demos all work client-side