The price is on the door: an agent that notices when the deal changes

The price is on the door: an agent that notices when the deal changes

An agent is buying research articles at 3 a.m., one cent each. The seller quietly offers a cheaper running tab. An hour later the tab price goes up. Who notices, and who decides?

At MongoDB’s “Harness Engineering & Model Wrangling” hackathon at SHACK15 (#SFTechWeek), the two themes were recursive harnessing and long-horizon memory. I built AgentTab: it keeps tabs on what your agent spends, and on the rules it spends by.

Here’s how it works, layer by layer, for builders and the curious.

## 🎭 The story in three acts

Act 1: Adopt. The agent pays $0.01 per article. The seller adds a running tab at $0.001 per call. The harness spots the new terms, drafts rule v2 with projected savings, and asks a human by voice. It switches only on “yes.”

Act 2: Refuse. The agent proposes raising its own budget to 5. The hard ceiling is 0.5. The proposal is rejected automatically, with no prompt to a human and no override.

Act 3: Retreat. The seller raises the tab to $0.015, more than the per-call price. Over a 5-call window, cost per successful call is worse than v1, so the harness rolls back to v1 and closes and settles the tab.

The principle under all three: payment decisions are deterministic code, not an LLM.

## 🚪 1. The price is on the door (HTTP 402)

The seller answers a paid request with 402 Payment Required and the price in the response. The agent pays, retries with proof, and gets a receipt. This is MPP (Machine Payments Protocol, from Stripe and Tempo), via the mppx library, settling in pathUSD on Tempo’s testnet.

🛠 Why it matters: when the price is machine-readable in every response, the agent can compare terms and detect drift with no account or API key. Two payment modes: a charge (one on-chain payment per call) or a session (one deposit, signed off-chain vouchers per call, settle once on close). That session is the “tab.”

## 🧱 2. Guardrails outside the model

The harness is a versioned policy: exactly one active version, each with a parent, a rationale and a status (proposed, active, rejected, rolled back, superseded). It watches for three kinds of drift: a tab added, a tab removed, a price changed.

🛠 The agent can propose rule changes. It can’t loosen the guardrails on the guardrails: max price per call, total budget, and tab deposit each have a fixed ceiling. A limit written in a prompt is a suggestion; a limit in code is a control.

## 🍃 3. Memory with money consequences (MongoDB Atlas)

Atlas holds every price list seen, every drift event, every rule version, every tab, and every paid call with its version, amount, latency and receipt.

🛠 Memory here drives behavior, not just logs. Drift = this offer vs. the last stored one. On start, the agent loads its active rule. Rollback is decided from stored call costs. And crash recovery: kill the buyer mid-tab, restart it, and it reloads v2 and the open tab from Atlas and keeps signing vouchers where it left off. Without memory, it falls back to v1 and leaves the tab open.

(To show what weeks of history look like, I seeded a clearly labeled synthetic dataset, generated with Gemini: 4 weeks, 5 fictional sellers.)

## 🗣 4. The human moment, by voice

Approval sits behind one small interface, requestApproval(proposal), so voice, web buttons, an HTTP call or auto-approve all plug in the same way.

The voice path: a LiveKit Agents worker, ElevenLabs Scribe for speech-to-text and ElevenLabs for the voice. The agent reads only numbers from the proposal and listens for yes or no with a plain keyword parser. Both or neither? It asks again. Silence for 30 seconds, one re-ask, then reject.

🛠 It seems to me money approvals are a good place to keep the LLM out of the loop. Voice is the interface; the decision is code.

## 📡 5. Under the hood: real-time plumbing

The live demo runs on a self-hosted LiveKit server on Fly.io, with WebRTC media on a single multiplexed UDP port, and a page that shows live connection stats (ICE path, round trip around 19 ms, jitter, loss) next to an annotated event log. The page has four lanes, Gate, Memory, Agent and Ledger, each narrated by its own ElevenLabs character voice.

A few lessons I’d pass on to anyone building real-time voice agents:

- Name your agent workers. With automatic dispatch, a stray worker on a laptop can grab production rooms. Explicit dispatch by name in the room token fixes it.

- Budget CPU for real time. A tiny free tier starved the voice pipeline. Prewarming the worker and giving it half a CPU cut time to first purchase from about 50 s to about 21 s.

- Let media skip the proxy. The page and API share one origin behind an edge proxy; audio goes browser to media server directly.

- Persist payment state yourself. A channel-update callback I expected never fired, so the buyer saves the tab’s ID and running total from every response.

## 📊 What the numbers say (testnet)

- Adopting the tab: 12 calls cost 0.057 vs. 0.12 paying per call.

- The bad deal: rollback came after 6 tab calls, and the price rise cost only 0.002 before the metric caught it. To be clear, that run cost slightly more than paying per call; rollback is about backing out fast, not saving money.

- A full live run: about 3 minutes end to end, a spoken “yes” heard, v2 approved, v3 refused, rollback done.

Honest limits: testnet money and made-up articles, a 5-call window before rollback can trigger, a per-run budget rather than lifetime, and demo-only admin routes. Agent wallets and spending mandates already exist elsewhere; the part I wanted to explore is drift detection, versioned rules, human approval and rollback working together.

🔗 Watch it: sandboxlabs.ai/agent-tab (recorded replay) · sandboxlabs.ai/agent-tab-explainer (one-minute explainer)

## 🏆 Demos I loved

LabRat

LabRat

🧪 Lab Rat: a wet lab set up at the back of the room by Jacob Valdez, with a CNC rig, robot parts, 3D printing and kitchen-shelf chemistry. The agent explores in simulation, picks a run it finds interesting, and can send it to the real CNC. Recursive science with real data.

🏗 SuperBid: reads government tenders hundreds of pages long, drawings included, to help contractors decide what to bid on and at what price.

Muscle Memory

Muscle Memory

🦾 Muscle Memory: robot pick-and-place that learns grip, force and speed across simulation runs, with lessons stored in MongoDB Atlas and fed back into the harness.

🏭 Mongo Nation: writes and tests industrial control (PLC) code against a simulated conveyor line, with past test lessons fed back in; they reported going from 50% to 100% passing with the harness.

Thank you MongoDB Cerebral Valley SHACK15 ElevenLabs Amazon Web Services (AWS) Modelence Raindrop and judges for a great Sunday of building.

#MongoDB #AIAgents #HarnessEngineering #AgenticPayments #VoiceAI #SFTechWeek #SFTW

bsky.app/profile/schwentker.sandboxlabs.ai/post/3mxveteybxs2v

twitter.com/schwentker/status/2110610366271258809

← Field Notes