How to configure Agentforce to search your Salesforce Knowledge base.
Agentforce

How to configure Agentforce to search your Salesforce Knowledge base.


***UPDATE January 17, 2025***: After I posted my original article last week, I received lots of great comments from folks who've been working on similar agents. The biggest piece of feedback that I received was "I built an agent that queries unstructured data (text, rich text, PDF) just like your agent, but I took a slightly different approach". Here are the approaches that folks shared:


Approach 1: Standard Action using Knowledge

  • Action: "Answer Questions with Knowledge" standard action
  • Data Source: Einstein Data Library using Knowledge.

My original article (below) explains the configuration steps for this approach.


Approach 2: Standard Action using File Upload

  • Action: "Answer Questions with Knowledge" standard action
  • Data: Einstein Data Library using File Upload


Approach 3: Custom Action using Prompt Builder + Knowledge

  • Action: Custom Action + Prompt Builder (Prompt Template Type = "Knowledge Answers", Prompt Template instructions references Resources --> Einstein Search)
  • Data: Einstein Data Library using Knowledge.


Note: S3 Integration: I also received a question asking if I had tried building a Prompt Template grounded in PDF files brought into Data Cloud via the Amazon S3 integration. I haven't tried that approach yet but may try it soon and post an update here. If you've built out that scenario (or any other scenarios you'd like to share), I'd love to hear your experience with it.


Below is the original article which describes how to configure Approach 1: Standard Action using Knowledge).



Configuration Steps for using the Standard Agent Action: "Answer Questions With Knowledge"


Salesforce Service Cloud has a well-established feature called Knowledge that enables companies to create/manage help articles in their Salesforce org. These articles can cover things like Frequently Asked Questions (FAQs), Product Documentation, and Customer Service Policies. Knowledge articles can be used by support teams to answer customer questions or can be public facing to enable customers to ind answers on their own.


Agentforce contains a standard action called Answer Questions With Knowledge that enables agents to query the Knowledge articles within your Salesforce org. In order to use this action, there are a few configuration steps that you'll need to complete. This article provides the steps to configure Agentforce to use Knowledge.


1. PREREQUISITES: Make Sure Required Features are Enabled

Confirm the following:

  • Agentforce is enabled
  • Data Cloud setup is complete (Setup > Data Cloud Setup > run setup process).
  • Knowledge is enabled


2. CREATE DATA LIBRARY

Once Data Cloud setup is complete, create Data Library (Setup > Einstein Data Libraries > create a data library). Set data source as Knowledge and select Knowledge fields you want data library to have access to. Note: when you create the Einstein Data Library, Salesforce will automatically generate relevant configurations in Data Cloud, including Data Source and Search Index records.

Important: in order to create an Einstein Data Library based on your Knowledge Base, you must have at least 10 knowledge articles in your Knowledge base.


3. CONFIGURE AGENT USER

Make sure there is a Salesforce user for your Agent. The agent user should have a profile with the Einstein Agent user license. Make sure agent user has the necessary perms:

  • Data Cloud user perm set
  • Agentforce perm sets
  • Make sure that the agent user has access to any other objects / fields that it needs to do its work.


4. CONFIGURE AGENT & TOPIC

4.1 Create Agent

Go to Setup > Agents, click "New Agent" and go through the setup Wizard. Pay careful attention to the following:

  • On screen 2, make sure the General FAQ topic is added to the agent. Note: if you miss this step during the Wizard, you can add a topic after the agent has been created (see step 4.2 "Add Topic To Agent" below).

General FAQ topic

  • Make sure you populate the "Agent User" field with the user that you configured above in step 3 "Configure Agent User".

add Agent User

  • On the last screen of the Wizard you will be able to add your Data Library to the Agent. You can also add your Data Library after the Agent has been created (see step 4.3 "Add Data Library" below).


4.2 Add Topic to Agent:

If you didn't add the General FAQ topic during the New Agent setup process, you can add it later by doing the following:

Click "Open in Builder", add a Topic and add instructions.

  • Assign standard “Answer Questions with Knowledge” action to the Topic.

Add "Answer Questions with Knowledge" action to your Topic


4.3 Add Data Library to Agent:

If you didn't add the a Data Library during the New Agent setup process, you can add it later by doing the following:

In the Agent Builder, click the Data Library icon in the left hand menu. Assign the Data Library that you created above to the Agent.

add Data Library to Agent


5. REFRESHING KNOWLEDGE BASE

As you create or update Knowledge articles, Agentforce will not immediately have access to the changes. In order for Agentforce to search the updated Knowledge base, the Data Cloud search index will need to be refresh. According to the documentation, this happens on a daily basis. If you'd like to manually refresh it more frequently, I have found that you can do the following:

  • Refresh Knowledge Data Steam in Data Cloud: go to Data Stream, find Knowledge_kav_home and click Refresh Now. The refresh will take a few minutes to run.
  • Refresh Knowledge Search Index in Data Cloud: when the Data Stream has completed refreshing, go to Search Index, find the Search index associated with the Einstein Data Library you created above and click Rebuild.?

Once the Search Index has completed refreshing, your agent should now be able to search the most updated Knowledge base. You can test by asking the agent questions that cover your new/updated Knowledge articles and confirming that the agent's responses reflect the most updated versions of the articles.


References:

I used approach 2, but the Search Index was not created when upload a file.

回复
Veena Sundara-heragu

Senior salesforce developer at OpFocus, Inc.

4 周

I used approach 1, but the agent is unable to get any answers. The response is always like this: { ?"knowledgeSummary": "Sorry, I can't find an answer based on the available articles." } The agent user has the following permission sets: Data Could User Agentforce Service Agent Object Access Service - Knowledge Access. Am I missing anything?

Ed Schlesinger

VP Global SI Services

2 个月

Thanks so much for this Brian. This is really informative and very helpful information.

Ben P Roberts

Troubleshooter | 7X Certified Salesforce Professional | Let's improve the process before we make it faster!

2 个月

Great info and concise. Very helpful.

要查看或添加评论,请登录

Brian Shea的更多文章

社区洞察

其他会员也浏览了