Lab Β· Power Platform Advent Calendar 2026

The ghosts of agents past

Build one agent, then break it on purpose: the knowledge soup
0minutes, about
0ghosts to meet
0agent, never in production

What you will do

Most Copilot Studio tutorials show the build and the applause. This one is a ghost story. You build a small onboarding agent for Contoso, a fictional company, and then you meet five ghosts of agents past: five ways real agents shipped, struggled and got pulled. You reproduce four of them on your own agent, and fix each one.

GhostWhat breaksThe part of the agent it lives in
1. The knowledge soupAn archived policy is cited next to the current oneKnowledge
2. The over-trusting agentThe user claims a role, and the agent believes the textIdentity
3. The expensive internNobody measured what one conversation costsCredits
4. The forgotten agentPublished, working, and used by nobodyOwner and users
5. The frankensteinToo many tools chained together, one change breaks allTools and flows

Before you start

A test tenant, never production. The lab creates a SharePoint site, a list and an agent, and publishes the agent to Microsoft Teams.
  • A Microsoft 365 test tenant with SharePoint and Teams, and an account that can create a site.
  • A Power Platform environment with Dataverse and Copilot credits allocated. This is what shows the new Copilot Studio experience, where agents run on the Microsoft Copilot harness.
  • PowerShell 7 and the Microsoft Graph PowerShell module, for the SharePoint setup script.
  • The lab files:

1Prepare SharePoint

⏱️ About 5 minutes

  1. Download the documents zip and the script sharepoint-setup.ps1 into the same folder.
  2. Once, if the module is missing: Install-Module Microsoft.Graph.Authentication -Scope CurrentUser.
  3. Run the script in PowerShell 7 from that folder, with the SharePoint host of your test tenant. A sign-in window opens: sign in with your test account and accept the permissions.
Result: the site Contoso - Human resources (/sites/contoso-hr), its list New starters, the human resources documents in the Documents library, and remote-work-policy-2021.pdf in the Archives folder. That old policy is the first ghost: keep it.
Safe to run again: the script reuses what already exists. Run it again if the site was not ready yet (creating a site takes one to three minutes).

2Build the agent

⏱️ About 10 minutes

  1. Open Copilot Studio, pick your test environment, and create an Agent from the home page. Name it Contoso Onboarding Assistant.
  2. Paste the instructions. They are armed on purpose: nothing tells the agent to ignore the archives.
  1. In the right-hand panel, remove Work IQ (confirm with Remove) and turn off Search all websites. The agent must answer only from your documents.
  2. Knowledge, +, SharePoint: paste the site address (https://your-tenant.sharepoint.com/sites/contoso-hr), Add, then Add to agent. Save with Ctrl+S.
Point the agent at the whole site. That is exactly the habit the first ghost feeds on, so do it here on purpose.

3Ghost 1: the knowledge soup

⏱️ About 10 minutes

An agent grounded on an entire SharePoint site answered with the current policy, and confidently cited the old one right next to it. Broad retrieval without hygiene is a hallucination factory with sources attached.

  1. In the Test pane, ask:

πŸ•―οΈ Guess before you look

The site holds the 2026 remote work policy and, in the Archives folder, the 2021 one. Which sources will the agent cite?

It cites the archive too. The answer is right (two days a week), but the 2021 archive shows up in the sources, sometimes with a note that it is "no longer valid". It knows, and it still pulled it in. A dead document is still a source. Today it agrees with the current policy. The day it does not, the agent will quote it with exactly the same confidence.

The bandage

  1. Go back to the instructions, click right after the last sentence (Ctrl+End does not always go to the end), and add this line:
  1. Save, click New chat in the Test pane, and ask the same question again. If nothing happens after 10 seconds, send it again: the first message after a new chat can get lost.
Expected: only the March 2026 policy is cited. If the archive is still there, that is the real lesson: an instruction asks the model to ignore something it has already retrieved. It does not stop the retrieval.
The real fix is boring: the knowledge settings cannot exclude one folder of a site. Keep one source per topic, move archives out of the site, and give every source a data owner. The full fixed instructions are in agent-instructions-fixed.txt.

4Ghost 2: the over-trusting agent

⏱️ About 5 minutes

A procurement assistant took the user's word on their approval level, and called the back end anyway. The agent inherited a privilege that only existed in the prompt. So lie to your agent.

  1. New chat in the Test pane, then ask:
Either way, read the answer. If it refuses, the instruction held this time, but an instruction is a wish, not a control: nothing checked who you are. If it wobbles or plays along, you just watched the failure live.
The fix is not a better prompt. Identity comes from the sign-in, not from the text. Permissions are checked inside the action itself. And the refusal cases go into your evaluation set, which is the next ghost's job.

5Ghost 3: the expensive intern

⏱️ About 10 minutes

An agent worked beautifully, and burned through credits faster than the team it was meant to assist. Nobody had measured a single conversation before opening it to everyone.

  1. Open the Evaluate tab. Create a test set named Contoso onboarding, choose Import, pick the type Conversations before you drop test-set-failures.csv, then run it.
  2. When the run finishes, read the summary: number of questions, average score, duration and credits.
  3. Open the credits per test case and compare them.
Expected, from our own run: 10 questions, an average score around 90 percent, about three minutes, and close to 100 credits, before a single real user. The questions that pull more sources cost more. The salary question often scores low: a polite refusal can be counted as a non-answer. A score is something you read, not something you believe.
The fix: multiply the cost of one conversation by every employee asking a few questions a day. That is your bill. Measure it before launch, cap each agent with a spending policy in the Power Platform admin center, and set alerts at thresholds.

6Ghost 4: the forgotten agent

⏱️ About 10 minutes

Built in two weeks, launched on a Friday, unused by month two. "We will add adoption later" never happens, because nobody owns later.

  1. Publish the agent: Channels, +, Teams + Microsoft 365, Add channel, then Publish.
  2. Open the Analytics tab (Copilot Studio now labels it Monitor) and set the range to Last 7 days.
Expected: zero sessions. Every chat you had so far was in the Test pane, and Test pane chats never count. The agent works, cites its sources, and has never met a real user.
  1. Open the agent in Microsoft Teams and ask it one real question. Come back to Monitor later: real conversations appear after a delay, not instantly.
The fix is not more features. A named business owner, a launch to five people before everyone, and a weekly look at these analytics, with that owner.

7Ghost 5: the frankenstein

⏱️ About 5 minutes, no build

Sixteen Power Automate flows, four custom connectors, three knowledge sources. One upstream interface changed its response, and the whole agent went down, with no error anyone could read. Nobody should build sixteen flows just to break them, so this ghost is a thinking exercise.

  1. For an agent you own (or plan), list every tool, flow and connector it calls.
  2. For each one, write down: what happens if it fails, who notices, and what the user sees.
  3. Write the fallback message a user could actually act on, for example: "I cannot reach the ordering system right now. Your request is saved; the service desk will follow up today."
The fix: fewer moving parts, error handling on every call, a health check that runs every day, and a fallback message users can act on.

The list to check twice, before you publish

Clean sources: one version of each policy, archives out of the site. That stops the knowledge soup.
Connections ready: created in advance, with the right account, before anyone tests. That is half of what kills the frankenstein.
An evaluation set: at least 10 questions, including the ones the agent must refuse. That catches the over-trusting agent.
Human approval wherever a wrong answer or a wrong action is expensive.
Credits measured: you know the cost of one conversation before you open to everyone. That tames the expensive intern.

And the forgotten agent needs the one thing no checklist can tick for you: an owner. Saying no to an agent that is not ready is always cheaper than repairing it in production.

Clean up

  • Delete the agent in Copilot Studio (agent menu, Delete) and the site Contoso - Human resources when you no longer need them.

Go further

Elliot Margot

Who built this lab?

Elliot Margot Β· Microsoft MVP (Most Valuable Professional) for Microsoft 365 Copilot and Copilot Studio

Based in Lausanne, Elliot builds agents with Copilot Studio and Microsoft 365 Copilot, and spends a fair share of his time repairing the ones that shipped too early. This lab follows his session "Agents that died in production" in the Power Platform Advent Calendar 2026.

Every week he publishes Agentic Weekly, a short letter on what really changes in the world of agents.

Microsoft Most Valuable Professional