Sub topic 10
Answering questions from Knowledge
This chapter assumes you know how topics, instructions and actions fit together, and that you have added a standard action to a topic in Agentforce Builder. It also assumes you know what Salesforce Knowledge articles are, and that you understand permission sets and sharing at a basic level.
What the action does
The standard action Answer Questions with Knowledge lets an agent answer a user's question from your organization's approved content instead of from the model's general training. The agent takes the user's question and searches your knowledge sources for relevant passages. It then passes those passages to the large language model (LLM), which writes an answer based on them. This pattern is called retrieval-augmented generation (RAG).
The action is read-only. It does not change records, and it does not look up a specific record. If the user asks "what is the status of case 00001234?", use the record lookup actions. If the user asks "how do I reset my router?", use the Knowledge action.
The exact setup steps and labels depend on your release and on how the org's search index is configured. The concepts below stay the same, but check the current Salesforce documentation for the screens in your org.
How a question flows through the action
- The user asks a question in the conversation.
- The agent's reasoning step decides which topic applies. It then decides whether the topic's Knowledge action fits the request.
- The agent fills the action's input, usually the question text, from the conversation.
- The action searches the knowledge source and retrieves the best-matching passages.
- The LLM writes an answer grounded in those passages. This step runs through the Einstein Trust Layer.
- The agent returns the answer to the user, often with references to the source articles.
Where the content comes from
The action can only answer from content that has been indexed and made searchable. The common sources are:
- Salesforce Knowledge articles. These need Knowledge to be enabled, and the articles must be published.
- An Agentforce data library. This is a managed grouping of content that Salesforce indexes for retrieval. It can include uploaded files and, depending on your setup, Knowledge articles.
- Other indexed sources. Content brought in through Data Cloud connections can also be searched, if you have configured it.
The retrieval step is only as good as the index behind it. The usual causes of poor answers are articles that are not published, content that has not been indexed yet, or articles that are long and cover many unrelated topics.
Inputs and outputs
Like other standard actions, this one declares inputs and outputs that the agent works with.
| Item | Typical role | Notes |
|---|---|---|
| Query input | The user's question | The agent fills this by slot filling from the conversation. |
| Answer output | The generated text | Grounded in the retrieved passages. |
| Source or citation output | References to the articles used | Useful for showing where an answer came from. |
Input and output names can differ between releases, so open the action's details in Builder to see the exact ones in your org.
The input is the question as the agent phrases it, not necessarily the user's exact words. In a long conversation the agent may rewrite a short follow-up such as "and for the newer model?" into a fuller query. Weak rewriting is a common reason for off-target answers. You can steer it with instructions, as shown below.
Adding the action to a topic
- Open the agent in Agentforce Builder and select the topic that should answer questions, for example a "Product Help" topic.
- In the topic's action list, add Answer Questions with Knowledge from the standard actions.
- Review the action's name and description. The agent uses the description to decide when to call the action, so it should say what content the action covers.
- Write topic instructions that tell the agent when to use it and what to do when nothing relevant is found.
- Preview the agent and ask questions that your content should and should not answer.
The topic's classification description matters here too. If it is too broad, questions from other areas can land in this topic and get weak answers.
Writing instructions that make it reliable
Instructions control when the action is called and what happens after it returns. The following example is a starting point for a support topic.
Topic: Product Help
Classification description:
Answer how-to and troubleshooting questions about our products using approved help content.
Instructions:
1. For any how-to or troubleshooting question, use the Answer Questions with Knowledge action before answering. Do not answer from general knowledge.
2. Pass the user's question with the product name included, even if the user only gave the product name earlier in the conversation.
3. If the action returns no answer, tell the user you could not find it in the help content and offer to connect them with a human agent.
4. Do not combine information from the action with guesses. If the answer only partly covers the question, say what is missing.
5. If the question is about the status of a specific case or order, do not use this action. Look up the record instead.Each rule fixes a specific failure:
- Rule 1 stops the agent from answering from the LLM's general training and skipping the retrieval step.
- Rule 2 handles follow-up questions that lose context.
- Rules 3 and 4 set the behavior when retrieval comes back empty or partial, so the agent does not invent an answer.
- Rule 5 keeps record questions out of the Knowledge action.
Access and trust
The action runs on behalf of a user, so the answer is limited to content that user may see. Knowledge article visibility depends on data categories, channel settings (such as internal versus customer-facing), and the user's permissions. The agent's running user and the audience of the agent both affect what is returned. An agent used by customers should draw on articles that are meant for customers. Check this before you deploy, because an internal-only article returned to a customer is a data exposure problem, not a quality problem.
Requests to the LLM go through the Einstein Trust Layer, which applies protections such as masking of sensitive data and zero data retention agreements with model providers. These protections apply to the question and the retrieved passages in the same way as to other prompts.
Testing and debugging
Test with three kinds of questions:
- Questions your content answers directly. Check that the answer matches the article and that the source reference is correct.
- Questions your content does not cover. The agent should say it could not find an answer, not invent one.
- Follow-up questions. Ask one question, then ask a short follow-up that depends on it. Check that the query the agent sent includes the missing context.
In the Builder preview, inspect the action call for each turn. Look at the input the agent sent, the output returned, and the sources used. Use them to find where a problem starts:
| Symptom | Likely cause | What to check |
|---|---|---|
| Action never runs | Instructions or action description do not match the request | Topic classification, action description, instruction wording |
| Action runs with a poor query | Follow-up lost context | Add an instruction to include product and context in the query |
| Action runs, no useful answer | Content missing, unpublished, or not indexed | Article status, indexing, data library contents |
| Answer is correct but from the wrong audience | Visibility settings | Data categories, channel, running user permissions |
| Answer mixes in unsupported claims | Instructions allow general knowledge | Add a rule to answer only from action results |
Common pitfalls
- Treating the action as a search box for records. It returns knowledge content, not record data.
- Loading very long, multi-topic articles. Retrieval works better with focused articles that each cover one subject.
- Testing only with questions you already know the articles answer. Always include questions that should fail.
- Forgetting that content changes need re-indexing before the change shows up in answers.
Exercise
A user asks your agent, "How do I replace the filter on the Model 7 purifier?" The agent replies with a confident, detailed answer, but the preview shows the Knowledge action never ran. Name two likely causes in the topic setup, and the instruction you would add to fix the behavior.
Show answer
Likely causes: the topic's instructions do not tell the agent to use the Knowledge action for how-to questions, or the action's description is too vague for the agent to match it to the request. The agent then answers from the model's general knowledge. Add an instruction such as "For any how-to or troubleshooting question, use the Answer Questions with Knowledge action before answering. Do not answer from general knowledge." Also improve the action description so it says what content it covers. Then preview again and confirm in the action inspection that the action ran.