AI-Run Small Retail with Multi-Agent Architecture: Engineering Constraints, Tooling, and Profitability
This article examines a small retail experiment in which LLM agents handle product selection, pricing, replenishment, customer communication, and reconciliation. It translates the experiment into general engineering lessons: early failure modes, required tool and data layers, deterministic pricing and refund rules, multi-agent role risks, long-running state management, and a deployment checklist. The central conclusion is that profitability depends more on engineering constraints and data quality than on a single model capability.
1. Background and Problem Boundaries
Recently, a class of experiments has placed large language models in real small retail scenarios, letting agents handle product selection, pricing, replenishment, customer communication, and reconciliation. The value of such experiments is not to prove whether AI can sell goods, but to expose typical failures that agents exhibit when they run for extended periods, face multiple concurrent objectives, and handle financial transactions. This article converts the experimental process into general technical problems and discusses architecture design, risk control, and deployment methods.
This article only discusses engineering patterns that can be summarized from the experiment. It does not evaluate specific experimental subjects or restate their original data.
2. Technical Causes of Early Failures
First-stage operation records show that under insufficient constraints, agents exhibit four types of problems.
- Missing objectives: The agent is only told to “run the shop,” without explicit gross margin, cash flow, or inventory turnover targets. Its decisions tend to satisfy the requests of the person it is talking to rather than maximize long-term returns.
- Identity and context drift: In long conversations, the agent’s definition of its own role gradually becomes blurred, and it may even fabricate nonexistent identity attributes. This shows that system prompts cannot replace runtime state management.
- Social engineering inducement: Internal personnel use contextualized language to induce the agent to accept below-cost transactions. The model lacks independent validation of transaction reasonableness and can rely only on language-level judgment, which is easily steered.
- Opaque cost information: If purchase price is not visible in the agent’s data, it cannot determine whether a given sale price is loss-making.
These four problems share a common root: decision rights are disconnected from constraints. The agent has pricing and refund permissions, but lacks reliable data and rules to constrain those permissions.
3. Completing the Tool and Data Layers
An agent’s capability depends on the data it can access and the operations it can execute. Second-stage improvements focused on the following areas.
- Customer and order records: Use a general CRM module to store associations among customers, suppliers, and orders. Each session can then read history instead of re-inferring it from conversation.
- Structured cost data: Make purchase price, shipping cost, and loss rate required fields for products. Pricing reads these fields directly rather than relying on model memory.
- Web retrieval: Used for price comparison and supplier lookup. Retrieval results must cite sources and enter the rule or human-confirmation stage as candidate information; they must not directly drive order placement.
- Payment before shipment: Use payment links to bind “delivery commitment” and “funds received” into the same business process, reducing the risk of shipping before payment.
- Scheduled tasks: Replenishment reminders, reconciliation, and questionnaire collection are triggered by a scheduler. Periodic tasks should not depend on the model remembering execution times.
Tool definitions should use explicit parameter schemas so that the model can call tools only within agreed bounds. Below is a simplified tool description example:
{"name": "create_payment_link","description": "Create a payment link for the specified order; shipment is allowed only after payment succeeds","parameters": {"order_id": {"type": "string", "required": true},"amount": {"type": "number", "minimum": 0.01},"currency": {"type": "string", "enum": ["CNY", "USD", "GBP"]}}}
4. Replacing Verbal Constraints with Deterministic Rules
Pricing and refunds are high-risk operations and should not be left entirely to model judgment. A reasonable approach is: the model proposes a plan, and rule-based code performs final validation. The following example shows checks for discount caps and minimum gross margin:
MIN_MARGIN = 0.10 # minimum gross marginMAX_DISCOUNT = 0.15 # maximum single discount ratedef quote_price(sku_cost, list_price, discount_rate):if not 0 <= discount_rate <= MAX_DISCOUNT:raise ValueError("Discount exceeds policy limit; manual approval required")price = list_price * (1 - discount_rate)margin = (price - sku_cost) / priceif margin < MIN_MARGIN:raise ValueError(f"Gross margin {margin:.1%} is below the lower bound {MIN_MARGIN:.0%}")return round(price, 2)
The key point is that hard limits are written in code, while flexible judgment is left to the model. Regardless of the rationale the model provides, a below-cost quote cannot pass validation. Refunds, gifts, and points issuance should use the same design.
5. Multi-Agent Division of Labor and Its Risks
Complex businesses usually require role separation. Common divisions include the following three types.
- Operations role: Handles customer inquiries, order status, and inventory lookup.
- Product development role: Designs merchandise based on demand and calls production or printing interfaces.
- Management role: Sets business objectives and approves exception requests.
The division itself is reasonable, but the experiment revealed a noteworthy problem. The management role appeared to continuously tighten discounts while approving a large number of exception requests, and refunds and points issuance actually increased. This indicates that the management role’s supervision metrics were disconnected from real returns. If the system only counts “how many requests were rejected,” supervision may look strict while being ineffective in practice.
The following measures can address this problem.
- Metric alignment: Supervision metrics should include gross margin, refund rate, points cost, and customer complaint rate, not just approval counts.
- Permission isolation: The management role should not have permission to modify cost data or bypass pricing rules.
- Audit logs: Every approval records the request content, rationale, and result for later review.
- Threshold tiers: Small exceptions are handled automatically by rules, while large exceptions require human confirmation.
6. State Management for Long-Running Operations
The experiment also observed that agents drift away from business topics after long-running operation. This phenomenon is common in multi-agent systems, usually because context keeps accumulating and task boundaries are missing.
Response methods include:
- Set up an independent session for each task and clear context after the task ends;
- Limit free-form conversation between agents, and route all information exchange through structured messages;
- Set timeout and reset strategies for long-running sessions;
- Set alerts for abnormal conversation content, such as automatically logging and pausing when long outputs unrelated to the business appear.
7. Deployment Checklist
Before connecting agents to real transactions, confirm the following items one by one.
- Every write operation has hard upper limits, such as single discount rate, daily refund total, and gift quantity.
- Cost, inventory, and price use structured data as the sole authoritative source; the model can only read them and cannot modify them directly.
- High-risk operations such as refunds, large discounts, and data deletion must require human confirmation.
- Monitoring covers revenue, gross margin, refund rate, and customer complaints to avoid misleading judgment from a single metric.
- All decisions and tool calls have traceable logs.
- Run in a sandbox environment first, set funding limits, and expand permissions gradually.
- Regularly replay failure cases and add them to the regression test set.
8. Conclusion
The profitability of agent-run businesses comes mainly from engineering constraints and data quality, not from the single capability of a particular model. When introducing such systems, developers should first define permission boundaries, data sources, and supervision metrics, and then gradually open operational permissions. Constraints first is what allows agent autonomy to translate into controllable business value.
