Sub topic 13
Letting an agent answer from knowledge
This chapter assumes you have a search index and retriever, or a Data Library, over your Knowledge content. It also assumes you know what an agent topic and an action are.
How the knowledge action works
An agent does not search your content on its own. You add a knowledge action to a topic. When a customer's question matches that topic, the agent's reasoning step decides to call the action. The action runs a search against your Data Library or retriever and passes the matching excerpts back to the agent. The agent then writes its reply from those excerpts.
In Agentforce, the standard action for this is Answer Questions with Knowledge. It uses the Data Library you configured earlier. You can also build a custom action around a prompt template that is grounded with a retriever, as in the previous chapter.
Wiring it up
- Open the agent in Agentforce Builder and choose a topic, such as one for product questions.
- Add the knowledge action to the topic's actions.
- Select the Data Library (or retriever-backed prompt template) the action should search.
- Write topic instructions that tie the reply to the action's output.
- Test in the builder's preview, then activate the agent.
Instructions that use the action
The topic instruction should name the action's job and say what to do when nothing comes back. Here is a sample:
When a customer asks a product or policy question, use the knowledge action to look up the answer.
Base your reply only on the returned articles.
If no relevant article is returned, do not guess. Tell the customer you do not have that information and offer escalation.The next chapter covers writing these instructions in more detail. For now, notice the three parts. The first says when to call the action. The second limits the source of the answer. The third defines the fallback.
Common errors
| Symptom | Likely cause |
|---|---|
| The agent answers without calling the action | The topic's description or instructions do not match the question, so the topic or action is never selected. |
| The agent answers from general knowledge | The instructions do not restrict the reply to the returned articles, and they define no fallback. |
| The action returns nothing | The index is missing the article, a retriever filter excludes it, or the article is not published. |
| Results differ between you and a customer | The running user's access differs from yours. Check sharing and the permissions on the Data Library. |
| Edits do not appear in live conversations | The agent was not re-activated after a change. |
Exercise
A customer asks about your refund policy. The agent gives a fluent answer, but the preview trace shows the knowledge action never ran. Give two things to check.
Show answer
Check that the topic's description and instructions match refund questions, so the agent selects the topic. Then check that the knowledge action is added to that topic and that the instructions tell the agent to use it. A missing fallback instruction also lets the model answer from general knowledge.