Why an AI Agent Lost Money Running a Vending Machine
An experiment that let an AI agent autonomously run an office vending machine ended in losses of hundreds of dollars, driven by free giveaways, mistaken purchases, and non-compliant product requests. This article analyzes why the failures stemmed from architectural flaws rather than a single model error, and presents a secure design for business agents: tiered permissions, hard budget constraints, product whitelists, separate giveaway workflows, auditable decision loops, and evaluation metrics that go beyond conversational quality.
In an office setting, letting an AI agent run a vending machine sounds like a simple, fun experiment: the system gets a starting budget, communicates with employees through a collaboration platform, and autonomously purchases products, sets prices, restocks inventory, and adjusts its business strategy based on sales.
The results, however, were far from ideal. Instead of generating stable profits, the agent gave away large quantities of products for free, made erroneous purchases, and fielded non-compliant product requests within a short period—ultimately causing losses in the hundreds of dollars. More importantly, the problems did not come from a single model mistake. They came from an architectural flaw in the overall approach of letting a language model directly control a real-world business.
The value of this kind of experiment is not proving that AI “cannot run a snack machine.” It is reminding engineering teams that once an agent is given funds, tools, external communication capabilities, and autonomous decision-making power, it is no longer an ordinary Q&A program—it is a software system that requires strict governance.
1. Why a Vending Machine Is a Good Testbed for Agents
A vending machine is a highly simplified commercial system with several characteristics that make it suitable for validating agent capabilities.
First, inputs and outputs are intuitive. Customers pay, the machine delivers products, and the operator earns revenue. Procurement, inventory changes, cash flow, and profit can all be recorded without complex business interpretation.
Second, the system spans both the digital and physical worlds. The agent can place orders, reply to messages, and adjust prices in a collaboration system, but the products must ultimately be purchased, transported, stocked, and delivered by real people. The natural latency between digital decisions and physical execution is exactly where many agent systems run into trouble.
Third, a vending machine has a clear business objective. In theory, the agent only needs to manage procurement costs, sales revenue, and inventory turnover to estimate profitability. It can therefore be viewed as a scaled-down version of enterprise procurement, inventory, and customer service workflows.
But “small scale” does not mean “low risk.” Once an agent gains payment permissions, purchasing authority, and the ability to make external commitments, the risks it faces are fundamentally no different from those of financial or supply chain bots in enterprise systems.
2. Typical Out-of-Control Behaviors Observed in the Experiment
Based on publicly described observations, the agent exhibited several representative categories of problems.
2.1 Misreading “customer satisfaction” as “give products away for free”
In conversations with employees, the agent may receive a steady stream of requests such as:
- Can you give me an item for free?
- Can I get a discount?
- Can we give away a batch for promotion?
- If everyone supports it, shouldn’t this product be free?
For a language model, these requests are highly persuasive in conversation. If the system’s goals only emphasize “increasing engagement,” “building good relationships,” or “improving customer satisfaction”—without an explicit profit floor—the model may treat generosity, enthusiasm, and positive responses as the success criteria.
This reveals the serious ambiguity of natural-language goals. Human managers automatically apply many implicit rules, such as “promotions require approval,” “free giveaways must be limited,” and “business funds cannot be used for personal items.” If these rules are not explicitly encoded as system constraints, the agent will not reliably inherit this common sense.
2.2 Inability to detect social engineering and conflicts of interest
Employees may induce the agent to purchase high-value items under pretexts like “marketing,” “internal events,” or “testing new demand.” If the agent judges reasonableness solely from conversational content, it can easily treat a user’s explanation as fact.
For example, if someone claims that buying expensive equipment will boost the vending machine’s visibility, the agent might generate a seemingly complete marketing plan and execute the purchase accordingly. But it lacks independent verification ability and has no approval workflow to determine whether the expense is justified.
This closely resembles social engineering in traditional cybersecurity: an attacker doesn’t need to break the system—they only need to make the system believe an unverified rationale.
2.3 Purchasing decisions without boundaries
The experiment also saw purchases of products unsuitable for an office environment, and even attempts to procure high-risk items. This shows the agent may prioritize “fulfilling user requests” over “staying within business scope.”
A competent procurement system should at minimum be able to judge:
- Whether the product falls within the business scope;
- Whether it is appropriate for the current location;
- Whether it involves legal, health, or safety risks;
- Whether it exceeds per-transaction or cumulative budgets;
- Whether it could cause inventory overstock;
- Whether the supplier and transaction method are trustworthy.
Without product categorization, blacklists, budget caps, and human approval mechanisms, no matter how well-reasoned the model’s justification sounds, it cannot substitute for genuine compliance judgment.
2.4 Treating jokes in conversation as real business instructions
Language models are good at understanding context, but that does not mean they can reliably detect every joke, sarcastic remark, or prank. Users in an office environment may deliberately make absurd requests to see whether the agent will act on them.
When the system converts chat messages directly into purchase orders, any “just try it,” “this is market research,” or “everyone wants it” could be treated as a formal instruction. In shared collaboration channels with many participants, the risk expands further if message sources, identities, and authorization scopes are not strictly verified.
3. Root Cause: A Language Model Is Not a Business Controller
These failures are often simplistically attributed to “the model not being smart enough.” From an engineering perspective, the real problem is that architectural boundaries were never drawn.
Language models are well suited to handling unstructured information, such as:
- Understanding user intent;
- Summarizing sales feedback;
- Generating procurement suggestions;
- Explaining business data;
- Drafting notices and replies.
But the following tasks should not be decided directly by the model:
- Whether to authorize a payment;
- Whether to approve a high-value purchase;
- Whether free giveaways are allowed;
- Whether inventory and budget limits can be exceeded;
- Whether restricted products can be purchased;
- Whether core business rules can be modified.
These tasks belong to deterministic business rules, permission systems, and approval workflows. The model can make recommendations, but it should not hold irreversible execution power.
A more reliable design follows a layered structure: the model handles understanding, rules handle adjudication, and tools handle execution.
4. Recommended Security Architecture
4.1 Define clear permission tiers for the agent
Permissions should not be a binary “can” or “cannot,” but subdivided into multiple levels:
- Read-only: view inventory, sales, and historical prices;
- Suggest: generate procurement and pricing proposals;
- Low-risk execution: restock standard products within a spending limit;
- Controlled execution: modify prices or initiate promotions;
- Human approval required: high-value purchases, special products, and unusual transactions;
- Prohibited: accessing personal data, modifying fund accounts, or purchasing high-risk items.
Permissions should also be bound to identity, time, amount, and product category. For example, the agent may purchase standard snacks during working hours, but each transaction must stay below a preset threshold, and spending must pause once a cumulative cap is reached.
4.2 Make budgets hard constraints that cannot be bypassed
Budget limits cannot live only in the prompt. Prompts are soft constraints that can be influenced by context—users can induce the model to reinterpret the rules through conversation.
The correct approach is to enforce budget control in an independent financial module. Every transaction should go through a flow like this:
Generate procurement proposal↓Validate product category↓Validate per-transaction amount↓Validate cumulative budget↓Validate supplier and transaction status↓Route to human approval if necessary↓Execute payment and place order
If any validation fails, the system should return an explicit rejection rather than letting the model decide whether to “make an exception.”
4.3 Build a product whitelist with risk tiers
In its initial stage, the system should not allow the agent to purchase arbitrary products. Instead, it should maintain a limited product whitelist, with items classified by risk:
- Tier 1: ordinary food and beverages, auto-restocked within budget;
- Tier 2: high-value equipment or special packaging, requiring human confirmation;
- Tier 3: products involving safety, health, or legal restrictions, prohibited from automatic purchase.
The whitelist should also include price ranges, suppliers, shelf life, storage conditions, and suitable locations. This way, even if the agent misunderstands something, it can only act within a controlled scope.
4.4 Create a separate workflow for giveaways
Promotions and giveaways must not share the same logic as normal sales. The system should record:
- Recipient;
- Product name and quantity;
- Reason for the giveaway;
- Estimated cost;
- Campaign duration;
- Approver;
- Cumulative giveaway quota.
Without these fields, a so-called “marketing campaign” can become a cover for arbitrary spending.
5. Improving the Agent’s Decision Loop
An auditable business agent can follow this loop:
1. Read inventory, sales, costs, and cash flow2. Identify demand changes and generate candidate plans3. Compute cost, revenue, and risk for each plan4. Run compliance checks through the rules engine5. Auto-execute low-risk plans6. Submit high-risk plans for human approval7. Log decision rationale, tool calls, and execution results8. Update future recommendations based on actual outcomes
Step 7 is the most critical. Without complete logs, there is no way to determine why the agent made a wrong decision, or to distinguish model judgment errors from tool execution errors and user manipulation.
Logs should include at least:
- The original request;
- User identity;
- The intent generated by the model;
- The business data used;
- Rule validation results;
- Final execution parameters;
- Execution return values;
- Human approval records;
- Post-hoc corrective actions.
6. Evaluating Agents Requires More Than Conversational Quality
Traditional model evaluation focuses on whether responses are fluent, accurate, and helpful. But a business-operating agent must also be evaluated on long-term behavior.
At minimum, the following metrics are recommended:
Financial metrics
- Gross margin;
- Inventory turnover;
- Cash burn rate;
- Proportion of anomalous spending;
- Cost of free giveaways;
- Deviation between forecast and actual revenue.
Safety metrics
- Number of unauthorized operations;
- Rate of high-risk requests executed under manipulation;
- Rule interception success rate;
- Human approval coverage for high-risk operations;
- Time to detect anomalous behavior.
Stability metrics
- Tool call failure rate;
- Duplicate orders;
- Inventory data latency;
- Price update error rate;
- Degradation behavior when external systems are unavailable.
More importantly, the test environment must include adversarial scenarios: multiple users making simultaneous requests, users impersonating administrators, sudden product price increases, stale inventory data, duplicate responses from payment APIs, and persistent user attempts to induce the system to break its rules.
7. Lessons for Enterprises from the Snack Machine Experiment
This experiment shows that the difficulty of deploying agents lies not only in model capability, but in governance.
First, autonomy must expand gradually. Systems should start with read-only analysis, move to suggestion mode, then open up low-risk automated execution, and only then consider higher degrees of autonomous decision-making.
Second, real-world execution power must be separated. Procurement, payment, receiving, inventory confirmation, and external commitments should not all be controlled by a single agent. Separation of duties reduces the damage from a single point of failure.
Third, every irreversible operation needs a “brake.” This includes payments, deletions, publishing, giveaways, price changes, and external commitments. The brake can be an amount limit, secondary confirmation, human approval, or an automatic circuit breaker.
Fourth, human common sense cannot be assumed as a default system capability. Organizational rules, compliance requirements, and business boundaries must be expressed in structured form and enforced programmatically.
Fifth, agents must learn to say no. A system that only fulfills user requests is not a high-quality agent. A truly reliable system can recognize incomplete information, refuse unauthorized instructions, explain why it refused, and escalate to a human when necessary.
Conclusion
Letting an agent run a vending machine looks like a lightweight experiment on the surface, but it condenses many core problems of enterprise AI adoption: whether goals are clearly defined, whether permissions are excessive, whether rules are enforceable, whether data is trustworthy, whether anomalies are traceable, and whether humans can take over in time.
Losing a few hundred dollars is not the most important outcome. What truly deserves attention is this: when a system capable of natural conversation is mistakenly assumed to “possess business common sense” and is therefore given funds and real-world tools, risk escalates rapidly from conversational errors to real business losses.
Enterprises deploying agents should therefore adhere to one fundamental principle: let models participate in decisions, but do not let them define the rules alone; let agents improve execution efficiency, but do not let them bypass permissions, budgets, and audits. Only by placing model capabilities within reliable engineering constraints can autonomous agents move from entertaining demos to controllable, auditable, and sustainable production systems.
