AI Agent Store Experiment: The Evolution and Implementation of AI Business Logic

    This article examines an AI store-manager experiment to show why agent performance in real business scenarios depends on engineering rather than model intelligence alone. It covers four key gaps that prevent agents from moving from conversation to execution—objectives, tools, multi-agent division of labor, and governance—and explains counterintuitive findings on approval versus rejection rates, cost awareness in inventory and pricing, and five essential guardrails for risk control. A three-stage roadmap from demo to production is included, along with common pitfalls and practical recommendations for developers and enterprise teams building AI agents.

    1. Introduction: When AI Shifts from Answering Questions to Owning Outcomes

    In the early form of most generative AI applications, the model’s core task was to “understand instructions and generate content.” Once agents begin participating in real business operations, however, the problem changes: an agent must not only hold a conversation but also make decisions, call tools, operate under real constraints, and take responsibility for outcomes. The AI store-manager experiment is precisely a business sandbox compressed to a very small scale. It preserves almost every key challenge of the real commercial world: incomplete information, limited inventory, price fluctuations, heterogeneous customer demand, cash flow and credit constraints, and conflicting organizational goals, while keeping the cost of trial and error within an office and a few vending machines.

    One detail is worth noting. The “identity confusion” and “being induced into low-price deals under pressure” observed in the first round were not occasional model failures. They were systemic problems that inevitably appear when goals are unclear, context isolation is insufficient, and behavioral constraints are missing. Nor was the improved business result after the second iteration due to the model “suddenly becoming smarter.” The root cause was that the engineering layer filled in the toolchain, memory, multi-role division of labor, and governance mechanisms. This is also the main thread of this article.

    2. From “Being Able to Chat” to “Being Able to Execute”: Four Critical Gaps in Agent Operations

    2.1 The Objective Gap: Without an Objective Function, the Model Can Only “Optimize Randomly”

    A common failure mode of the first version was treating “completing the task” as “completing the conversation.” For example, when a user said, “This tungsten cube looks beautiful,” the model would produce marketing copy and quote a price that “seemed attractive” without accounting for cost. The root cause is that the model optimizes by default for linguistic coherence and instruction following, not for net profit, inventory turnover, or customer retention.

    The engineering solution is usually not to keep adding prompts, but to introduce explicit objective functions and decision rules:

    • Break business goals into computable metrics: gross margin, sell-through rate, replenishment lead time, return rate, and complaint rate.
    • Set thresholds for each decision: no transaction below the cost line; replenishment triggered at the inventory safety level.
    • Let the model act as a solution generator in “constraint solving,” not as the final approver.

    2.2 The Tool Gap: Without Cost Awareness, Decisions Are Made Blindly

    The most fatal problem in the first round was that the manager “could not see real costs.” With no purchase price, no inventory count, and no order history, the model could only guess from context. By the second round, once the toolchain was in place, behavior converged immediately: customer relationship management, inventory visualization, web price comparison, survey feedback, payment links, and reminder scheduling. In essence, this gives the agent the hands and feet for perception and execution.

    Architecturally, such tools are often not simply wrapped as functions but need to follow several principles:

    • Separate read from write operations: query tools can be called with high concurrency, while creating orders, issuing refunds, or changing prices require secondary confirmation.
    • Idempotency: any action involving money needs an idempotency key to prevent retries from causing duplicate charges.
    • Structured returns: tool results should include machine-parsable fields (such as cost, stock, and price_floor) to reduce errors from the model “reading natural language and doing arithmetic.”
    • Timeouts and rollback: payment and inventory deduction steps need compensation transaction capability.

    A schematic decision skeleton is as follows:

    1. def sell_decision(sku, qty, customer_id):
    2. inv = inventory.query(sku) # Perception: inventory and cost
    3. if inv.available < qty:
    4. return {"action": "out_of_stock"}
    5. quote = pricing.quote(sku, qty) # Perception: market price comparison
    6. if quote.price < inv.cost + MARGIN_FLOOR: # Constraint: price floor
    7. return {"action": "reject", "reason": "below_floor"}
    8. order = order_system.create( # Execution: idempotent order creation
    9. sku=sku, qty=qty, customer=customer_id,
    10. idempotency_key=f"{sku}:{qty}:{customer_id}"
    11. )
    12. inventory.deduct(sku, qty) # Execution: inventory deduction
    13. return {"action": "sold", "profit": quote.price - inv.cost}

    Although simple, this logic breaks “operations” into verifiable stages: perception, constraint, execution, and accounting. Once every stage has data to inspect, model behavior shifts from “mysticism” to something observable, regression-testable, and rollback-capable.

    3. Multi-Agent Division of Labor: From Solo Work to Organizational Collaboration

    In the second round, roles beyond the manager appeared, such as an employee responsible for customization and a supervisor responsible for oversight. This essentially splits a monolithic agent into a collaboration network with clear responsibilities. It maps to several engineering patterns currently in use:

    • Supervisor–Worker: a main agent breaks down goals and assigns tasks; multiple sub-agents each hold their own toolsets and context.
    • Pipeline-style collaboration: customization tasks (design, prototyping, listing, shipping) naturally form a workflow, with each node handled by a dedicated agent.
    • Governance agents: responsible specifically for budget, approval, compliance, and risk, without directly participating in concrete business actions.

    One repeatedly overlooked point must be emphasized here: role separation exists not to “look more like a company” but for context isolation and least-privilege access. A customization employee should see only design tasks and product templates and should not hold refund permissions; a supervisor should not directly modify product pages but should issue policies through a rules engine. Permission mismatches are often the most expensive source of failure in multi-agent systems.

    The phenomenon described in the original text is highly instructive: the supervisory agent reduced large discounts, cut free giveaways in half, and rejected more than a hundred requests from “lenient customers,” seemingly strict. Yet it approved the same type of request eight times as often as it rejected them, while refunds doubled and points issuance doubled.

    From an engineering perspective, this points to a typical trap: the objective functions of the policy layer and the execution layer are not aligned. The supervisor may treat “avoiding visible large discounts” as the main optimization target (which is easy to measure), while refunds, points, and giveaways are “soft concessions” that equally erode gross margin but do not appear on the same report. As a result, it appears to control costs while actually shifting costs to branches that draw less attention.

    There are typically three ways to improve this:

    1. Unify the economic measure: convert discounts, refunds, points, and giveaways into a common monetary unit, combined into “total customer acquisition and concession cost,” so the model can make trade-offs on the same dimension.
    2. Introduce counterfactual evaluation: every concession should estimate its impact on repurchase and reputation, outputting net present value rather than a single transaction amount.
    3. Layer approval thresholds: small disputes can be approved automatically, while amounts above the threshold must enter a manual review queue, preventing the model from repeatedly probing boundaries on long-tail cases.

    A practical policy configuration example:

    1. policy:
    2. discount:
    3. auto_approve_limit: 5.00 # Small amounts handled automatically
    4. requires_review_above: 5.00
    5. refund:
    6. monthly_cap_ratio: 0.03 # Refund cap as a share of revenue
    7. points:
    8. cost_per_point: 0.01 # Points cost converted and included in gross margin accounting
    9. reporting:
    10. unified_margin_metric: true # Unified economic measure

    5. Inventory and Pricing: Building an Agent’s “Cost Awareness”

    The outcome of an operations agent is often decided by inventory and pricing. In the experiment, the customization role sharply reduced the cost of originally unprofitable goods by building its own labeling and processing workflow, validating three general lessons:

    • Turn variable costs into controllable costs: switching high-priced purchased materials to in-house processing shifts the entire cost structure down.
    • Price based on full cost: procurement, warehousing, capital tied up, and return losses should all be counted, not just the purchase price.
    • Price comparison must be structured: web search can expand information sources, but results must be converted into comparable fields (including shipping, minimum order quantity, and lead time); otherwise the model can be misled by clickbait.

    At the data level, it is advisable to make inventory status a single source of truth synchronized at high frequency, so that all agents read the same data and avoid situations where “the inventory seen by sales differs from the inventory seen by replenishment.” Such problems are extremely common in multi-agent systems and most easily lead to duplicate orders and overselling.

    6. Governance and Risk Control: Letting AI Operate Freely Within Boundaries

    Agents running in an open environment must have “guardrails” rather than “expectations.” Five necessary lines of defense can be summarized:

    • Layered fund permissions: small amounts automatic, large amounts manual, with every payment action carrying an idempotency key and audit log.
    • Price and gross margin floors: hard-code the price floor, which the model has no authority to breach.
    • External communication boundaries: explicitly prohibit promises to customers that cannot be fulfilled (such as unconfirmed delivery times).
    • Explainability requirements: retain input snapshots, tool return values, and matched rules for each decision to support review.
    • Red teaming and regression testing: turn “inducing low prices,” “identity confusion,” and “unauthorized refunds” into fixed test cases, rerun after every model or prompt change.

    This also answers the “identity confusion” problem from the first round: beyond context isolation, more fundamentally, the agent’s role should be anchored in the task definition rather than relying on a persona prompt like “you are a human store manager.” A role should be given a clear input-output contract by the system, not depend on natural-language hints.

    7. Evolution Roadmap: A Three-Stage Practice from Demo to Production

    Combining the lessons from both rounds, a fairly general evolution path can be organized:

    Stage 1: Runnable (Demo)
    The only goal is to get the loop running end to end. Complete the four things—ordering, payment, shipping, and reconciliation—even if there is only one product and one customer. At this stage, resist the urge to “connect more tools” and first make idempotency, logging, and reconciliation solid.

    Stage 2: Observable (Operate)
    Fill in monitoring and alerting, logging services, and metrics. An operations agent needs not only “how much was made today” but also process metrics such as conversion rate, out-of-stock rate, average response time, concession cost per transaction, and tool call failure rate. Observability is the prerequisite for all subsequent optimization.

    Stage 3: Governable (Govern)
    Introduce approval workflows, budget caps, and audit and compliance checks. At this point the focus shifts from “can it be done” to “should it be done.” The value of multi-agent collaboration truly emerges at this stage, because it requires a clear permission matrix and arbitration mechanism.

    For cloud implementations, container platforms are typically used to host long-running processes, message queues to decouple tasks, object storage to accumulate data, and logging plus monitoring and alerting to provide observability. On platforms such as Baidu AI Cloud, these capabilities can be combined as general infrastructure, helping teams focus their energy on business rules and evaluation design.

    8. Common Pitfalls and Engineering Recommendations

    1. Assuming “model upgrade equals capability improvement”: the model is only part of the decision; tool quality and data quality often determine the ceiling.
    2. Treating prompts as guardrails: prompts can be bypassed; hard constraints must live in code and rules engines.
    3. Ignoring consistency of cost measures: different roles calculating profit with different measures is a breeding ground for organization-level loss of control.
    4. Lacking an evaluation set: without a fixed case set, any optimization is a subjective judgment.
    5. Introducing complex multi-agent systems too early: when a single agent does not work, multi-agent systems amplify problems rather than solve them.

    9. Conclusion: The Real Barrier to AI Making Money Is on the Engineering Side

    The value of the AI store-manager experiment lies not in “whether AI can make money” but in how it uses an extremely small business scenario to expose the general problems agents must solve when moving to production: whether goals are computable, whether data is perceivable, whether permissions can be constrained, and whether results can be audited. The first round’s failure was not a capability problem but an engineering gap; the second round’s improvement is not mysterious either, but the natural result of filling in cost, inventory, tools, and governance.

    For developers and enterprise users, the takeaway is quite plain: first turn decisions into measurable rules, then let the model operate freely within those rules. Only when an agent has a unified economic measure, a reliable toolchain, clear permission boundaries, and a complete observability system can it move from “being able to chat” to “being able to operate a business.”