Conversational Commerce Architecture: A Practical Guide to AI Agent E-Commerce Systems

    This article examines the technical shift in e-commerce as product catalogs are connected to conversational AI entry points, moving the focus from pages and search boxes toward intent understanding and tool invocation. It breaks down the conversational shopping pipeline into five key layers—session and intent understanding, product retrieval and recommendation, inventory and price consistency, order placement and payment authorization, and risk control and compliance—and presents a layered architecture, sample interface contracts, and engineering considerations for building an evolvable, observable, and auditable shopping system without depending on any single vendor.

    When retailers begin connecting product catalogs to conversational AI entry points, the technical focus of e-commerce systems shifts from “pages and search boxes” to “intent understanding and tool invocation.” This article takes a general technical perspective and breaks down the conversational shopping pipeline into five key layers: session and intent understanding, product retrieval and recommendation, inventory and price consistency, order placement and payment authorization, and risk control and compliance. It provides a practical layered architecture, sample interface contract code, and engineering considerations to help developers build an evolvable, observable, and auditable intelligent shopping system without over-relying on any single vendor’s capabilities.

    1. Technical Drivers Behind the Shift: From Retrieval to Expression

    For more than two decades, the interaction paradigm of e-commerce has revolved around “keyword search + category navigation + filtering and sorting.” Users first had to know what they wanted, then express it in a way the system could understand. Conversational entry points change this: users express vague needs, scenario constraints, and preference weights—for example, “headphones under 3,000, suitable for commuting, lightweight”—and the system must complete requirement filling, condition decomposition, and result convergence on its own.

    This leads to three direct technical consequences.

    First, the input distribution of the semantic space becomes extremely long-tailed. Traditional search queries are relatively well-formed, while natural language descriptions contain implicit constraints, negation conditions, comparison relationships, and priorities. Traditional inverted-index retrieval plus weighted ranking can no longer handle this independently.

    Second, the transaction pipeline is compressed into the same session context. Browsing, comparison, decision-making, and payment were originally spread across multiple pages; now they must maintain state consistency within the same context, which raises higher requirements for session state management and idempotency design.

    Third, system boundaries expand from “internal services” to “externally callable capabilities.” To complete a real order, the agent must invoke capabilities such as inventory, pricing, promotions, payment, and fulfillment. The security and auditability of tool invocation become first-class concerns.

    2. Reference Architecture: Five Layers and Responsibility Boundaries

    A conversational shopping system that can evolve sustainably should be split into five layers by responsibility, with clear contracts communicating between layers to avoid coupling prompt logic with transaction logic.

    1. Session and intent layer: responsible for multi-turn context management, slot filling, clarification follow-ups, intent classification, and confidence evaluation.
    2. Knowledge and product understanding layer: responsible for product knowledge structuring, including attribute standardization, category system alignment, vectorization, and tag system construction.
    3. Retrieval and decision layer: responsible for recall, coarse ranking, fine ranking, and reranking, with “explainable reasons” as part of the output.
    4. Transaction execution layer: responsible for order placement, payment authorization, fulfillment, and after-sales, all implemented with idempotent interfaces and state machines.
    5. Risk control and compliance layer: spanning the entire pipeline, responsible for identity verification, abnormal behavior detection, price and inventory consistency checks, and audit trails.

    The inter-layer contract should follow a three-part “intent—evidence—action” structure: the intent describes the user’s goal, the evidence is citable product and policy references, and the action is an executable transaction instruction. This way, when disputes arise, the system can trace back to specific evidence rather than keeping only a natural language conversation.

    3. Intent Understanding and Slot Design: Turning Vague Needs into Computable Constraints

    The difficulty of the intent layer lies not in recognizing that “the user wants to buy something,” but in converting natural language into structured query conditions and identifying missing items. In practice, it is recommended to adopt three types of modeling: “explicit slots + implicit preferences + hard constraints.”

    1. {
    2. "intent": "purchase_candidate_search",
    3. "hard_constraints": [
    4. {"slot": "price_max", "value": 3000, "currency": "CNY"},
    5. {"slot": "category", "value": "audio/headphone"}
    6. ],
    7. "soft_preferences": [
    8. {"slot": "weight", "op": "<=", "value": 300, "weight": 0.4},
    9. {"slot": "usage_scene", "value": "commute", "weight": 0.6}
    10. ],
    11. "negations": ["over_ear"],
    12. "missing_slots": ["battery_life"],
    13. "confidence": 0.72
    14. }

    Three points are worth emphasizing in engineering. First, hard constraints must be verifiable; price, inventory, and regional availability are hard constraints and cannot be left to the model’s discretion. Second, when confidence falls below a threshold, the system should proactively seek clarification rather than guessing and proceeding directly to order placement, and clarification prompts should ask only the single most critical slot at a time. Third, negation conditions and comparison relationships must be modeled separately; otherwise expressions like “not over-ear” or “lighter than the previous model” are easily ignored.

    4. Product Knowledge Structuring and Retrieval: Making Results Explainable and Reproducible

    Conversational shopping demands “explainability” from retrieval. When a user asks why a particular item was recommended, the system must provide structured reasons rather than repeating marketing copy. To this end, product data must undergo attribute standardization and category alignment, mapping merchant-defined attributes to a unified model, while establishing dual-channel recall with both vector indexes and structured indexes.

    1. def retrieve(query_slots, top_k=50):
    2. # Structured channel: hard-constraint filtering to prevent out-of-bounds results
    3. candidates = catalog.filter(
    4. price_lte=query_slots["price_max"],
    5. category=query_slots["category"],
    6. stock_gt=0
    7. )
    8. # Vector channel: semantic recall of soft preferences
    9. semantic = vector_index.search(
    10. embed(query_slots["text"]), top_k=top_k
    11. )
    12. merged = merge_dedup(candidates, semantic)
    13. # Rerank: fuse preference weights with explainable scores
    14. return rerank(merged, query_slots["soft_preferences"])

    It is important to note that any approach where the “model directly generates products and prices” is unacceptable. Product identifiers, prices, and inventory must be based on what the business system returns; the model is only responsible for organizing expression and explaining reasons. This is both an accuracy requirement and a compliance requirement.

    5. Transaction Execution: Idempotency, State Machines, and Payment Authorization

    The core of the transaction layer is not “being able to place an order,” but “remaining correct under retries and concurrency.” It is recommended that all write operations be driven by idempotency keys generated jointly from the session identifier and an action fingerprint, with the server returning the same result for duplicate requests.

    1. POST /order/create
    2. Idempotency-Key: {session_id}:{action_fingerprint}
    3. {
    4. "items": [{"sku": "...", "qty": 1}],
    5. "price_snapshot_id": "ps_20260101_8f3",
    6. "consent": {"payment_auth": true, "scope": "single_order"}
    7. }

    The price snapshot is used to lock the price the user saw at confirmation, preventing changes between confirmation and payment; the authorization scope should be limited to a single order, with no open-ended recurring deductions. The state machine should clearly define “created—pending payment—paid—fulfilling—completed/cancelled,” and every transition should be written to an audit log, including whether the trigger source was user confirmation or system compensation.

    6. Risk Control and Compliance: Making Auditability a Default Capability

    Conversational entry points amplify two types of risk: prompt injection leading to unauthorized tool invocation, and sessions being induced into unintended transactions. Feasible defenses include tool invocation whitelists with least privilege, per-order and daily quota limits, abnormal frequency detection, secondary confirmation for critical actions, and full-pipeline traceability. All externally exposed capabilities should undergo unified authentication through a gateway, and agents are prohibited from directly holding high-privilege credentials.

    7. General Cloud Capability Support from Baidu AI Cloud

    At the implementation level, such systems typically rely on several general cloud capabilities: a container platform to host elastic inference and business services, a message queue to smooth peaks and decouple transaction events, object storage to store product snapshots and audit files, logging and monitoring services with alerting for full-pipeline observability, and key management for credential hosting. Baidu AI Cloud provides capabilities in these general categories that can serve as infrastructure options for building such an architecture; specific specifications and pricing are subject to the official documentation.

    8. Evolution Roadmap and Common Pitfalls

    It is recommended to proceed in three phases: first build a “guided shopping” version that only outputs recommendations and explanations without touching transactions; then add “assisted ordering,” where transaction interfaces are invoked only after explicit user confirmation; and finally open up higher levels of automation, supported by quota and rollback mechanisms.

    There are three common pitfalls: treating prompts as business logic, making them impossible to test and roll back; pursuing end-to-end automation while neglecting clarification mechanisms, which actually reduces conversion; and focusing only on model performance without building product data governance, ultimately leaving both explainability and accuracy unguaranteed. The competitive barrier of conversational shopping ultimately rests on the rigor of data governance and transaction engineering, not on isolated model capabilities.