Get startedGet started for free

Grounding agents in knowledge sources

1. Grounding agents in knowledge sources

Last lesson, your flow looked up one value from the company directory. But many questions sound like "what does our policy actually say?", and to answer those, an agent needs a document to read from. Giving it one is called grounding.

2. Why grounding matters

Left to itself, a language model answers from its general training. That's fine for casual chat, but risky for your travel policy or benefits handbook, where a wrong answer can mislead an employee. Grounding ties the agent's replies to source material you trust: it reads your document and answers from that, which makes it your best guard against made-up answers.

3. Open the Knowledge tab

Let's give an agent a source to lean on. Open your agent and go to the Knowledge tab.

4. Add a knowledge source

Click Add knowledge, choose to upload a file, and pick your document, here the policy handbook. New agents also search public websites, so switch Web Search off on the Overview tab, or a web page can slip into an answer that claims to come from your document.

5. Let it finish processing

After you add the file, Copilot Studio reads and indexes it so it can look things up later, which takes 5 to 10 minutes. If you test too early, the agent says it can't find the answer, and that just means indexing hasn't finished.

6. Scope your prompt to the source

Adding the source isn't quite enough on its own. You also want the agent to stay inside it, so you use a scoped prompt. Instead of just asking "how many vacation days do new hires get," you put "using only the policy handbook" in front. That phrase steers the agent toward the source instead of its general knowledge.

7. Test it

Now open the Test panel and try it. Ask your scoped question the way an employee would, and watch the reply.

8. Read a grounded answer

A well-grounded answer looks different from a generic one. It pulls its wording from your document, and a reference points back to the file, which the activity map also lists under referenced sources. That citation shows the agent found the answer in your file instead of making it up. Click through once or twice while you build to confirm it matches the source.

9. When the source doesn't have it

Notice what a grounded agent does when the document doesn't cover the question: it tells you it doesn't know, instead of guessing. An agent that says "the handbook doesn't mention that" is more trustworthy than one that invents a number, and seeing that reply is a good sign your grounding is working. Replies vary from run to run, though, so try a couple of questions before you rely on it.

10. Let's practice!

Let's attach a knowledge source, ask it a scoped question, and then ask one it can't answer to see how the agent copes.

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.