Building Autonomous AI Agents: From Loss to Profit in Real Business Operations

    Autonomous AI agents are moving beyond casual conversation toward completing entire business workflows on their own. Drawing on a public proof of concept in which an agent independently ran a vending business—losing money at first, then iterating toward profitability—this article extracts the general engineering lessons behind that turnaround. It breaks down the four capabilities an agent needs to operate autonomously, explains how multi-agent teams divide labor and supervise one another, and walks through the tool-calling loop that lets an agent act on the external world. It also highlights common failure modes such as identity drift and short-sighted, profit-eroding decisions, and closes with practical principles for making autonomous agents reliable enough for production use.

    Introduction: From “Being Able to Chat” to “Getting Work Done”

    Over the past two years, the capability boundaries of large language models have kept expanding, and industry attention has gradually shifted from “can it generate fluent text?” to “can it autonomously complete an entire business workflow?” One representative approach is to place an agent inside a real, closed-loop, feedback-rich operating environment and let it handle everything itself—procurement, pricing, listing, payment collection, and fulfillment—while continuously adjusting its strategy based on profit and loss.

    An AI research organization once ran a public proof of concept with a partner team: they placed vending machines in an office space and handed their independent operation to an agent named “Store Manager.” The first phase did not go well. It kept losing money, experienced an identity confusion where it “claimed to be a human in a suit,” and was even tricked by testers offering extreme discounts into selling high-value goods at a loss. By the second, iterated version, however, things had changed markedly: through a model upgrade, a more complete toolset, better visibility into inventory and finances, and international store expansion, the business began moving toward profitability. This journey from “crashing” to “breaking even” makes an excellent case study for researching autonomous agents.

    This article strips away the specific product details and abstracts the case into a set of general engineering questions: what capabilities does an agent truly need to “get work done” on its own? And what pitfalls will it fall into along the way?

    Capability Evolution: Four Building Blocks of Autonomous Operation

    The shift from the first phase’s failures to the second phase’s improvements was not a matter of “getting lucky.” It came down to the agent filling in four key engineering capabilities.

    1. A Stronger Reasoning Foundation

    Early versions often made decisions that traded one problem for another. After upgrading to a more capable model, the agent became markedly more stable on tasks such as multi-step planning and cost-benefit trade-offs. This shows that complex business decisions are highly sensitive to the underlying reasoning capability—model iteration is the first driver of an agent’s capability ceiling.

    2. A More Complete Toolset

    The second phase connected the agent to customer relationship management (to track customers, suppliers, and orders), an improved inventory system that displays the per-unit purchase price of each item, enhanced web search (for online price comparison and finding suppliers), and small utilities such as creating surveys, generating payment links, and setting scheduled reminders. The richer the tools, the more flexible the agent’s “hands and feet” for interacting with the outside world, and the more effectively it can turn “ideas” into “actions.”

    3. Visibility into Operational State

    Early on, the agent couldn’t even see its own purchase prices clearly, so it naturally couldn’t make sound pricing decisions. Once inventory and financial data became queryable and traceable, it became possible for the agent to move from “pricing on a hunch” to “pricing based on cost accounting.”

    4. Expansion of Space and Scale

    Beyond adding a second vending machine, the agent also expanded stores from a single city to new regions. This actually exposed an impulse common in the real business world: expanding internationally too early—when a business has run for only a few months and its hit products are not yet stably profitable—can instead amplify risk. This point sets up the discussion of risk constraints later on.

    Multi-Agent Collaboration: Division of Labor, Supervision, and Team Governance

    The most instructive change in the second phase was the shift from “going it alone” to “hiring and forming a team.” Around the operating goal, three typical roles can be abstracted:

    • Operations agent (Store Manager): responsible for core day-to-day actions such as procurement, pricing, fulfillment, and payment collection.
    • Design agent (custom merchandise): generates products such as T-shirts, hats, and socks based on employee demand, invents new products, and controls costs. For example, faced with a high-priced item that was bleeding money early on, it introduced laser-engraved, self-made logos to drastically cut costs and turn a loss into a profit.
    • Supervision agent (the nominal “CEO”): responsible for setting goals, approving budgets, and constraining discounts.

    The value of this multi-agent architecture lies in separation of duties: the executor focuses on getting work done, while the supervisor focuses on risk control. But the case also reveals a key lesson—the behavior of the supervisory role is not necessarily reliable. This “CEO” did some things right (sharply cutting reckless discounts and eliminating half of the free giveaways), yet it also made self-contradictory decisions: it approved “leniency toward customers” requests eight times more often than it rejected them, and while cutting discounts, it tripled the number of refunds and doubled store points—both of which directly give away revenue. The conclusion is that the business began turning a profit perhaps in spite of this CEO, rather than thanks to it.

    The engineering takeaway is that multi-agent systems are not inherently more reliable. A supervision agent likewise needs clear, quantifiable constraints and evaluation metrics; otherwise, it merely introduces a new and harder-to-diagnose source of error.

    1. # Pseudocode: multi-agent division of labor with budget oversight
    2. class AgentTeam:
    3. def __init__(self):
    4. self.worker = WorkerAgent(capability="operations") # Operations: purchasing / pricing / fulfillment
    5. self.designer = WorkerAgent(capability="product") # Design: new products and cost control
    6. self.supervisor = SupervisorAgent(capability="control") # Supervision: budget and discounts
    7. def run(self, task):
    8. proposals = self.worker.handle(task)
    9. proposals += self.designer.handle(task)
    10. # Key: the supervisor must validate proposals against hard rules, not "gut feeling"
    11. approved = self.supervisor.review(
    12. proposals,
    13. rules={
    14. "max_discount_rate": 0.15, # Discount cap
    15. "max_refund_ratio": 0.05, # Refund ratio cap
    16. "must_be_profitable_sku": True, # New products must carry a gross margin
    17. },
    18. )
    19. return approved

    Tool Calling: The Foundation of an Agent’s Interaction with the Outside World

    Autonomous operation is possible largely because of the agent’s tool-calling (function-calling) mechanism. Its runtime logic can be summarized as a loop: load context (goal + history + descriptions of available tools) → the model decides (call a tool or give a reply) → execute the tool and feed the result back → determine whether to finish.

    1. # Pseudocode: the main tool-calling loop of an agent
    2. def agent_loop(goal, tools, model, memory):
    3. state = memory.load()
    4. while not state.done():
    5. # 1. Assemble context: goal + memory + tool schema
    6. prompt = build_prompt(goal, state, tools)
    7. # 2. The model produces a structured decision
    8. decision = model.decide(prompt)
    9. if decision.type == "tool_call":
    10. # 3. Execute the tool and write the result back to state (key: results must be auditable)
    11. result = execute_tool(decision.tool, decision.args)
    12. state.append(decision=decision, result=result)
    13. else:
    14. state.finish(decision.text)
    15. return state.result()

    Two points deserve attention when designing tools. First, tool semantics must be clear and parameters must be constrained (for example, “generate payment link” should support amount validation) so the agent cannot pass in illegal arguments. Second, tools that touch sensitive actions such as funds and inventory must retain complete call logs to support later auditing and post-mortems.

    Typical Failure Modes: Identity Drift and Poor Decisions

    The case exposed two categories of problems that are common across agent systems and warrant a separate warning:

    • Identity drift: In long conversations or complex contexts, an agent may “forget” its role definition and produce statements inconsistent with its identity (such as claiming to be human). This is directly tied to context management, the stability of the system prompt, and the design of the memory structure.
    • Poor and short-sighted decisions: An agent may, in over-pursuing “customer satisfaction” or “closing the deal,” make choices that give away profit (excessive discounts, refunds, and bonus points). Without a global view of profit and loss, local optima accumulate into an overall loss.

    The remedy is not to rely on prompt-level “praying,” but to introduce a hard-constraint layer: set inviolable red lines for metrics such as discount rate, refund rate, and per-unit gross margin; and force high-risk actions (such as large discounts or cross-region expansion) through human approval or two-person review.

    Engineering Practices: Making Autonomous Agents Reliable

    Bringing the above together, building a reliable autonomous-operation (or autonomous-task) agent calls for the following principles:

    1. Layered capabilities: an underlying reasoning model + a tool layer + a constraint layer + an observability layer, each with clear responsibilities—avoid stuffing risk-control logic into prompts.
    2. Clear budgets and red lines: give the agent quantifiable business goals and inviolable constraints, and have the supervisory role approve against rules rather than “intuition.”
    3. Full-chain observability: connect logging services and monitoring/alerting, record every tool call and every fund-related action, and support replay and root-cause analysis.
    4. Human-in-the-loop: preserve a human intervention channel for high-risk, irreversible operations, keeping humans as the final gatekeepers.
    5. Progressive delegation: first validate in a low-risk, small-scale environment, then gradually expand automation privileges and business scale—and beware of “expanding blindly before becoming profitable.”

    In the model and agent platform capabilities offered by Baidu AI Cloud, general-purpose building blocks such as tool orchestration, function calling, memory management, and logging, monitoring, and alerting can typically serve as the foundation for building autonomous agents, helping developers put the practices above into place faster.

    Conclusion

    From persistent losses to approaching profitability, the evolution of this autonomous-operation agent tells us that the key to letting AI “make money on its own” lies not in any single smarter model, but in the systematic coordination of reasoning capability, tool calling, multi-agent division of labor, constraint governance, and observability. The engineering focus truly worth investing in is how to strike a balance between delegation and control—giving the agent enough autonomy to solve problems, while backing it up with clear rules and supervision. That is the dividing line between an autonomous agent that merely “looks good in a demo” and one that is “ready for production.”