RAG in Salesforce | Live Implementation with Agentforce | Learn RAG (Retrieval-Augmented Generation) : [email protected] (Kapil)

RAG in Salesforce | Live Implementation with Agentforce | Learn RAG (Retrieval-Augmented Generation)
by: [email protected] (Kapil)
blow post content copied from  Salesforce Bolt
click here to view original post



### Summary In this session, the focus is on enhancing data from Salesforce Data Cloud using AI-powered contextual reasoning, specifically through a method called Retrieval-Augmented Generation (RAG). This technique allows businesses, like the newly merged Rideswift Adventure, to efficiently retrieve relevant information from internal company policy documents stored in PDFs. **Key Points:** 1. **Objective**: Create a Policy Assistant in Salesforce to provide direct answers to employee and customer questions regarding vehicle insurance and booking policies, which are currently scattered across multiple PDFs. 2. **What is RAG?**: This method helps AI generate accurate responses by retrieving information from internal documents instead of guessing. It can operate with Salesforce Data Cloud for structured data or Agentforce Data Library for unstructured PDFs. 3. **Process of RAG**: - **Text Extraction**: Salesforce reads policy PDFs. - **Chunking**: Break down large texts into smaller, manageable pieces. - **Embedding & Indexing**: Convert these chunks into numerical vectors. - **Semantic Retrieval**: Match user queries with relevant text chunks. - **Grounded Response**: Generate answers based on retrieved data, ensuring accuracy. 4. **Setting Up**: Users can create a Policy Assistant agent linked to the Data Library, customizing it to provide factual answers with citations. Alternatively, a Prompt Template can be established for more controlled responses across multiple agents. 5. **Testing**: The agent can be tested with various questions about company policies, ensuring it returns precise, cited answers. **Conclusion**: RAG effectively integrates real-world context into Salesforce AI, making it easier for organizations to access and understand their internal information. This method allows companies to build scalable and reliable intelligent assistants. ### Additional Context RAG is particularly useful in scenarios where employees and customers frequently seek quick answers to standardized questions. By integrating this technology within Salesforce, companies can significantly enhance their customer service and internal communications. ### Hashtags for SEO #Salesforce #AI #DataCloud #RetrievalAugmentedGeneration #CustomerSupport #PolicyAssistant #BusinessIntelligence #SalesforceAgentforce #DigitalTransformation #EnterpriseAI



Introduction

After unifying data using Salesforce Data Cloud in earlier videos, I wanted to take the next step: bringing that data to life with AI-powered contextual reasoning.

In this session, I implemented Retrieval-Augmented Generation (RAG) in Salesforce Agentforce, showing how it can help teams quickly find relevant information from internal documents in this case, company policy PDFs from Adventure Cloud.


We’ll look at two approaches:

  1. Using a dedicated Agent connected to a Data Library
  2. Using a Prompt Template for reusable, controlled responses


Scenario Overview

Our story continues with Right Swift Rental and Adventure Cloud, two companies that merged into Rideswift Adventure.

After integration, their policies for vehicle insurance, personal insurance, booking, and safety were scattered across multiple PDF documents.


Employees and customers struggled to find simple answers like:

  • “What’s covered under vehicle insurance?”
  • “Can I cancel my adventure booking?”


The goal was to build a Policy Assistant in Salesforce that could read and respond directly from these documents using RAG.

What is RAG?

Retrieval-Augmented Generation allows AI models to generate grounded, accurate responses by retrieving data from a company’s own documents or systems.

Rather than “guessing,” the model retrieves and reads relevant sections from your internal data - PDFs, Knowledge Articles, or Data Cloud objects and generates an answer that’s factual and verifiable.


You can use RAG within Salesforce with or without Data Cloud.

  • With Data Cloud → connect to external systems or structured data.
  • Without Data Cloud → rely on Agentforce Data Library for unstructured data like PDFs.


How RAG Works Behind the Scenes

When a user asks a question, the process follows these steps:

  • Text Extraction - Salesforce reads text from the uploaded policy PDFs.
  • Chunking - Large text is split into small, meaningful pieces (500–1000 tokens).
  • Embedding & Indexing - Each chunk is converted into a numerical vector and stored in a managed vector index.
  • Semantic Retrieval - When a query comes in, Salesforce converts it into a vector and retrieves the most similar chunks.
  • Grounded Response - The retrieved text is added to the prompt, and the LLM generates an answer based only on that context.


This ensures every response is accurate, explainable, and free from hallucinations.


Setting Up the Policy Assistant Agent

Enable Einstein 1 and Agentforce

  • Verify access to Agentforce Studio and Data Library

Create a Data Library

Upload PDFs

Create a New Agent

  • Name: Policy Assistant Agent
  • Role: Helps users understand company policies including insurance, booking, and safety.
  • Link the Adventure Cloud Policies Data Library as its knowledge source.

Customize the Agent Prompt

  • You are Adventure Cloud’s official Policy Assistant.
  • Answer user questions based only on the policy documents available in your Data Library.
  • Be factual, professional, and always cite the policy section or document name.

Test the Agent by Asking

  • “What damages are covered under vehicle insurance?”
  • “Does personal insurance cover medical emergencies during treks?”


✅ The agent returned grounded, precise answers with clear citations.


Alternative Approach - Using Prompt Templates

For teams that need reusable prompts or want tighter control across multiple Agents, Salesforce Prompt Builder is a great alternative.


Steps

Create a New Data Library

  • Upload the same PDFs

Create a Prompt Template in Prompt Builder

  • Name: Company Policy Prompt
  • Input Variables: user_query, retrieved_context
  • Prompt Logic:You are a Salesforce policy assistant. Use the retrieved context to answer user questions accurately. If information is not found, respond: “The requested policy detail is not available in the current documents.”
  • Always cite the source document title.

Integrate with Agentforce Default Agent

  • Create a Topic: Official Policy Assistant
  • Action: link to Company Policy Prompt template
  • Set tone, instructions, and goals directly in Topic settings.


Test the Integration

Questions like:

  • “What exclusions exist in vehicle insurance?”
  • “Does Adventure Cloud provide emergency support?”


Conclusion

RAG brings real-world context into Salesforce AI.

By connecting policy documents to an Agent or Prompt Template, organizations like Rideswift Adventure can instantly make internal information accessible and accurate without leaving Salesforce.

Whether you choose a simple Agent-based approach or an advanced Prompt Template setup, RAG provides a scalable, trustworthy foundation for intelligent assistants in your org.


Watch the complete video below

 If you have any question please leave a comment below.

If you would like to add something to this post please leave a comment below.
Share this blog with your friends if you find it helpful somehow !

Thanks

November 08, 2025 at 06:04PM
Click here for more details...

=============================
The original post is available in Salesforce Bolt by [email protected] (Kapil)
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Salesforce