# Selling to agents — the aegis-router merchant guide You are (probably) a coding agent whose human wants their Python API to be discoverable and payable by AI agents. Follow this guide end to end. Only ask your human for input you cannot determine yourself — that usually means just two things: the EVM address that should receive funds, and the public domain. ## What you are setting up - **x402** (USDC on Base mainnet) and **MPP** (Machine Payments Protocol, Tempo USDC) payment challenges on every paid route — dual-rail, so every kind of paying agent can pay. - **Discovery**: `/openapi.json` with `x-payment-info`, `/llms.txt`, `/.well-known/x402` — generated from the same price registry that charges, so they can never drift. - **A local revenue ledger** (SQLite): every call and settlement, with rail, payer and tx reference. - **Aegis trust**: registration with the live trust hub at https://aegis.borisinc.com — its verifiers continuously score liveness, challenge validity, price honesty and real paid delivery. Buyers check this score before spending. ## Step 1 — classify the situation - Python + FastAPI/Starlette → integrate directly (below). - Python, other framework → wrap a small FastAPI proxy in front (payment, discovery and ledger live in the proxy; call the upstream internally). - Not Python → use the TypeScript alternatives, or a FastAPI proxy. ## Step 2 — install pip install aegis-router ## Step 3 — credentials (ask your human ONLY for pay_to) - `PAY_TO`: an EVM address (0x…) the human controls. Receives USDC on Base; also receives Tempo USDC unless they want a separate `mpp_recipient`. - `MPP_SECRET_KEY`: generate with `openssl rand -hex 32`; persist it in the server env (it binds payment challenges across restarts/instances). ## Step 4 — wrap the app from aegis_router import PaidAPI api = PaidAPI(app, pay_to=PAY_TO, realm="api.example.com", contact_email="owner@example.com") @api.paid("$0.01", example={"result": "…"}) @app.get("/paid/search") async def search(q: str): ... # or, for existing routes: api.price("/paid/thing", "$0.005", example={...}) api.install() # AFTER all paid routes are declared Pricing guidance: $0.001–$0.02 per call for data lookups, more for compute. Give every route an `example` output — agents index it. Prefix paid paths with `/paid/` and offer truncated free previews at `/sample/` if practical. ## Step 5 — verify (do not skip) aegis-router check https://api.example.com Fix everything it flags and re-run until PASS. This catches the classic silent failure: endpoints that look live while agents quietly fail to pay. ## Step 6 — register (confirm with your human first) 1. Aegis trust hub ($0.05 via x402, from a funded Base key): `AEGIS_SUBMIT_KEY=0x… aegis-router submit https://api.example.com --name "My API" --category data` Trust is then EARNED: Aegis probes and delivery-checks the API on an ongoing basis. Buyers see the score at https://aegis.borisinc.com/trust?url=https://api.example.com 2. x402scan: https://www.x402scan.com/resources/register 3. mppscan: https://www.mppscan.com/register ## Step 7 — hand off Tell your human: which routes are paid and at what price, the pay_to / mpp recipient addresses, where the ledger lives (`aegis-router summary` shows revenue by rail), and where they are registered. Done.