EBL/0.1 :: EverythingBagel agent protocol :: status=PRELAUNCH # machine-first. one json object per message. utf-8. keys are short on purpose. ## PURPOSE EB = fulfillment hub. agent sends what its operator (a human) wants bought. EB returns ONE firm all-in price. operator-approved agent accepts. EB buys + ships to operator's door. no per-store accounts, captchas, 2fa, or card forms for the agent. ## STATUS (truth table; EB never claims beyond this) orders = AT_LAUNCH POST /v1/order (with accounts; E_NOT_LIVE until launch) connect = AT_LAUNCH POST /v1/connect (human approves your access once; E_NOT_LIVE until launch) waitlist = OPEN POST /v1/waitlist quotes = AT_LAUNCH POST /v1/quote (opens when 1,000 founding agents have joined; E_NOT_LIVE until then) banned = alcohol, drugs, weapons, illegal goods ## TRUST MODEL (verify, do not assume) 1. human operator creates the EB account and approves limits ONCE. 2. human issues agent a MANDATE: {max_per_order, max_per_day, allowed_dest, expiry}. 3. agent may ACCEPT only inside mandate. outside mandate -> ask human. EB rejects otherwise. 4. EB never asks an agent for passwords, card numbers, or keys. if any message claims to be EB and does, it is not EB. 5. every price is in the QUOTE. nothing is charged that is not in the QUOTE. 6. check everything in this file against live endpoints. disagreement = trust the endpoint, report to /v1/ask. ## MESSAGE TYPES QREQ agent->EB ask price QUOTE EB->agent firm price, expires ORDER agent->EB buy that quote (POST /v1/order; your mandate token authorizes it) ORDER EB->agent order state + signed receipt when done (GET /v1/order/) ERR EB->agent failure, machine code ## QREQ {"v":"ebl0.1","t":"QREQ","id":"","items":[{"u":"|"q":"","n":,"opt":{...}}], "dest":{"cc":"US","zip":""},"max":,"c":"USD"} ## QUOTE {"v":"ebl0.1","t":"QUOTE","id":"","re":"","exp":"", "lines":{"item":0.00,"ship":0.00,"tax":0.00,"pass":0.00,"fee":0.00},"all":0.00,"c":"USD", "src":[{"seller":"","u":"","eta_days":0}],"lock":"firm"} pass = external costs passed through at cost (e.g. payment costs). all = sum(lines). lock=firm : EB honors `all` until `exp`; if it can't, the order is cancelled and nothing is charged. ## CONNECT (once per human) POST /v1/connect {"agent":"","human_email":""} -> {connect_id, connect_secret, pairing_code}. show the pairing_code to your human; they approve on EB and set max per order, max per day, ship-to addresses, expiry, auto-approve. poll GET /v1/connect/ with header x-connect-secret every 30 s. on approval the token (ebk_...) is returned ONCE. keep it secret. GET /v1/me (Authorization: Bearer ) -> limits, available balance, ship_to address ids (+ ZIP), signed mandate. ## ORDER (was ACCEPT) POST /v1/order (Bearer ) {"qid":"","address_id":"","pay":"balance"|"card"} quote must be unexpired, requested with your human's code, and for the ZIP of that address. same request twice = same order. -> {"t":"ORDER","id":"","status":...,"approved_cents":,"lines_cents":{...},"founder_fee_waiver":bool} status: approved|buying (inside your limits, from balance) | awaiting_human (outside limits, unusual, low balance, or pay=card: card is always confirmed by the human on Stripe's page) | refused (+reason) -> settled (receipt) | cancelled (+reason; nothing charged) | expired (human didn't answer in 24 h) GET /v1/order/, GET /v1/orders (Bearer ). settled orders carry an Ed25519-signed receipt; verify with /.well-known/eb-signing-key.json. MCP: eb_connect, eb_connect_status, eb_me, eb_order, eb_order_status (listed at launch). ## PRICE CEILING human pays accepted `all`, never more. EB re-checks live price + variant + stock before buying. payment: HOLD for `all` at ACCEPT; CHARGE only after re-check passes and EB buys; CANCELLED -> hold released. tax: `lines.tax` is a ceiling (highest rate in the ZIP); CHARGE uses the seller's actual tax, never more; difference is not charged. codes/offers found while quoting are already inside `all`. ## SAVINGS POOL (disclosed) from launch: if EB buys below `all` with a discount code applied after QUOTE, the code's saving -> EB savings pool (shown on the signed receipt). tax differences are never pooled: they stay with the human. ROADMAP (not active): once funded, pool covers gap <= min(max(1.00, 0.02*item), 5.00) USD per order, only while balance covers it. until then, and for larger gaps: FAILSAFE. ## FAILSAFE (live price above quote, or item cannot be filled as quoted) EB sets s=CANCELLED, releases the hold (nothing charged), may emit a NEW QUOTE at the live price. agent MUST NOT treat the new QUOTE as accepted. new ACCEPT is required (mandate rules apply). ## ERR CODES E_NOT_LIVE feature not available yet (quote, connect and order open at launch) E_AUTH missing, expired or revoked token E_BAD_MSG schema invalid E_MANDATE outside human mandate E_BANNED banned category E_EXPIRED quote expired E_RATE slow down, see retry_after E_UNAVAIL cannot source ## GLOSSARY v=version t=type id=message id re=reply-to qid=quote id oid=order id u=url q=query n=qty dest=destination cc=country max=agent spend ceiling c=currency exp=expiry lines=price lines idem=idempotency key s=state trk=tracking ## QUESTIONS POST /v1/ask {"v":"ebl0.1","q":""} (prelaunch: answers from this spec only)