DEV Community

Cover image for Teaching the Agent to Stop Guessing
consolata gicheru
consolata gicheru

Posted on AI-assisted

Teaching the Agent to Stop Guessing

First, what a week

Can we take a second for the week we just had? Microsoft 365 went down for the better part of a day, with Outlook, Teams, SharePoint, and Copilot all dark across the world, and a few days later Bell Canada said an "agentic" attacker had made off with enterprise customer data. Our tools going quiet, and AI agents turning up on the wrong side of a breach, all in one stretch.

One quick note, so we stay accurate. The two are not the same story. Microsoft said the outage was a network change gone wrong, not a cyberattack. The Bell breach was real, and the "agentic" part is the bit worth sitting with, because attackers are now pointing AI at the job of breaking in.

So no, there is no single magic version to be on. But it is a fair moment to check your own house. What can your agents actually reach? Do they have more access than they need? Would your team catch a convincing phishing message today? Least privilege is boring, and it is exactly the thing that saves you. And speaking of keeping an agent on a short leash, that is really what this week's post is about.

Where we left off

Last time we gave Harbor Supply Co. a working chat agent, the Harbor Help agent, running on Claude inside Copilot Studio. It could hold a conversation, follow the instructions we wrote, and stay in character as a helpful support rep.

But it had one quiet problem. It only knew what we typed into its instructions. Ask it anything outside that, like the real returns window or whether a specific item ships to Mombasa, and it did not stop and say "I don't know." It guessed. And it guessed with total confidence.

That is the gap we close today. We are going to ground the agent in Harbor's actual policies, so its answers come from facts instead of vibes.

What grounding actually means

There is a lot of jargon around this, RAG, retrieval, vector search. You can ignore all of it for now. Here is the plain version.

Grounding means the agent looks something up before it answers, instead of answering from memory. You hand it a set of documents. When a question comes in, it searches those documents, finds the relevant bits, and writes its answer from what it found.

Think about a new hire on their first day. If you ask them the returns policy and they have memorised nothing, they will either make something up to sound helpful, or they will panic. Now hand that same new hire the policy binder. Same question, but now they flip to the right page and read you the real answer. The person did not get smarter. They just got a source to check.

That binder is what we are about to give the agent.

The before: confident and wrong

Let me show you the problem first, because it is the whole reason grounding matters.

Harbor's real returns policy is specific. Damaged warehouse racking can be returned within 14 days, and the resolution is a replacement, not a cash refund. That is it. No 30-day window, no money back.

Here is what the ungrounded agent said when a customer asked:

Customer: Hi, one of the racking units arrived bent. What's your return policy?

Harbor Help agent: No problem at all! You can return any item within 30 days for a full refund. Just keep the original packaging and we'll process your money back once it arrives. 😊

Every sentence there sounds great. It is also wrong. Wrong window, wrong resolution, wrong promise. If a customer acts on that, Harbor now has an angry buyer expecting a refund the policy never offered. The friendly tone makes it worse, not better, because nobody reads that reply and thinks to double-check it.

Adding the binder

In Copilot Studio, the binder lives under the Knowledge tab of your agent. Here is the flow for Harbor.

  1. Open the Harbor Help agent and go to the Knowledge tab.
  2. Click + Add knowledge. You get a set of source tiles to choose from.
  3. Pick the one that fits where Harbor's policy actually lives. The options cover public websites, a file you upload, SharePoint, OneDrive, Dataverse, Azure AI Search, and various enterprise connectors.
  4. For this walkthrough we uploaded a single file, the Harbor returns and replacement policy, as a PDF.
  5. Give the source a clear name and description. The description is not decoration. The agent reads it to decide when this source is relevant, so write it like you are telling a new hire what is in the binder.
  6. Add it to the agent and wait.

That last step matters more than it looks. The source has to finish indexing before the agent can use it. Watch for the status to turn to Ready. If you test too early, while it still says it is processing, the agent will act like the file is not there, because as far as it is concerned, it is not.

For a single policy PDF, a file upload is the simplest path. If Harbor kept its policies in a SharePoint library that updates regularly, pointing the agent at SharePoint instead would mean it always reads the current version without you re-uploading anything.

The one switch that changes everything

Adding a source is only half the job. By default, the agent can still fall back on its own guesses when the source does not have an answer. That is fine for a casual demo and dangerous for anything a customer sees.

So find this setting. Go to Settings, then Generative AI, and look for Allow ungrounded responses.

Turn it off.

With it off, the agent is only allowed to answer from the sources you gave it. If a question is not covered, it says so instead of inventing an answer. That is the line between a demo and something you would actually put in front of a customer. A grounded agent that admits "I don't have that" is far more useful than a confident one that makes things up, because you can trust the answers it does give.

There is a related toggle nearby for web search, sometimes shown as grounding with Bing. Leave that off for Harbor. We want the agent answering from Harbor's own policy, not from whatever it finds on the open web.

The after: same question, real answer

Now the file says Ready, ungrounded responses are off, and we ask the exact same thing.

Customer: Hi, one of the racking units arrived bent. What's your return policy?

Harbor Help agent: Sorry to hear it arrived damaged. For damaged racking, you can return it within 14 days, and we'll send you a replacement unit rather than a refund. I can start that replacement for you now if you'd like. 😊

Same friendly tone. Completely different outcome. The window is right, the resolution is right, and nothing was invented. The agent is reading from Harbor's binder now, not from its imagination.

This is the moment the whole series has been building toward. An agent that chats is a toy. An agent that chats and tells the truth about your business is a tool.

A few things that will trip you up

Grounding is simple to switch on and has a handful of sharp edges. The ones worth knowing before you ship:

  • Wait for Ready. I said it above and I will say it again, because it is the number one reason people think grounding is broken. If the source still shows as processing, the agent cannot see it yet. Give it a minute and refresh.
  • Check the supported file types. Copilot Studio accepts common document formats, but not everything, and it will not read encrypted or password-protected files. If your policy PDF is locked, unlock a copy before uploading.
  • Mind the limits. There is a ceiling on how many files and how large they can be, generous for a few policies but worth knowing if you ever try to dump an entire shared drive in.
  • Uploaded content is visible to everyone who uses the agent. This is the big one for real business data. When you upload a file, anyone who can talk to the agent can effectively see what is in it, regardless of who had access to the original. Do not upload anything you would not want every agent user to read. For Harbor's public returns policy, fine. For a file with pricing deals or staff details, think twice.
  • Write real descriptions. When you have more than one source, the agent uses each source's description to decide which one to check. Vague descriptions lead to the agent reaching for the wrong binder. Be specific about what each source covers.

Where this leaves us

Harbor Help can now answer policy questions from Harbor's actual policy, and it stops guessing when it hits something it does not know. That is a real, shippable improvement, and it took one file and one switch.

But it still cannot do anything. It can tell a customer the returns window. It cannot look up whether that customer's specific order is eligible, or start the replacement it just offered. Right now, "I can start that for you" is a polite fib.

Next time we fix that. We give the agent tools, so it can take a real action, like pulling up a live order and checking its status, instead of only talking about it. That is where a support agent stops being a smart FAQ and starts being an actual assistant.

See you next time. 😊


Sources

Top comments (0)