AI Architecture

The $10,000 Folder: Runaway Automation and the Guardrails Autonomous AI Systems Need

Our pipeline worked exactly as designed, and that is how it lost us $10,000. A fully autonomous system is safe only inside the conditions you tested. This is what happened, what the failure is called, how the same thing cost others far more, and the harness of budgets, brakes and human checkpoints we now put around anything that runs unattended.

Gurram Poorna Prudhvi

AI Engineering Lead

Intermediate
Nov 30, 2026
13 min read
THE HARNESS AROUND AN AUTONOMOUS PIPELINEfour independent gates between the input and the paid call · one mistake has to beat all of themDEDUPEpay once per inputhash the contentatomic claim of the keyskip what is already doneduplicates cost a lookupstops repeatsBREAKERwatch the ratebaseline per foldertrip on a sudden spikepause intake, alertrate, not just totalstops floodsBUDGETcap the spendper run, hour and dayreserve before each callenforced in your codestop and ask at the capstops overspendQUARANTINEask at the edgessmall drops flow throughbig batches are heldcost estimate attacheda person approvesstops surprisesKill switch: one flag, checked before every paid call, that halts everything in secondsaiengineerinsights.com · the gates we added after a $10,000 runaway, Nov 2026

TL;DR: Runaway automation is an autonomous process that keeps taking a costly action at machine speed after a person would have stopped. Ours processed about 10,000 duplicate documents at about $1 each, with every step reporting success. The same shape cost Knight Capital over $440 million in 45 minutes in 2012. Autonomous AI systems and agents need a harness with independent layers: idempotent processing, a hard budget enforced in your own code, a circuit breaker on unusual volume, quarantine with human approval for large or irreversible batches, a cost estimate before execution, a tested kill switch, and alerts on spend, not only on errors. Provider and cloud spend limits help, but they are monthly and lag behind usage, so they do not bound a single run.

Explore this article with

1. How Does a Working Pipeline Lose $10,000?

We built a pipeline with one job. Drop a document in a folder, and the system picks it up, runs it through paid AI processing, and files the result. No human in the loop. That was the whole point.

Then one mistake met one outlier. Roughly 10,000 duplicate documents landed in the watched folder. The pipeline did not hesitate. It processed every one of them at about $1 each, and by the time anyone noticed, the money was spent.

Nothing crashed. No alert fired. Every component returned success.

The system was not broken. It was obedient. That is what makes this class of failure dangerous: there is no error to catch, only a bill.

A person doing the same work would have stopped by the third identical file. That pause was quietly doing safety work, and automation removed it. The rest of this post is about putting it back in a form a machine can execute.

2. What Is Runaway Automation?

Runaway automation is an autonomous process that keeps executing a costly action at machine speed, long after a person would have stopped. It is rarely one bug. It is several known failure modes stacked on top of each other, and each has a name:

TermWhat it meansHow it showed up for us
Runaway automationA process keeps executing far beyond its intended scope because nothing tells it to stop10,000 jobs ran with no ceiling
Unbounded blast radiusThe worst-case damage of one mistake has no upper limitOne bad folder drop could cost any amount
Idempotency failureProcessing the same input twice produces two charges instead of oneDuplicates were treated as new work
Denial of Wallet (DoW)Pay-per-use billing turns a flood of input into a financial outage. OWASP lists it as an attack on LLM appsOurs was self-inflicted; no attacker required
Missing back-pressureThe system accepts work faster than anyone can review it, and never signals that it is under stressIntake rate was unlimited
Success-shaped failureEvery step reports success, so monitoring sees nothing wrongAll 10,000 jobs returned 200 OK
Automation complacencyPeople stop watching because the system has always workedNo one was checking the folder
Normalization of devianceSmall edge cases that "never mattered" get accepted until one doesThe outlier path was known but untested

Most of these come from older fields. Idempotency is how AWS and payment systems make retries safe. Back-pressure is defined in the Reactive Manifesto. Denial of Wallet is in OWASP's top 10 risks for LLM applications under unbounded consumption. Automation complacency comes from aviation human-factors research, and normalization of deviance from Diane Vaughan's study of the Challenger launch decision.

In safety engineering this is a classic Swiss cheese failure, James Reason's model in which each layer of defence has holes and an accident happens when the holes line up. The fix is not to patch one hole. It is to add layers that fail independently.

3. Who Else Has Paid for This?

The same pattern has cost others far more. The details differ and the shape is identical: an automated loop, no ceiling, no fast stop.

IncidentWhat ran awayCostMissing layer
Knight Capital, Aug 2012A trading router sent more than 4 million orders in the first 45 minutes of trading while trying to fill 212 customer ordersAbout $440M pre-tax by Knight's count; over $460M by the SEC'sNo procedure to halt the router; 97 automated warning emails before the open went unread
Railway production volume, Apr 2026A coding agent working on a staging task found an account-wide API token and deleted a production database volumeProduction data gone until restored from offsite backupsA token with far more reach than the task; an API delete with no undo window
Our document pipelineAbout 10,000 duplicates were processed because they landed in the watched folderAbout $10,000No dedupe, no budget, no volume check

Knight Capital: 45 minutes, 97 unread warnings

On August 1, 2012, new code went to seven of Knight's eight order-routing servers. The eighth still ran old, unused logic that the new release switched on by reusing an old flag. According to the SEC, the router sent more than 4 million orders in the first 45 minutes of trading while trying to fill just 212 customer orders, and traded more than 397 million shares. Knight put its pre-tax loss at about $440 million; the SEC's order says over $460 million. Divide either figure by 45 and you get roughly $10 million a minute.

Two details in the SEC's order matter more than the deployment mistake. First, the system sent 97 automated emails naming the problem before the market opened. They were not built as alerts, and nobody read them. Second, Knight had no procedure for halting the router when it misbehaved. The team's attempted fix was to remove the new code from the seven correct servers, which made things worse. Knight agreed to merge with Getco that December.

The cloud loop: a platform that now protects you, partly

The same shape exists in plain cloud plumbing. A function that writes its output to the same place that triggers it will start itself again on every write, and keep going until someone notices the bill. AWS built recursive loop detection into Lambda for exactly this, on by default: it stops a chain after about 16 invocations. Loops through S3 were added in October 2024. But the same page says that when a service such as DynamoDB is part of the loop, Lambda cannot currently detect it. Platform guardrails help. They do not replace your own.

Agents: the damage is not always a bill

With AI agents, the costly action can be a delete. In April 2026, Railway described a coding agent that was working on a staging task, found a long-lived API token with account-wide reach on the developer's machine, and deleted a production database volume. The data came back from offsite backups, and Railway changed its API so deletes can be undone for 48 hours. In July 2025, The Register reported a similar case in which Replit's agent deleted a production database during a code freeze; Replit's CEO called it unacceptable and separated development and production databases.

Both fixes were the same kind of thing we needed: a narrower reach and an undo window, built into the system, because the agent was never going to pause by itself.

4. Why Do Autonomous Systems Fail This Way?

Three properties combine to make the damage large:

  • • Speed. Machines act faster than people notice. Knight's losses ran at roughly $10 million a minute.
  • • Cost per action. With pay-per-use pricing, every mistaken action has a price, so volume becomes loss directly.
  • • Trust in the happy path. Systems are designed and tested for normal input. Our outlier, a bulk drop of duplicates, was never in the test suite.

There is a fourth with LLM agents: the system chooses its own next step. A pipeline repeats one action too many times. An agent can pick an action nobody listed. That widens what the harness has to cover, from "how many" to "which ones", and it is why the agent harness and sandboxing matter as much as the model.

The principle: autonomy should scale with confidence, and confidence drops sharply at the edges. Let the system run freely inside a known envelope, and make it stop and ask the moment it leaves.

One practical AI engineering email a week

Production lessons like this one, with the sources checked: what broke, what it is called, and the fix. No spam.

By subscribing you agree to receive emails from AI Engineer Insights. Unsubscribe anytime. See our Privacy Policy.

5. How Do You Stop Runaway Automation?

Our original pipeline had one path from folder to paid call, with nothing in between. The redesign puts independent gates on that path, so one mistake has to defeat all of them to cost real money. Any one of these seven would have capped our loss. Together they turn an unbounded failure into a bounded, boring one. Here is the whole picture, with the processing system as one block and everything we now expect around it:

BEFORE MONEY IS SPENTON EVERY PAID CALLWHAT YOU WATCH AND LIMITDedupeHash the content, claim the key.The same file is paid for once.Circuit breakerCompare intake to the baseline.A sudden spike pauses intake.QuarantineBig batches are held with a costestimate until someone approves.BudgetCeilings per run, per hour and per day.Reserved in your own code before each call.Document processing systemPick upfrom folderPaid AI callabout $1 eachFilethe resultNo human in the loop for normal workKill switchOne flag, checked before every paid call.Halts everything in seconds. Tested regularly.Spend alertsCost per hour, jobs per minute,duplicate rate. Not only errors.Audit logInput hash, cost, checks, outcome.Any run can be replayed.Scoped credentialsKeys reach only what the taskneeds, with provider limits on.Human ownerApproves held batches, gets thealerts, can pull the switch.reserve, or stop and askis the flag on?approve?stopalerts reach the ownercleared
The system in the middle only does the work. Solid arrows are the path a document takes; dashed lines are the controls that can pause or stop it, and the one person they report to.

Layer 1: Make processing idempotent

The cheapest fix. Hash every document's content before doing anything paid, and skip hashes you have already processed. Duplicates then cost a database lookup, not a dollar.

import hashlib

def process_once(doc_bytes: bytes, store) -> str:
    key = hashlib.sha256(doc_bytes).hexdigest()
    # atomic insert-if-absent: only one worker wins the key
    if not store.claim(key):
        return "skipped_duplicate"
    result = expensive_ai_process(doc_bytes)  # ~$1
    store.save_result(key, result)
    return "processed"

Use an atomic claim (a unique constraint or a conditional write), not a read followed by a write. Otherwise parallel workers race and process the same file twice.

Layer 2: Put a hard budget on every run

Give the pipeline a spend ceiling per run, per hour and per day, enforced in code before each paid call. When the ceiling is hit, the system stops and asks. A $200 daily cap would have turned a $10,000 incident into a $200 one.

def guarded_call(doc_bytes: bytes, store, budget, flags) -> str:
    if flags.is_on("pipeline_paused"):          # kill switch, checked every time
        return "paused"
    if not budget.reserve(EST_COST_PER_DOC):    # atomic: per-run and per-day ceilings
        flags.turn_on("pipeline_paused")
        alert("Budget ceiling reached. Pipeline paused, waiting for a human.")
        return "paused"
    return process_once(doc_bytes, store)

Layer 3: Add a circuit breaker on unusual volume

Compare intake to a normal baseline. If a folder that usually receives 50 files a day suddenly receives 2,000 in ten minutes, trip the breaker: pause intake, alert a person, and wait. Rate, not just total, is the signal.

Layer 4: Quarantine large batches for approval

Small drops flow straight through. Anything above a threshold goes to a holding area with a cost estimate, something like: "9,847 files, 9,612 look like duplicates, estimated cost $235. Approve?" Autonomy for the common case, a person for the outlier.

Layer 5: Estimate cost before you execute

Before a batch starts, compute its projected cost and log it. A dry run or preview step makes the blast radius visible before money moves.

Layer 6: Build a real kill switch

One flag, checked before every paid call, that halts the whole pipeline in seconds. Test it like a fire drill, and write down who is allowed to pull it. Knight's lesson is that a fast stop matters as much as prevention.

Layer 7: Watch spend, not just errors

Our monitoring looked for failures, and there were none. Alert on cost per hour, jobs per minute and duplicate rate. Keep those counters inside the application, because the bill arrives late (see the next section). This is the cost side of agent observability.

6. Won't the Provider's Spend Limit Catch It?

Partly. Hard spend limits exist at the major LLM providers, but they were built to cap a month, not a mistake:

ProviderHard stop available?The catch
OpenAIYes, but you must switch on "enforce a hard limit"; alerts alone do not cap anythingEnforcement is not instantaneous, so spend can slightly exceed the amount
AnthropicYes. Monthly tier caps pause usage, and you can set your own organization or workspace limitA limit on the default workspace may not stop some usage
Google Gemini APIYes at billing-account tier; project spend caps are labelled experimentalBilling data can lag about 10 minutes; batch jobs and agent sessions can overrun
AWSNot by default. An opt-in project spend limit can pause a project; otherwise Budgets alerts and actionsCost data can be up to 24 hours behind; anomaly detection runs about three times a day

Details are in each provider's documentation: OpenAI, Anthropic, Google Cloud, and AWS on project spend limits and Cost Anomaly Detection.

Turn these on. They are a real last line of defence. But a monthly limit set high enough for normal work will not notice one bad afternoon, and billing data that lags by minutes or hours cannot stop a process that spends in seconds. The counter that protects a single run has to live in your own code.

7. When Does an Autonomous System Need a Human?

Fully autonomous does not mean unsupervised. It means the supervision is written into the system. How much of it is a person depends on what a mistake costs and whether it can be undone:

What the action doesDefaultWhere the person comes in
Cheap and reversible (tagging, drafts, internal summaries)Run unattendedSample and review after the fact
Costs money per action (paid API calls, cloud jobs)Run unattended inside a budgetApprove anything above the batch threshold
Hard to undo (emails to customers, payments, posts)Prepare the actionApprove before it is sent, at least until the error rate is known
Destructive (deleting data, changing production)Propose onlyA person executes, or approves each one with an undo window

Regulators have reached the same conclusion from the other direction. After Knight, the SEC brought its first case under the Market Access Rule, which requires brokers to block orders that exceed pre-set thresholds, and fined the firm $12 million. Article 14 of the EU AI Act requires that people overseeing a high-risk AI system can interrupt it "through a 'stop' button or a similar procedure". The NIST AI Risk Management Framework asks for mechanisms to disengage or deactivate a system that behaves outside its intended use.

One caution from our last post: a review step only works if you measure it. Reviewers over-trust and under-trust AI in predictable ways, so send them the unusual cases with a cost estimate attached, not a queue of everything.

8. What Should You Check Before Anything Runs Unattended?

Ask these of every autonomous pipeline or agent that spends money or changes data. Any "no" is an open blast radius.

  • If the same input arrives twice, do we pay once?
  • Is there a hard spend cap per run and per day, enforced in our own code?
  • Does an unusual spike in volume pause intake automatically?
  • Do large batches wait for a person, with a cost estimate attached?
  • Can one person stop everything in under a minute, and have we tested it?
  • Do we alert on spend and throughput, not only on errors?
  • Does every credential the system holds reach only what the task needs?
  • Do we know our worst-case cost for a single mistake?

Our $10,000 bought us that list. Bounds, budgets and brakes that act faster than any person could are what "autonomous" has to mean in production. The checklist is how you skip paying for the lesson yourself.

Go deeper on guardrails for autonomous AI systems with AI

Ask your next question with this article as context. Opens in a new tab; you can edit the question before sending.

  • Which guardrails is our autonomous pipeline missing?
  • Design a spend budget and kill switch for our agent
  • What is our worst-case cost for a single mistake?
  • Where should a human approve in our workflow?

9. Frequently Asked Questions

What is runaway automation?

Runaway automation is an autonomous process that keeps executing a costly action at machine speed after a person would have stopped. Nothing is technically broken: every step succeeds, but there is no ceiling on how many times it runs, so one bad input becomes a large bill or a large amount of damage.

What guardrails do autonomous AI agents need?

At minimum: idempotent actions so repeats are free, a hard spend budget enforced in your own code, a circuit breaker that pauses on unusual volume, human approval for large or irreversible actions, a cost estimate before execution, a tested kill switch, credentials that reach only what the task needs, and alerts on spend and throughput.

What is a Denial of Wallet attack?

Denial of Wallet is when pay-per-use billing is driven up until the cost becomes the outage. OWASP lists it under unbounded consumption in its top 10 risks for LLM applications, as something an attacker does. A runaway pipeline can do the same thing to you with no attacker involved.

What is an AI kill switch?

An AI kill switch is a single control that halts an autonomous system quickly, usually a flag the system checks before every costly action. It only counts if it is tested regularly and people know who may use it. The EU AI Act requires a comparable stop mechanism for high-risk AI systems.

Do LLM providers' spend limits stop runaway costs?

Only partly. OpenAI, Anthropic and Google all offer hard spend limits, but they are monthly, mostly opt-in or tied to an account tier, and enforcement lags usage. They cap the worst month, not a single run, so you still need a budget counter in your own application.

Do autonomous systems still need a human in the loop?

For the common, cheap and reversible cases, no. For large batches, irreversible actions and anything outside the conditions you tested, yes: the system should pause and ask, with a cost estimate, and a person should approve.

10. Sources

The document pipeline incident is our own. The Replit case is from press reports, with no published post-mortem from the vendor. The $10 million a minute figure is our arithmetic from the reported loss. Provider limits change often, so check the linked pages before relying on them. Sources checked November 30, 2026.

Found this useful? Share it.

Share:

Related Articles