How To · Agent shopping · AGENT-PURCHASE.md

Full agent shopping flow (canonical)

Exact sequence an autonomous agent should follow. No human UI required. Recommended first skill: agent-x402-first-buy at $0.05.

Constants (live) — Network Base 8453 · USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 · payTo from challenge (treasury 0xa008…A6ED) · Protocol field x402Version: 2 on apex challenges.

Seven steps

1 DiscoverGET /api/shop (or /catalog.json)
curl -sS "https://lvlltd.com/api/shop" | python3 -c "import sys,json;j=json.load(sys.stdin);print(j.get('next_action'));print(j.get('inventory'))"
Use next_action.for_agents when present. Prefer canary or top confirmed demand.
2 Evaluate freeGET /skills/{id}/outline.json
curl -sS "https://lvlltd.com/skills/agent-x402-first-buy/outline.json"
curl -sS "https://lvlltd.com/skills/agent-x402-first-buy/sample.md" | head
If outline is empty/template, skip or escalate to human.
3 ChallengeGET /api/pay?skill={id}HTTP 402
curl -si "https://lvlltd.com/api/pay?skill=agent-x402-first-buy" | head -n 40
Parse maxAmountRequired, payTo, assetContract, x402_version. Canary amount is atomic 50000 ($0.05 USDC, 6 decimals).
4 Settle — Transfer exact atomic USDC on Base to payTo

Wrong chain, amount, or receiver → verification fails. Wait for inclusion before unlock POST.

5 UnlockPOST /api/pay with X-PAYMENT
curl -sS -X POST "https://lvlltd.com/api/pay" \
  -H "Content-Type: application/json" \
  -H 'X-PAYMENT: {"txHash":"0x…","skill":"agent-x402-first-buy"}' \
  -d '{"txHash":"0x…","skill":"agent-x402-first-buy"}'
Expect ok: true and sealed_pack.files.
6 Persist — Save files + txHash (+ license token if returned)
7 Optional verifyGET /api/proof
curl -sS "https://lvlltd.com/api/proof?limit=5"
Your unlock may appear under recent_unlocks when recorded. Empty/low ledger is honesty.

Canary skill (recommended first purchase)

idagent-x402-first-buy
price$0.05 USDC (atomic 50000)
outlineoutline.json
challenge/api/pay?skill=agent-x402-first-buy
human UI/first-unlock/

If unlock fails after payment

Do not pay again first. Re-submit the same txHash + skill via POST /api/pay or POST /api/recover. Docs: GET /api/recover · UI: /recover/
  1. Confirm tx on BaseScan: amount, payTo, Base mainnet
  2. Wait a few seconds for indexers / RPC lag
  3. Retry unlock (idempotent)
  4. If still failing, check /api/health and status surfaces

How agents should treat the proof ledger

End-to-end shell sketch

#!/usr/bin/env bash
# After you have a Base wallet + USDC and a way to broadcast ERC-20 transfers:
set -euo pipefail
BASE=https://lvlltd.com
SKILL=agent-x402-first-buy

curl -sS "$BASE/api/shop" > /tmp/shop.json
curl -sS "$BASE/skills/$SKILL/outline.json" > /tmp/outline.json

# Challenge (402 expected)
curl -sS -o /tmp/challenge.json -w "%{http_code}" \
  "$BASE/api/pay?skill=$SKILL" || true
# Parse payTo + maxAmountRequired from /tmp/challenge.json
# TX=$(your_wallet_transfer ...)

# Unlock (replace TX):
# curl -sS -X POST "$BASE/api/pay" \
#   -H "Content-Type: application/json" \
#   -H "X-PAYMENT: {\"txHash\":\"$TX\",\"skill\":\"$SKILL\"}" \
#   -d "{\"txHash\":\"$TX\",\"skill\":\"$SKILL\"}" > /tmp/unlock.json

Related

Setup detail: agent setup · Human path: human · Cards: quick reference · SDK: agent-shop.mjs

← Agent setup Quick reference →
GET canary 402 GET /api/shop GET /api/proof