AI Shopping Agents: Reviewing Bitcoin Purchase Quotes
AI Shopping Agents: Reviewing Bitcoin Purchase Quotes
Research question
A shopping agent can compare quotes but cannot authorize spending. Bind the merchant and quote expiry to an independently reviewed order.
Architecture and trust boundary
Separate the model, business ledger, operator authorization and local wallet executor. The model may propose an action but cannot establish financial evidence or grant itself permission. Keep BTC KEY out of prompts, browser contexts and business logs. A restricted tool does not turn the underlying credential into a restricted key.
Source implementation
1def review(quote, merchant, now, ceiling):
2 if quote.get('merchant') != merchant:
3 raise ValueError('merchant mismatch')
4 amount = quote.get('amount_sat')
5 expiry = quote.get('expires_at')
6 if type(amount) is not int or not 0 < amount <= ceiling:
7 raise ValueError('amount rejected')
8 if type(expiry) is not int or expiry <= now:
9 raise ValueError('expired quote')
10 return {'status':'review_required','amount_sat':amount}
11
12if __name__ == '__main__':
13 q = {'merchant':'demo','amount_sat':1200,'expires_at':200}
14 assert review(q,'demo',100,2000)['status'] == 'review_required'
15 try: review(q,'demo',200,2000)
16 except ValueError: pass
17 else: raise AssertionError('expired quote accepted')Integration with WAB ENGINE
The local executor can request Testnet SegWit balance using POST /api/v5/btc/wallet/balance with X-BTC-KEY and JSON body {"net":"test","type":"segwit"}. A balance is not settlement evidence. Any future SEND must bind authorization to the exact intent, use persistent idempotency and preserve the wallet's signed birth fee law. Treat the sender total and recipient net amount as distinct accounting values under the applicable inclusive fee law; never assume they are equal. No SEND is implemented here.
Limitations and failure handling
Merchant identity must be authenticated outside this function. A merchant name from a webpage is not proof of identity. The ceiling is an operator policy, not the engine fee law.
The included assertions exercise synthetic inputs only. No live engine, model or blockchain connection was tested. Fail closed on ambiguous financial state; investigate before retrying writes.
References
- https://thamer.org/api
- https://thamer.org/engine
- https://developer.bitcoin.org/devguide/transactions.html
These links are reference pointers, not a claim of current external documentation verification.
