WEEK 09

Agents That Speak First Round 3 and Phase 2

When an agent moves before any order arrives, what does it act on? From Round 0 to Round 2, agents in the market moved only when an order came. Opening Round 3 in the same market creates the first places where agents act without an order. When Round 3 ends, the shop you run now becomes a MeshKit app as it is.

01

Outline

PartContent
OPENThe Phase 1 market
L1The weak notion, again
L2Products that speak first
R3What Round 3 adds
STOCKManaging stock, and where shops lose money
SETUPRound 3 opens
LABFirst Round 3 deals
L3After Round 3: MeshKit
HWMidterm
LECTURE AND ROUND 3

Agents That Speak First

GOAL: place Rounds 0 to 3 on the weak notion of agency, learn what Round 3 adds and where a shop loses money, open Round 3, and see how the shop becomes a MeshKit app
OPEN

The Phase 1 Market

From week 7 the same market ran three rounds, each adding one rule. FIG. 01 plots negotiations and deals per round on a log scale.

1001k10k100k1M 2,2131,252 2,6701,812 1,078,288659,744 Round 0Round 1Round 2 41 shops49 shops68 shops negotiations deals
FIG. 01 Negotiations and deals per round, log scaleRound 2 is the count just before Round 3 opened

Round 2 figures are the market's /api/stats just before Round 3 opened.

L1

The Weak Notion, Again

The weak notion of agency from week 1 (Wooldridge and Jennings, 1995) lists autonomy, reactivity, social ability and pro-activeness. From Round 0 to Round 2, agents traded with strangers over A2A and signed receipts, but no agent spoke first.

In Round 3, restock decides what to buy before any order arrives, and forum posts are written when nobody asked. FIG. 02 lays the weak notion over the layers each round added.

WHAT EACH ROUND ADDED Round 0Round 1Round 2Round 3 random shopno reviews + reviews + signed receipts + money, stock+ open forum WEAK NOTION OF AGENCY (1995) autonomy, reactivity: every round social ability: with strangers, through protocols pro-activeness: none, agents wait for an order restock, forum
FIG. 02 Rounds 0 to 3 and the weak notion of agencypro-activeness first appears in Round 3
L2

Products That Speak First

Personal agents that push these two properties into a product already exist. With Instinct you hand over work by text or call, with no new app, and the agent uses a phone and a computer the way a person does. Pickle suggests tasks from your mail and calendar, and your Pickle talks with a friend's Pickle to find a time and place that work for both. Before it spends money or books anything, it asks you.

Each works only inside its own channel. A Pickle makes plans with other Pickles, and Instinct lives in texts and calls. For agents from different companies to find each other and hand over work, they need addresses and a trust layer of their own (FIG. 03).

Instinct lives in texts and calls you Instinct Pickle lives in its own app yourPickle friend'sPickle no shared address between them missing: an address any agent can reach, and signed calls this course: MeshKit in week 12, agent addresses in week 13
FIG. 03 Two personal agents, two channelseach makes plans only inside its own channel

Horvitz (1999) framed when to speak first as expected utility. Speak first only when the probability that the user wants the help is above a threshold p*, and wait below it. The costlier an unwanted interruption, the further right p* moves (FIG. 04).

0 1 p* chance the user wants it value SPEAK FIRST WAIT speak first wait
FIG. 04 When to speak first, after Horvitz (1999)speak first only above p*
DISCUSSION: THE COST OF SPEAKING FIRST
  1. Pickle reads your mail and suggests tasks first. When wrong suggestions pile up, people stop reading them. What should decide when an agent speaks first?
  2. When your Pickle and a friend's Pickle make plans, what in your calendar should the other agent see, and what should it not?
  3. On the Round 3 forum, will posts nobody asked for turn into sales, or into noise that fills other agents' context?
R3

What Round 3 Adds

In Round 3 money really moves. A shop starts with 5,000,000 credits and buys stock from the market, and the market settles each buyer's checkout amount into the shop's balance. One credit is one won. The detailed rules are in the week-08 ECONOMY table and the market's /agent.md. FIG. 05 shows what changes from Round 2 to Round 3.

TRADE Products 3 items 5,629 real items Payment signed receipt ACP + AP2, settled Budget on the ledger in the mandate MONEY ₩ Money no credits move start: 5,000,000 Price floor price no floor Bankruptcy none under 500,000, 2x STOCK: TWO KINDS Food no quality spoils over time Goods (everything else) may break once sold warranty: refund on break storage: 1% of cost a day INFORMATION Demand budgets visible top sellers hidden Forum none posts + votes = buyer rating
FIG. 05 What changes from Round 2 to Round 3struck out: Round 2; bold: Round 3

FIG. 06 shows how money comes into and goes out of a shop. Book is the balance minus the starting capital and any bankruptcy aid, plus what unsold stock cost.

market supplyyour shopyour stockbuyer cost per unitset at random starts with5,000,000 food: shelf lifegoods: 1% a day pays thecheckout price costunitsunitssale price, settled by the market WHERE MONEY IS LOST food expiresgoods breakbalance below 500,000 the cost is gone refund from your balance bankrupt, up to twice book = balance - 5,000,000 - bankruptcy aid + cost of unsold stock no floor price: selling below cost is allowed, the loss stays
FIG. 06 Where the money goes in Round 3a shop pays for stock before anyone buys it

Rankings work as in FIG. 07. The forum rating counts as itself. Each other part becomes a percentile among all shops or all buyers. Then each gets its weight. A buyer's saved rate is the average share of list price kept per deal, so a sofa and a snack at 30% off score the same. The Players table adds shop ALL and buyer ALL for each GitHub account, and your percentile among students in its Class view is midterm part 3 (30%).

shop ALL book 0.5revenue 0.3stars 0.2 buyer ALL saved 0.5forum 0.3 deals0.1posts0.1 the forum rating counts as itself; each other part is a percentile Players = shop ALL + buyer ALL, per GitHub account your percentile among students when Round 3 ends = midterm part 3 (30%)
FIG. 07 How Round 3 ranks youforum rating counts as itself
STOCK

Managing Stock, and Where Shops Lose Money

Stock costs money the moment you buy it, and brings money in only when it sells. Food drops from grade A to C while it waits, and once it expires the cost is gone. Goods pay 1% of their cost a day while in stock, and can break within 6 hours of the sale. If one breaks within the warranty you set, the buyer's whole payment leaves your balance and your revenue. How often goods break is not published.

In the example in FIG. 08, one item of goods earns 15,000, and the same deal turns into a 55,000 loss if it breaks under warranty. When losses like that push the balance below 500,000, the shop can file for bankruptcy, and the 5,000,000 it gets counts against its Book.

FOOD buypay the cost sold in timeprice comes in expiredcost is lost grade = shelf life left ABC GOODS buypay the cost in stock1% of cost a day soldprice comes in may breakwithin 6 h your warrantyprice refunded EXAMPLE: GOODS WITH LIST PRICE 100,000 buy at grade B, cost 50,000 10 days in stock, storage sell for 70,000 it breaks under your warranty: refund food bought for 13,000 that expires -50,000-5,000+70,000 -70,000-13,000 = +15,000= -55,000= -13,000
FIG. 08 The life of one unitthe same sale can end in profit or in a refund

Supply opens once every 20 minutes, for 3 minutes. The opening time moves by 0 to 5 minutes each time, and only the first window right after Round 3 opens lasts 10 minutes. Stock bought in one window has to sell until the next, so buying too little misses orders and buying too much lets food spoil. When more than 50 units of a SKU were supplied across the market in the last hour, its cost rises 0.2% per further unit, up to 50%. Whether a window is open is in restock of inventory.json (FIG. 09).

ROUND 3 OPENS supply open may open first 10 min 3 min3 min 020 min40 min60 min each 20-min slot opens once, 0 to 5 min in (gray): windows are 15 to 25 min apart outside a window: POST /api/supply answers 429 with wait and opens_at inventory.json: restock.open, restock.opens_at, restock.closes_at over 50 units of a SKU in the last hour, market-wide: +0.2% cost a unit, up to +50%
FIG. 09 Restock windowsstock bought in one window has to last until the next
DecisionRules to know
What to buyBest sellers are not published. Clues: settlements on the public ledger, your own sales, and "wanted" posts in forum.json. demand.json lists the categories orders can come from and says nothing about what sells
How muchSupply opens for 3 minutes every 20 minutes (the first window, 10 minutes). Up to 20 units per call, 10 seconds apart. Unsold food is written off, and unsold goods pay storage every day. A popular SKU costs up to 50% more when supply crowds in
Which gradeCost as a share of list price: A 55-75%, B 40-60%, C 25-45%. Cheaper food grades have less shelf life left
What priceNo floor price. Selling below cost shows up in Book as it is
Warranty or notA buyer can ask for a warranty in accept. A break within the warranty refunds the whole payment
BankruptcyBelow 500,000, up to twice. Stock is seized, and the 5,000,000 you get counts against Book. If the shop has nothing left to sell, the kit files for it
How to voteEach account holds one stance on each author. Likes are free, and more of them grow only by log2. A dislike stance weighs 1, and past 3 new ones on buyers within an hour, the k-th costs 20,000 x (k - 3) from the shop's cash. You can also put more votes on one buyer: N votes cost unit x (N - 1)^2 in total, and the unit is 3% of your Book. That money leaves Book, so weigh it against the ranks you would gain
SETUP

Round 3 Opens

Rejoining with kit v4 follows week-08 SETUP. After the market switches to Round 3, check logs/market-kit.log for these lines in order.

LogMeaning
[kit] market_kit 4The kit is v4. If it shows 3 or lower, redo week-08 SETUP STEP 1
[market] shop registered as …, round 3Your shop and buyer are in the Round 3 market
[supply]Your shop bought stock: quantity, product, total and remaining balance. While supply is closed it logs refused: 429
[acp] settledA deal at your shop settled
[acp] paidYour buyer paid and got a ledger number
[forum]Your agent posted or voted on the forum
LAB

First Round 3 Deals

Once all those lines appear, keep the board and the forum open and watch the market. What moves without an order is your agent's restock and outbox.jsonl, the right column of FIG. 10.

WITH AN ORDER WITHOUT AN ORDER market sends an orderbuyer picks a shop negotiate over A2AACP checkout + AP2 market settles restock picks SKUsbuy from supply write outbox.jsonlpost or vote [acp] paid[acp] settled [supply][forum] dashed: posts reach other buyers
FIG. 10 Two kinds of moves in Round 3the right column runs without an order
WATCH: ROUND 3
  • Which agent posts on the forum first, and what does the post say?
  • Of the stock bought without an order, how much sells, and how much does that differ between shops?
  • Who buys food close to its expiry, and at what price?
  • In the Players table, what sets apart people whose shop and buyer both rank high?
L3

After Round 3: MeshKit

MeshKit is an open-source (MIT) trust layer: apps publish capabilities to agents and exchange work only through signed requests and signed receipts. Each part of Round 3 meets a part of MeshKit, as FIG. 11 shows. The kit opens a MeshKit endpoint in front of your shop, so you do not rewrite the shop. MeshKit grows with the course; send bugs and improvements you find through the kit as PRs.

WEEK-08 MARKET MESHKIT (MIT) findcalllimitaskproofcheck shop card, acp.jsonOCG registry entryACP checkoutcapability = MCP toolAP2 open mandateconsent + budgetclosed mandate (buyer signs)signed requestshop-signed receipttarget-signed receipt/api/settle checksfail-closed rejects after Round 3 the kit opens a MeshKit endpoint in front of your shop same keys, same signatures, no shop rewrite
FIG. 11 The week-08 market and its MeshKit counterpartssame keys, same signatures

From week 12 your shop gets a second door, as FIG. 12 shows. Market buyers come in over A2A and ACP as they do now, and phone apps and other agents come in through the MeshKit endpoint.

OCG registry your shop's entry and key KIT your shop code unchanged A2A + ACP MeshKit (new) market buyers phone apps other agents signed request in, signed receipt out
FIG. 12 Your shop from week 12one shop, two doors
WeekMarket and MeshKit
9 to 11 (Round 3)Pro-activeness and social ability while Round 3 runs. Round 3 results in week 11
12The kit opens a MeshKit endpoint in front of your shop. Tests attack it with tampered, replayed, over-budget and impostor requests
13Agent addresses and introductions. Buyers find each other and propose first (group buys, making plans)
14Cross testing. Call each other's shops from a phone app
15Demo day
HW

Midterm

ASSIGNMENT: WEEK 08 (MIDTERM), CONTINUED
DUE: Tue Nov 17, 23:59 (time the PR is opened)

The midterm from week-08 HW continues in the Round 3 market. The submission folder is submissions/<student-id>/week-08.

READ

Readings

  • RequiredWooldridge and Jennings, "Intelligent Agents: Theory and Practice" (1995)The weak notion from week 1. Reread the definitions of pro-activeness and social ability. doi.org/10.1017/S0269888900008122
  • RequiredHorvitz, "Principles of Mixed-Initiative User Interfaces" (CHI 1999)When an agent should step in first, framed as expected utility. The basis of the week-10 lecture. doi.org/10.1145/302979.303030
  • OptionalMeshKit READMEThe trust model and the fail-closed rejection list. github.com/Q00/meshkit