跪拜 Guibai
← All articles
Backend

Meet the AI Shopping Agent That Can Recommend, Compare, and Place Orders

By 苏三说技术 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

The target audience is developers who want a resume-ready AI+e-commerce project. The design—two-layer semantic routing, RAG grounding, MCP-based data access, and human-in-the-loop transaction flows—shows a realistic pattern for going from chat to order execution, but the code and tutorial are sold through the Java Assault Team course.

Summary

Built on Spring Boot 3.5 and Spring AI Alibaba, this conversational shopping agent uses a two-layer embedding semantic router to classify user intents into process, tool, recommendation, or small talk before entering a Graph workflow. RAG over Milvus or PgVector grounds answers with private product knowledge, while Function Calling and MCP connect to live inventory, pricing, and order services. The agent completes a full transaction loop: placing orders, cancelling, returning, and reviewing, each guarded by human-in-the-loop confirmation and rendered as UI snapshot cards via SSE streaming.

The design splits static knowledge from dynamic operations: RAG handles product specs and policies, tool calls fetch real-time stock and prices and trigger backend actions. An MCP client standardizes connections to product and order centers, so adding a new data source does not require rewriting the agent. The project is positioned as a resume builder; full source code, a from-zero tutorial, 1-on-1 Q&A, and interview coaching are delivered through the Java Assault Team site (susan.net.cn/project).

Takeaways
— The agent uses a two-layer embedding router to classify intents into process, tool, recommendation, and small talk before entering a Graph workflow.
— RAG retrieves product knowledge from Milvus or PgVector using embeddings from `text-embedding-3-small` or `bge-m3`.
— Function Calling exposes Java beans with `@Tool` for real-time stock checks, price comparisons, order creation, cancellation, returns, and reviews.
— MCP client standardizes connections to product and order centers via JSON-RPC, allowing new data sources without agent code changes.
— Transaction flows include human-in-the-loop (HITL) confirmations: order preview cards and explicit user confirmation before execution.
— The frontend receives UI component JSON via SSE streaming to render order, cart, and confirmation cards.
— The stack uses Spring Boot 3.5+, Spring AI Alibaba, Qwen/DeepSeek-V3, Vue 3 + TailwindCSS.
— Data ingestion uses binlog monitoring and ETL to split product details into chunks, vectorize, and upsert with metadata for hybrid retrieval.
— Complete source code, a from-zero tutorial, 1-on-1 technical Q&A, and resume coaching are offered via susan.net.cn/project.
Conclusions

The two-layer semantic routing is a pragmatic control: pre-classifying intents before the LLM reduces the risk that natural language ambiguity derails a transaction workflow, something many agent frameworks leave entirely to the model.

Dividing static knowledge (RAG for specs and policies) from dynamic state (Function Calling for stock and prices) avoids the common mistake of putting real-time data into embeddings that go stale.

The heavy reliance on HITL for transaction actions—order previews, cancellation confirmations—shows a realistic safety pattern for deploying agents in commerce where financial operations need human authorization.

Concepts & terms
RAG (Retrieval-Augmented Generation)
A technique that retrieves relevant document chunks from a vector database and injects them into the LLM prompt to ground answers with private or up-to-date knowledge.
Function Calling
Lets an LLM invoke external tools or APIs by emitting structured calls; the framework executes the function and feeds the result back to the model.
MCP (Model Context Protocol)
An open protocol that standardizes how AI agents connect to data sources and tools via JSON-RPC, enabling plug-and-play integration without rewriting agent logic.
Graph workflow
A state machine or directed graph where each node represents a processing step (e.g., intent classification, slot filling, tool call), allowing controlled progression through business flows.
Human-in-the-Loop (HITL)
A pattern where a human approves critical actions (like order placement) before the AI executes them, preventing costly or irreversible mistakes.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗