Agent Governance Meta-Agent: An Agent That Watches Your Agents
AgentLens - one agent that sweeps, governs, cost-checks and consolidates every agent across your tenant. The code is on GitHub.
- Sweep every agent store: Copilot Studio, Agent Builder, Foundry, Fabric
- DLP and compliance posture, scored
- Usage joined to real Azure spend
- Consolidation plan you can send to owners
- The whole estate as a self-contained SVG map
- Read-only, and it never invents a number
Watch the session
Open on YouTubeAbout this session
Tenants now sprawl to hundreds of agents across Copilot Studio, Agent Builder, Azure AI Foundry and Microsoft Fabric, and nobody owns the whole picture. This session demos AgentLens, a governance meta-agent: an agent whose only job is to watch your other agents. From a single chat it sweeps every store and flags sprawl, orphans and duplicates; scores your DLP posture and names the environments no policy covers; joins usage to real Azure spend to separate the agents that earn their keep from the ones that just cost money; drafts a promote / improve / consolidate / retire plan you can send to owners; and draws the entire estate as a diagram. One rule holds the whole thing up: AgentLens never fabricates data. Every figure comes from an API response in the same call, a source it cannot read is returned as not connected with the fix attached, and zero and unknown are never the same answer. Since the session, AgentLens has shipped - five read-only tools behind an MCP server, a Microsoft 365 Copilot declarative agent, a Copilot Cowork plugin and the Bicep to deploy it, all on GitHub.
Inside the demo
- Sweep the tenant: a live inventory of 372 agents across Copilot Studio, M365 Agent Builder, Azure AI Foundry and Microsoft Fabric, with owners, orphans and duplicate clusters flagged in one view. A store that cannot be read is reported as not connected, never as zero agents.
- Governance posture: a DLP and compliance score of 68/100, the environments no policy covers, and the risky patterns to fix first.
- Value versus cost: usage joined to real Azure spend, a promote / improve / consolidate / retire verdict per agent, and two cost figures kept apart - what Azure actually invoiced, and what each agent metered priced at a rate that travels with the number.
- Consolidation plan: six duplicate clusters, the agent to keep in each, what the retired ones consume, and a plan you can send straight to their owners.
- Estate map: the whole agent estate drawn as a self-contained SVG - stores to risk hotspots to keep / consolidate / retire - with any source that could not be read drawn as a dashed not-connected node rather than an empty one.
Prompts to try
These are the agent's five conversation starters, verbatim. Point it at your own tenant and start here:
- Sweep every agent store in my tenant and flag sprawl and orphans.
- What is my DLP and compliance posture across all agents?
- Which agents actually deliver value, and what do they cost?
- Find duplicate agents and draft a consolidation plan.
- Draw a map of my agents.
Build it yourself
Provision one read-only reader identity
Everything reads through a single service principal, AgentLens-Reader. It needs the Power Platform Administrator role, Reader and Cost Management Reader on the subscription, admin-consented Graph User.Read.All, and an application user in each Dataverse environment. Skip one and that source comes back as not connected with the exact fix, rather than as a wrong number.
What each grant enablesRun the five tools behind an MCP server
sweep_inventory, dlp_posture, value_and_cost, consolidation_plan and agent_map, all read-only, over Azure Resource Graph, Microsoft Graph, the Power Platform admin and governance APIs, Dataverse aggregates and Azure Cost Management. Run it locally with no credentials first: every source should say not connected. That is the product working correctly.
The install, step by stepPut the honesty rule in the contract, not the prompt
Every result marks each source connected, partial or not_connected, carries the remediation verbatim, and ships the rate and method behind any derived figure. Billed spend and metered consumption are two separate numbers and are never summed. Instructions alone will not hold this line under pressure; the result shape will.
Architecture and guaranteesPackage and sideload the declarative agent
The agent package keeps tenant-specific values as placeholders filled in at package time, so nothing tenant-specific is ever committed. Build the zip, upload it as a custom agent in Microsoft 365 Copilot, then check the first sweep against the Power Platform admin center. The numbers should match.
The agent packageShip the same tools into Copilot Cowork
One extra package, zero extra server: the Cowork plugin points at the same MCP endpoint and the same Entra SSO config, and adds a governance-review skill that encodes the zero-is-not-unknown rule as a workflow. All five tools declare readOnlyHint, so Cowork runs them without confirmation prompts.
The Cowork plugin
Slides
Resources
The code
- AgentLens on GitHub→The declarative agent, the MCP server, the Cowork plugin and the Bicep to deploy it, in one source-available repo.
- Install it, step by step→Twelve steps, of which only two need a signed-in human. Phase 0 lists every prerequisite, licence and tenant switch up front.
- Architecture and the guarantees it makes→How the agent, the MCP server and one read-only service principal fit together, and why an unreadable source is never rendered as zero.
- App registrations: what to grant→Exactly what each identity can do, and what breaks without each grant.
- The same tools inside Copilot Cowork→Build and upload the Cowork plugin against the same endpoint and auth config.
- Licence→Source-available for internal deployment. Redistribution or offering it as a service needs written permission.
Recording
- Microsoft 365 & Power Platform Community Call - July 23, 2026→The community call recording at the start of the AgentLens demo (around 17:25).
Related
- Automating Mermaid diagrams with Copilot Studio→The earlier talk on getting an agent to draw a system rather than describe it.
From the speaker
Elliot Margot
Microsoft MVP - M365 Copilot & Copilot Studio
