Lesson 13.05 · Phase 13 · Production Agents

Cost control at scale

One looping agent costs a few cents. A looping release costs whatever it can reach before someone notices. Put limits at every level, and make the last one automatic.

Learning objectives

  • Meter every model call and attribute it to a run, user, customer (tenant) and agent version.
  • Enforce budgets at four levels: per run, per user per day, per tenant per month (alert at 80%, stop at 100%), and per agent version.
  • Detect a bad release from its behaviour (runs hitting limits) and switch it off automatically.
  • Report cost per successful task, the number that tells you whether a change made the product cheaper or just made it fail cheaply.

At 14:00 a new agent version ships. It's fine on most tasks, but on about a third of them it loops: search, read, search again. Each run that loops makes 40 model calls with a growing prompt. Nobody notices until finance asks why the bill jumped.

Loading the full lesson…