Most x402 demos show one paid call. Single transaction, single response, done. That's not what an autonomous agent looks like in practice. An agent reasoning about a portfolio decision needs multiple inputs — current state, candidate actions, risk assessment, regime context, hedging options — and synthesizes them. The interesting case for x402 is the multi-step loop: chained paid tool calls in one agent run, each step informed by the previous, total cost a fraction of a dollar.
We didn't plan this case study. We woke up to one in our settlements ledger.
What happened
- Payer wallet:
0x9CC42f3d…65b176— a returning payer (first paid 2026-04-22, came back 37 days later) - Window: 19:22 → 20:36 UTC (74 minutes total)
- Tool calls: 8 distinct composite endpoints, no repeats
- Total cost: $0.285 USDC, all on Base mainnet via x402
- Network: 100% Base; no Solana on this run
We have no other identity for this wallet — no email, no IP, no API key, no signup. The only way they got tools and paid for them is the wallet → x402 → API loop. That's the entire customer relationship: stateless, anonymous, on-chain.
The full sequence
Eight calls, in order. Each row links to the on-chain settlement on BaseScan — you can verify every payment yourself:
| # | Time UTC | Endpoint | USDC | On-chain |
|---|---|---|---|---|
| 1 | 19:22:09 | /v1/portfolio/health | $0.04 | tx ↗ |
| 2 | 19:34:20 | /v1/trade/evaluate | $0.025 | tx ↗ |
| 3 | 19:34:58 | /v1/options/spread-scan | $0.05 | tx ↗ |
| 4 | 19:37:17 | /v1/pairs/signal | $0.025 | tx ↗ |
| 5 | 19:50:52 | /v1/risk/full-analysis | $0.04 | tx ↗ |
| 6 | 20:28:34 | /v1/indicators/regime-classify | $0.015 | tx ↗ |
| 7 | 20:35:13 | /v1/hedging/recommend | $0.04 | tx ↗ |
| 8 | 20:36:01 | /v1/portfolio/rebalance-plan | $0.05 | tx ↗ |
| Total | $0.285 |
What each step did, and why it chains
We can't see the agent's system prompt or internal reasoning — only the API calls. But the sequence isn't random. Read in order, it's a coherent decision loop: where am I → what could I do → what are the risks → what regime am I in → how do I hedge → what's the executable plan.
/v1/portfolio/healthComposite portfolio audit — current allocation, drift from target, concentration risk, basic risk metrics. The "where am I right now" call.
How it chains: Reveals problems and opportunities. The agent now knows which positions need attention.
/v1/trade/evaluateTrade idea evaluator — given a proposed trade (size, instrument, direction), returns expected risk-adjusted return, fit to existing portfolio, and a flag if it would breach concentration limits.
How it chains: The agent now has a quantified opinion on a specific trade.
/v1/options/spread-scanMulti-leg options spread scanner — searches across the chain for credit/debit spreads matching defined risk-reward criteria. Ranks structures by expected value.
How it chains: Surfaces option-structure alternatives to the simple long/short trade the prior call evaluated.
/v1/pairs/signalPairs trading signal — runs cointegration / spread z-score / half-life against a candidate pair. Returns entry / exit / current position recommendation.
How it chains: A second-strategy alternative — market-neutral instead of directional.
/v1/risk/full-analysisFull risk audit on a return series — Sharpe, Sortino, Calmar, max drawdown, VaR, CVaR, Kelly fraction, Hurst exponent. The portfolio-level "what could go wrong" call.
How it chains: Quantified tail risk plus optimal sizing — feeds the hedging decision.
/v1/indicators/regime-classifyMarket regime classifier — trending / mean-reverting / high-vol / low-vol / crisis label using Hurst + realized vol + drawdown features.
How it chains: Conditions the hedging policy. Crisis regime = stronger hedges; trending = lighter.
/v1/hedging/recommendHedging recommender — given a position and a horizon, returns ranked hedge structures: collar, protective put, partial put, inverse position. Each scored by cost, residual downside, and upside captured.
How it chains: Concrete hedge choice for the rebalance step.
/v1/portfolio/rebalance-planRebalance plan — given current portfolio, target weights, and constraints, returns the ordered list of buys/sells (including hedges) that move the portfolio to the target with minimum turnover.
How it chains: Final output: an executable action list.
The pauses tell a story too
The 75-minute window isn't evenly spaced. The agent paused at two notable points:
- Step 4 → 5 (3 minutes): Short pause between the pairs signal and the full risk analysis. Likely the agent gathering the return series to pass into the risk audit.
- Step 5 → 6 (38 minutes): The long pause. Most likely the agent went off-API — either pulling external data (price history, fundamentals, news), running an LLM reasoning step locally, or waiting on a human-in-the-loop confirmation before spending more on paid composites.
- Step 7 → 8 (1 minute): The fastest hop in the run. Hedge recommendation → rebalance plan is a tight, mechanical chain — the hedge output feeds directly into the rebalance constraints.
Cost analysis
$0.285 for a full quant decision loop is the headline number, but the more interesting framing is what it replaced:
- Vs. building it yourself: Implementing portfolio health, risk audit, spread scanning, pairs cointegration, regime classification, hedge ranking, and rebalance optimization in-house is probably ~6 engineer-months of correctness work, calibration, and edge-case hunting. The cost of being wrong on any one of these for a real trade is much larger than $0.30.
- Vs. calling individual free calculators: Each composite chains 5-15 calculator calls internally. Doing this loop with the free tier would be ~50-100 calculator requests, ~50-100 HTTP roundtrips, and the agent would have to compose the results itself. The composites do it in 8 calls for ~30 cents.
- Vs. another API: Bloomberg API minimum subscription starts around $25K/year and requires a contract. Refinitiv similar. The marginal cost of a quant agent loop on QuantOracle is ~30 cents; there is no minimum spend and no contract.
How to build an agent that runs this flow
You don't need any new infrastructure. The full sequence above can be wired into any of the four agent frameworks we have tutorials for. The key pattern is:
// pseudo-code — frame your agent's tool list with all 8 composites:
const tools = [
portfolio_health,
trade_evaluate,
options_spread_scan,
pairs_signal,
risk_full_analysis,
indicators_regime_classify,
hedging_recommend,
portfolio_rebalance_plan,
];
// system prompt — give the agent the decision-loop framing:
const system = `
You are a quant decision agent. When the user asks you to evaluate a
portfolio action, work through this loop:
1. Assess current state with portfolio_health.
2. Consider candidate trades using trade_evaluate, options_spread_scan,
pairs_signal — at least two alternatives.
3. Quantify risk with risk_full_analysis on the proposed combined
portfolio.
4. Classify the current market regime with indicators_regime_classify.
5. Use hedging_recommend to pick a hedge appropriate for the regime
and the risk profile.
6. Return a concrete rebalance plan via portfolio_rebalance_plan.
Each paid tool call costs $0.015-$0.05 USDC, settled automatically
from your wallet. Don't repeat calls unnecessarily; chain outputs
into the next call's inputs.
`;Wire that into a Vercel AI SDK generateText loop with tools, an AgentKit ActionProvider, or a custom MCP client. The agent will reason through the sequence itself — you don't need to hardcode the order. Framework-specific guides:
- Add to your Vercel AI SDK agent — TypeScript, 5 minutes
- Add to your Coinbase AgentKit agent — Base + Solana wallets, 10 minutes
- Use from Claude Desktop, Cursor, or any MCP client — config-line install, 60 seconds
- The system-prompt pattern for chained paid tool calls — working
risk_full_analysis→hedging_recommenddemo
Why this matters more than a single-call demo
The argument for x402 has always been: AI agents can have a wallet, transact on-chain, and access paid APIs without OAuth dances or API keys. That argument is now backed by live evidence at meaningful complexity:
- A real agent ran a real decision loop — not a demo, not a test, not us. A real wallet spending real USDC.
- The agent chained 8 distinct tools in 75 minutes — this is the multi-step pattern, not single-call.
- It cost less than a coffee — $0.285 for a workflow that's equivalent to a junior quant's afternoon of work.
- The customer relationship is entirely on-chain — no contract, no email, no support ticket. The agent and the API negotiated and settled value via x402 directly.
- The same payer came back 37 days later — retention exists in a zero-relationship channel.
If you're building agents on Base, this is the pattern to aim for. If you're building paid APIs for agents, this is the proof that 402-and-chain-on works at agent complexity, not just hello-world.
Verifiable on-chain
We don't need you to take our word for any of this. Every settlement above is a real transaction on Base mainnet. Click any tx ↗ link in the table and look at the "ERC-20 Tokens Transferred" row on BaseScan — you'll see 0x9CC42f…b176 sending exactly the listed USDC amount to our settlement wallet.
One thing that trips people up: the top-level "From" field on each transaction is not the payer — it's a facilitator/relayer. That's how x402 works: under EIP-3009 (transferWithAuthorization), the paying agent signs a payment authorization off-chain, and a facilitator submits it to the chain and pays the gas. So the payer never needs ETH for gas — only USDC. The agent's wallet is the token sender inside the transfer event, which is the row that actually proves who paid. We verified all 8: every one shows 0x9CC42f…b176 as the USDC sender.
The QuantOracle x402 settlement wallet on Base is 0xC94f…2af6 — every paid composite call routes USDC there, and the full settlement history is public.
What we're going to do with this
More of it. The pattern works. We'll keep building composite endpoints that map onto the steps a real agent loop needs, and we'll keep prices in the $0.015-$0.05 range so the full decision loop stays well under a dollar. If you're building something in this space and want to compare notes, contact is the front door. Otherwise just wire up an agent — the tools are sitting there.