Appearance
Exercise 2: Ground Agent with Einstein Search
In this exercise, you'll create a Flex Prompt template to enable users to ask questions about Coral Cloud Resorts' policies. You'll use Einstein Search to ground the prompt with unstructured data using retrieval augmented generation (RAG).
Step 1: Create the Flex template
Click the back arrow button to go back to Setup.
In Setup, search for Prompt Builder, and select Prompt Builder.
Click the New Prompt Template button.
Configure the template as follows:
Parameter Value Prompt Template Type Flex Prompt Template Name Policy Questions API Name Keep default Template Description Answer customer questions about Coral Cloud Resorts' policies. Resource Name Question API Name myQuestiion Object Free Text Use the screenshot below to make sure that you entered the values correctly.
Click Next.
Paste the following text in the Prompt Template Workspace:
txtYour task is to provide clear and helpful answers to customer inquiries about Coral Cloud Resorts' policies. Here's the customer's question: QUESTION_QUERY Please use the following information to help you answer the question: SEARCH_RESULTS Remember to tailor your response to the specific question, focusing on the relevant details. Your tone should be friendly and informative, as if you were speaking directly to the customer.
Replace the placeholders with the corresponding merge fields (click the Resource search box to access merge fields):
Placeholder Merge field QUESTION_QUERY Free Text > Question SEARCH_RESULTS Einstein Search > RagFileUDMO > File_Customer_Service_Agent_Library In the Configuration sidebar, configure the Default Resort Information Retriever as follows:
Field Value Search Text Free Text > Question Output Fields Chunk Number of Results 6 Use the screenshot below to make sure that you entered the values correctly.
In the Preview panel, click Test Inputs.
Enter the following text into the
Question
field:txtWhat is the resort's cancellation policy?
Click Preview.
- In the Resolution panel, examine the prompt that was generated. The JSON structure represents the weighted responses from Einstein Search.
- In the Response panel, examine the response the LLM generated.
Enter another prompt in the
Input
field:txtWhat wedding venue options are available at Coral Cloud Resorts?
Click Preview.
Click Activate.
This prompt template can now be used from Apex, Flow, or within an agent.
Step 2: Create a new Agent Action
Click the back arrow button to go back to Setup.
From Setup, open Agentforce Agents (under Agent Studio).
Click on the Customer Service Agent in the list of agents.
Click Open in Builder.
In Agentforce Builder, select the Genral FAQ topic.
To edit this topic, click New Version in the bottom of the topic panel.
Immediately click on Save to save the topic.
Open the new General FAQ topic.
Click on the This Topic's Actions tab in the topic details.
Click on the Menu button next to the Answer Questions with Knowledge Action and click Remove from Topic.
Click on the New drop down and click on Create New Action.
Configure the action:
Field Value Reference Action Type Prompt Template Reference Action Policy Questions Agent Action Label Keep default Agent Action API Name Keep default Click Next.
Enter the following loading text:
txtGetting information...
Enter the following Instructions for the the Question Input:
txtThe question is open-ended text input from a user in a chat, related to resort policies.
For the Prompt Response Output, check Show in conversation.
Use the screenshot below to make sure that you entered the values correctly.
Click Finish.
Step 3: Test your Agentforce Employee Agent
You are now inside Agentforce Builder. Click Got it to confirm that you would like to test out Agentforce.
Enter the following prompt in the Einstein sidebar:
txtHow do I request late check out?
Examine the plan in the middle of the screen, to perform this task, the reasoning engine selected the General FAQ Topic and the Policy Questions Action.
Click Activate to make the agent available.
If the agent is not able to find the knowledge
Click the back arrow button to go back to Setup.
TIP
If you are asked to confirm that you would like to go back, please click ok and continue.
In the App Launcher, select the Data Cloud app.
Open the Search Indexes Tab, you may have to select the More dropdown to view overflow tabs.
You should see the FileUDMO_SI Search Index. Click the arrow down icon to the right of the Contact data stream row, and select Rebuild.
Step 6: Create an Employee Agent Permission Set
In the Setup Quick Find, search for and select Permission Sets.
Click on New.
Set field values as follows:
Field Value Label Customer Service Agent Access
API Name Keep Default Description This permission set grants access to us the Customer Service Agent.
License Keep default: None
Click on Save.
Under Apps, click on Agent Access.
Click on Edit.
Add Customer Service Agent to Enabled Agents.
Click on Save.
Click on Manage Assignments.
Click on Add Assignments.
Check the box next to Admin User.
Click on Save.
Click on Done.
Step 7: Access the Agent in Salesforce
In the App Launcher, select the Coral Cloud app.
Click on the Einstein Icon in the upper right corner of the screen to open the Einstein sidebar.
Enter the following prompt in the Einstein sidebar:
txtHow do I request late check out?
The Customer Service Agent is now available to any users that have been granted access via Permission Sets or Profiles.
Summary
- Turned on Einstein and the Agentforce feature in Setup.
- Created a Customer Service Agent from the Agentforce Employee Agent template.
- Built and assigned a Data Library loaded with RAG-enabled PDFs.
- Tested the agent’s retrieval-augmented responses and, when needed, rebuilt the search index in Data Cloud.
- Defined and assigned a Permission Set to grant users access to the agent.
- Launched the agent via the Einstein sidebar in the Coral Cloud app.
Next, you’ll learn how to unlock deeper capabilities by adding Standard Actions— in the following exercise.