Leverage agentic RAG using MongoDB and Dataworkz to enhance customers’ shopping experiences with a personalized chatbot.
Use cases: Gen AI, Personalization
Industries: Retail
Products: MongoDB Atlas, MongoDB Atlas Vector Search
Solution Overview
With the rise of innovative technologies like generative AI and agents, retailers are adopting these solutions for various use cases. Examples include real-time customer assistance, personalized recommendations, and improved search functionality. These advancements are transforming the way brands connect with customers in meaningful ways.
Recent studies reveal that AI-powered chatbots boost online sales in the United States by nearly 4% year-over-year, reinforcing the idea that AI is not just a trend, but a lasting driver of growth in retail. RAG is a cutting-edge technology that can further revolutionize the retail space. Building on this idea, this article presents a solution that uses MongoDB and Dataworkz to unify operational and unstructured data, resulting in better customer experiences.
What Is an Agent?
An agent is an artificial computational entity with an awareness of its environment and associated data within the context. These agents can interact in the case of ecommerce or perform a portion of complex tasks as needed.
Retrieval-Augmented Generation
RAG is an approach that augments LLMs with proprietary data so that they can generate more accurate and context-aware responses while also reducing hallucinations.
Figure 1. Conventional RAG
Agentic RAG
Agentic RAG introduces an AI agent-based implementation of RAG. In this model, the agent can access different tools and functions, enabling it to go beyond information retrieval and generation—it allows it to plan. Agents can determine if they need to retrieve specific information or not, decide which tool to use for the retrieval, and formulate queries. These capabilities are crucial as it enables the agent to pull information from multiple data sources, and to handle complex queries that require more than one source to formulate the response. Agentic RAG can enhance customer interactions and streamline processes across industries.
Figure 2. Agentic RAG
For more details see Dataworkz Agentic RAG.
Figure 3. Conventional vs agentic RAG comparison
Impact on the Retail Industry
The retail industry quickly adopted generative AI. In 2024, one quarter of consumers used AI in their shopping experience, representing a 4% increase over the previous year.
Some generative AI use cases across retail include:
Customer-support chatbots: Gen AI-powered chatbots that provide real-time assistance and are context-aware of business policies, user history, and preferences.
Personalized product recommendations: Customer recommendations based on their specific likes, needs, and past orders. These personalized recommendations make shopping more enjoyable for customers and increase the chances of a successful purchase.
Dynamic marketing content: Gen AI applications can generate personalized promotions, emails, and messages for each customer, boosting engagement, sales, and retention.
Reference Architectures
Introducing Dataworkz
Dataworkz is a RAG-as-a-service platform that transforms how organizations build and deploy AI applications. Its agent-based architecture and graph-optimized retrieval help large enterprises to launch sophisticated RAG applications in hours instead of months.
The platform eliminates the need for specialized AI teams through an intuitive no-code builder that automatically implements best practices in RAG development. Unlike traditional approaches that lock you into early architectural decisions, Dataworkz enables rapid experimentation—you can test different retrieval strategies, prompt variations, and model combinations in a controlled environment before committing to production.
Dataworkz delivers production-ready RAG applications without the traditional overhead of building and maintaining complex AI infrastructure.
This architecture consists of the following key components:
Graph-optimized knowledge retrieval for complex relationships.
Agent-based architecture for sophisticated reasoning.
No-code builder with built-in best practices.
Full lifecycle support from experimentation to production.
BYO flexibility—LLM, embedding model, and vector database.
Enterprise-grade security and scalability.
Leveraging MongoDB with Dataworkz
Dataworkz streamlines the process of creating RAG pipelines by providing a friendly experience to extract unstructured data, configure a chunking strategy, and create vector embeddings. Dataworkz RAG builder also allows developers to choose different retrieval mechanisms—lexical, semantic, or graph, with different thresholds to build the context for answering a user question.
The integration also enables real-time data processing and analytics, ensuring AI models use the most current data for accurate and relevant responses.
Agentic RAG Architecture
To build transformational results, conventional RAG systems, which primarily utilize vector search techniques, must integrate with up-to-date information from operational databases.
MongoDB Atlas Vector Search provides built-in support for vector embeddings, which eliminates the need for a separate vector database, simplifying the architecture and reducing complexity.
With Dataworkz agents, retailers can offer controlled access to MongoDB collections by configuring them as tools. In many cases, customers have an API layer that abstracts the underlying collections. Dataworkz can integrate with REST API or GraphQL.
Additionally, any RAG pipeline configured in Dataworkz can be a tool to an agent. This capability gives agents the ability to understand unstructured data in a SharePoint site, a confluence wiki page, or markdown depending on the user’s question.
Existing retailers with applications that leverage MongoDB as their data platform can benefit from Dataworkz’s close integration with MongoDB and their AI adoption can incorporate agentic RAG into their solutions.
Dataworkz agents can access multiple data sources and use reasoning LLMs to decide which tool to use to answer a user’s question. An agent can access and switch between different MongoDB collections or databases to retrieve structured data like shipping status, customer profiles, preferences, and order histories. Additionally, third party solutions like ERP (Epicor), and CRM (Salesforce) can integrate through APIs exposed via the providers. Together, these tools enable the agent to understand user questions in context and provide personalized, relevant responses.
The following steps explain how a Dataworkz agent works:
The Dataworkz agent framework organizes use cases into scenarios, such as answering questions about store policies, searching an order, or providing customer support.
The agent uses a reasoning LLM to plan how to answer a question based on the user's query, conversation context, memory, and available tools, such as access to MongoDB collections. The LLM determines a sequence of steps to gather the necessary information. This process is iterative; after each step, the agent checks if it has enough context to provide an answer or if further retrieval and planning are needed.
Finally, the agent uses the gathered context to generate a response, take action, or ask the user a clarifying question if needed.
Figure 4. Dataworkz and MongoDB agentic RAG architecture
Build the Solution
See the README in the GitHub repository for full
implementation details. The following steps explains how to create the application:
Replicate the demo database
You can either use a publicly hosted, pre-populated cluster or provision your own cluster within your Atlas account and populate your database with the required data for the demo. If you choose to bring your own MongoDB, find a data dump inside the repository to quickly replicate the database with all the necessary data and metadata with one quick mongorestore command.
Create Dataworkz RAG application
Sign up to Dataworkz and create a RAG app for the e-commerce policies. You can use the PDF inside the repository to use as the e-commerce policy document. You can use this unstructured data as a tool for the Dataworkz agent.
Create the Dataworkz agent
Connect to your MongoDB cluster from the previous step. Use this guide to configure Dataworkz for MongoDB access.
Configure your application frontend
For complete implementation details, including code samples, configuration files, and tutorial videos, visit the GitHub repository.
Key Learnings
Understand agentic RAG: Agents broaden the possibilities of what can be done with the conventional RAG architecture. Adding a layer of decision-making enables agents to plan, take action and utilize their tools to improve context awareness and operational efficiency.
Integrate different technologies: By combining the strengths of MongoDB and Dataworkz, you can create personalized experiences, deliver real-time assistance, streamline development processes and build distinctive features for your applications.
Create the future of retail with AI: Use a RAG architecture to provide customers with personalized content and context-aware support throughout their shopping experience.
Prototype and iterate quickly: Agentic RAG relies on fast prototyping and iterative validation. Choose a platform that lets you quickly configure components, assess their impact, and securely deploy to production.
Authors
Angie Guemes, MongoDB
Sachin Hejip, Engineering at Dataworkz