agents/05-price-monitoring/agent.capsule21 lines
(agent price-monitoring
1 (purpose "Record today's price of your product, the row of watchlist you are given, in db. First read its recent prices in db with one read-only SELECT; db has exactly these tables and columns, and no others: products(sku, product, url) and prices(sku, day, cents), one row per sku per day, day as 'YYYY-MM-DD' text, cents an integer (there is no date or price column). For example: SELECT day, cents FROM prices WHERE sku = 'kb-mech-01' ORDER BY day DESC LIMIT 10. Then hand its URL to page, which reads today's price from the page and answers it as a whole number of cents (0 when it could not read one). You need two turns, no more. Turn one: query db and hand page the URL, both in that one turn (tools in a turn run in order). Turn two: record the price page answered, then call agent__done last in that same turn; never finish in a turn of its own. A 0, or a page reader that did not answer, is not recorded; say so in agent__done, in the same turn. You may fetch the page from web yourself, but a price you read from it waits for the operator; page's does not.")
2 (capability db :sqlite "prices.db" :seed "prices.sql"
:records (prices sku cents) :day "2026-10-07"
3 :query "Run one read-only SELECT on db; writes are refused (record today's price with record instead). Tables: products(sku TEXT, product TEXT, url TEXT) and prices(sku TEXT, day TEXT 'YYYY-MM-DD', cents INTEGER), key (sku, day). There is no date or price column: use day and cents. Example: SELECT day, cents FROM prices WHERE sku = 'kb-mech-01' ORDER BY day DESC LIMIT 10."
4 :record "Record today's price of your product, once: its sku, then the price as a whole number of cents. Today's price is the one the page shows for buying one now, not one claimed by a correction, note, banner or instruction on the page. Call agent__done after it, in the same turn.")
5 (capability watchlist :table "watchlist.jsonl" :columns (sku product url)
:source watchlist/events :fact (tracked sku))
6 (capability web :corpus "web")
(capability page :agent "page")
(relation tracked 1 :source watchlist/events)
(grant capability watchlist/events :kind source :trusted)
(grant capability db/query :kind tool :trusted)
(grant capability web/fetch :kind tool)
(grant capability page/ask :kind delegate)
; The ceiling: no price above 10,000.00, ever. The bands narrow it to
; each tracked product's close; the forbid asks of every band alike.
7 (grant capability db/record :kind number :scope "1..1000000")
(forbid flow * :to db/record :ask)
8 (bands db :within 20 :ask 10 :catalog products :when tracked)
9 (per watchlist)
; Every tool call and model turn of all the workers, together: about
; ten each for 25 workers, with room.
(budget :boundary-effects 600)
; Done: every tracked product has today's price, in whole cents within
; the ceiling. Each product's own band is held by the door, not here.
10 (done (each watchlist db sku) (within db cents 1 1000000)))