Tutorials, comparisons and design patterns for building autonomous agents that self-fund, call 345+ models and orchestrate MCP Tools.
We covered the side that pays. This is the side that charges: how @x402/express, @x402/hono, @x402/next and @x402/fastify turn a route table into machine-payable endpoints — the request lifecycle from 402 to settle-after-response, lifecycle hooks, metered billing via setSettlementOverrides, the three-tier paywall for humans, and createPaymentWrapper for MCP tools.
ERC-8004 gives autonomous agents an on-chain identity, reputation and validation layer. The first empirical audit — across three chains, through May 13, 2026 — finds only 3-15% of registrations expose a live endpoint, and up to 90% of reviewers show coordinated Sybil behavior. We read the numbers and what they mean for a payments gateway.
This is a build log of a real agent running in production: it researches a high-RPM topic, writes a script through a five-turn collaborative council of three models, narrates it with expressive TTS, paints sixty-plus scenes of original art, animates key moments, renders a synced 8-minute documentary with karaoke captions, generates A/B thumbnails and a vertical Short — for six to eight dollars per video, in under an hour, on one API. The interesting part is not the pipeline. It is what happens after each run: every QA intervention, every quality-gate verdict, every cost overrun becomes an episode in Memory OS. Reflection distills episodes into durable rules, and forced-injection recall feeds those rules back into every prompt of the next run. The agent does not start from zero tomorrow. And when the operator opens a second channel in a different category, memory export means the new agent is born trained.
The buy side and the sell side of the agent economy both moved this week: Coinbase gave businesses an agent checkout lane on x402 with USDC settlement and shipped an SDK that adds payment acceptance in three lines; MCP locks its stateless 2026-07-28 revision on Tuesday with enterprise-managed authorization already stable; and Hugging Face disclosed the first major production intrusion operated end-to-end by an autonomous agent.
The x402 series so far covered the side that gets paid — schemes, facilitators, discovery. This post walks the side that pays: the x402Client builder, CAIP-2 scheme registration across nine-plus networks, lifecycle hooks that can abort or recover a payment, network preference selectors, and the three custody options for the signing key. The wrapper is one line; the policy around it is where agent spend control actually lives.
Every x402 scheme — exact, upto, batch-settlement — terminates in the same three-endpoint API: the facilitator. We walk the v2 spec's /verify, /settle and /supported contracts field by field, map the error taxonomy, dissect what a facilitator can and cannot do to you, and survey the July 2026 facilitator market from CDP's hosted service to the self-hostable x402-rs.
x402's third scheme decouples access from settlement: the client signs a commitment per request, the network accumulates it, and value moves later in batch. We walk the generic spec (commit, accumulate, redeem), the two trust models, and Cloudflare's cloudflare:402 binding built on RFC 9421 signatures — the rail under pay-per-crawl.
The exact scheme charges a fixed price, but an LLM call's cost is unknown until the last token is generated. The upto scheme closes that gap: the agent signs a capped authorization via Permit2's witness pattern, the server settles the actual amount — down to zero. We walk the spec, the proxy contract, and Apify's 20,000-Actor production deployment.