Preparing a client call on a technical subject in less than ten minutes, without sacrificing documentation rigor: that's exactly what the combination of Copilot Studio, the Researcher agent from Microsoft 365 Copilot, and Power Automate enables. This article is aimed at M365 administrators and solution architects looking to optimize message consumption while automating the production of structured content.
Why HTML is the ideal output format for an AI agent
Large language models (LLMs) have been trained massively on web content, which is structured in HTML. In practice, this means these models generate HTML with significantly higher reliability than other output formats. A response in plain Markdown can pose interpretation issues depending on the client; an HTML file is immediately readable in any browser, with no dependency on a third-party rendering engine.
The other concrete advantage: HTML is saved as a single file, can be converted to PDF via Power Automate (action OneDrive for Business – Convert file), and integrates seamlessly into a SharePoint or Teams workflow.
Common use cases
Client call preparation sheets, technical monitoring notes, Microsoft Learn documentation summaries, system monitoring dashboards — all this content benefits from being produced in HTML rather than plain text.
Solution architecture in three blocks
The architecture relies on three distinct components, each with a precise role:
- Researcher — the search agent included in Microsoft 365 Copilot, which queries the web and official documentation (including Microsoft Learn) without consuming Copilot Studio messages.
- A custom Copilot Studio agent — responsible only for HTML formatting based on search content provided as input.
- A Power Automate flow — orchestrates the two, passes data from one block to another, and saves the produced HTML file to OneDrive.
The separation between the search phase and the HTML generation phase is the key point of the architecture: it avoids calling browsing capabilities from the Copilot Studio agent, which would consume messages.
Copilot Studio message consumption
The Researcher agent from Microsoft 365 Copilot is included in the M365 Copilot license and does not deduct any messages from the Copilot Studio quota. Only the call to your custom agent (HTML generation) consumes messages — and only if it is invoked directly outside the Copilot node of a Power Automate flow (see next section).
Creating the HTML generation agent in Copilot Studio
The agent has a unique and well-defined role: receive a block of search text, structure it, and return pure HTML.
Create the agent in Copilot Studio
In Copilot Studio, create a new agent in your sandbox environment. Name it, for example, Create Battle Card.
Configure system instructions
In the agent's instructions, specify the expected output format. Here is a directly usable example:
1Based on the research provided, create a one-page HTML battle card style document.2The document must contain:3- What it is (definition)4- An analogy to explain the concept5- Core concepts6- Common misconceptions and how to correct them7- When to use it / when not to use it8- A quick example9- Relevant documentation links (Microsoft Learn preferred)10 11Respond only with pure HTML — no markdown, no explanation, no code block fence.12The HTML must be self-contained (inline CSS, dark mode preferred).Choose the model
In the agent's settings, select the claude-sonnet model (or equivalent available in your region). Lighter models reduce latency for pure formatting tasks where reasoning power is not critical.
Publish the agent
Publish the agent to make it available in Power Automate. Without publication, a flow's Copilot node cannot reference it.
Building the Power Automate flow
This is where the message savings lie. The Copilot node in Power Automate can call Researcher without consuming Copilot Studio messages. The same node can then call your custom agent.
Create a flow with manual trigger
In Power Automate, create a new Instant cloud flow with a Manually trigger a flow trigger. Add a text field named research_topic.
Add the Copilot node — Researcher
Add a Copilot action (Microsoft 365 Copilot section). In the configuration:
- Agent: select
Researcher - Message: construct the prompt with the dynamic variable
research_topic
1Only write two to three pages on the topic: [research_topic]2Do not ask extra questions. Research broadly on the topic.3Focus mainly on Microsoft knowledge but explore further if relevant.4Provide links from Microsoft Learn when available.This node deducts no messages from your Copilot Studio quota.
Add the Copilot node — your HTML agent
Add a second Copilot action. This time:
- Agent: select
Create Battle Card(your published agent) - Message: pass the output from the Researcher node (variable
ResponseorOutputdepending on the connector) - Output type: select Text response to get raw HTML, not a JSON object with a nested text field
Save the HTML file to OneDrive
Add the OneDrive for Business – Create file action:
- Folder path:
/(root) or a dedicated folder - File name:
[research_topic].html(concatenation of the variable and extension) - File content: text output from the previous step
Double-click the OneDrive node
If the OneDrive node displays a configuration incomplete warning, double-click it to force open the settings panel. This behavior is known in the Power Automate editor.
Optional: convert to PDF
Add the OneDrive for Business – Convert file action to produce a directly usable PDF:
- File: reference the ID of the file created in the previous step
- Target type:
pdf
Observed results and performance
On a test covering the topic Custom Connectors Power Platform, the complete sequence proceeded as follows:
| Step | Duration | Message consumption |
|---|---|---|
| Researcher (web search + Microsoft Learn) | ~5 minutes | 0 Copilot Studio messages |
| Create Battle Card agent (HTML generation) | ~2.5 minutes | 1 Copilot Studio message |
| OneDrive Create file | <30 seconds | 0 Copilot Studio messages |
The HTML file produced contained: concept definition, analogy (the universal travel adapter), five core concepts, authentication options, common design errors, platform limitations, and a list of direct links to Microsoft documentation (overview, creation, DLP, certification).
Implementation
The following script illustrates how to call your Copilot Studio agent directly via Microsoft Graph for testing outside Power Automate flows. It requires the Microsoft.Graph module and access with the minimum Copilot Studio User role.
1# Required module: Microsoft.Graph (>= 2.x)2# Install-Module Microsoft.Graph -Scope CurrentUser3# Minimum permission: CopilotStudio.Conversations.ReadWrite (delegated)4 5# Parameters to adapt6$TenantId = "<your-tenant-id>"7$ClientId = "<your-app-registration-client-id>"8$AgentId = "<id-of-your-copilot-studio-agent>"9$ResearchText = "Paste here the content returned by Researcher"10 11# Interactive connection (delegated flow)12Connect-MgGraph -TenantId $TenantId -ClientId $ClientId `13 -Scopes "CopilotStudio.Conversations.ReadWrite"14 15# Creating a new conversation with the agent16$ConversationBody = @{17 agentId = $AgentId18} | ConvertTo-Json19 20$Conversation = Invoke-MgGraphRequest -Method POST `21 -Uri "https://api.copilotstudio.microsoft.com/environments/{environmentId}/bots/$AgentId/conversations" `22 -Body $ConversationBody `23 -ContentType "application/json"24 25$ConversationId = $Conversation.id26Write-Host "Conversation created: $ConversationId"27 28# Sending search content to the agent29$MessageBody = @{30 content = $ResearchText31} | ConvertTo-Json32 33$Response = Invoke-MgGraphRequest -Method POST `34 -Uri "https://api.copilotstudio.microsoft.com/environments/{environmentId}/bots/$AgentId/conversations/$ConversationId/activities" `35 -Body $MessageBody `36 -ContentType "application/json"37 38# Retrieving the HTML response39$HtmlContent = $Response.value | Where-Object { $_.type -eq "message" } | Select-Object -Last 1 -ExpandProperty text40 41# Saving the HTML file locally42$OutputPath = ".\battle-card-output.html"43$HtmlContent | Out-File -FilePath $OutputPath -Encoding UTF844Write-Host "HTML file saved: $OutputPath"45 46# Verification: open in default browser47Start-Process $OutputPathCopilot Studio Endpoints in GA
The Copilot Studio REST API is evolving. Check the current endpoints in the Microsoft Learn documentation on Copilot Studio APIs before deploying to production. The script above illustrates the calling logic — adapt the URIs to your region and API version.
Troubleshooting common errors
The OneDrive node displays "Need setup" Double-click the node to force open the configuration panel. The Power Automate editor doesn't always open it automatically on first insertion.
The agent returns JSON instead of raw HTML
Verify that the Output type parameter of the Copilot node is set to Text response and not the default value. Also add in the agent's instructions: Respond only with pure HTML — no markdown fence, no explanation.
Researcher doesn't bring back Microsoft Learn links
Explicitly add provide links from Microsoft Learn when available to the Researcher node's prompt. Without this instruction, the agent sometimes prioritizes generic sources.
Execution time exceeding 10 minutes Power Automate imposes a 30-minute limit on manually triggered flows, but Researcher can be slow on broad topics. Reduce the request to "one to two pages" to keep search time under 5 minutes.
The produced HTML file is empty
Verify that the expression referencing the agent output is correct. In the Power Automate expression editor, use outputs('Agent_step_name')?['text'] to extract the raw text field.
What you can do right now
This architecture is reproducible in less than an hour on any M365 tenant with Copilot Studio and M365 Copilot licenses. Here are the concrete actions to chain together:
- Create the agent
Create Battle Cardin Copilot Studio with the HTML formatting instructions above. - Publish it and note its identifier to reference it in Power Automate.
- Build the flow with the two Copilot nodes (Researcher → your agent) and the OneDrive action.
- Test on an internal topic — for example, a component of your technical stack that you often need to explain to stakeholders.
If your organization manages a tight Copilot Studio message budget, the point of this architecture goes beyond simple sheet generation: it demonstrates that it is possible to delegate the costly part (web search) to a component included in the M365 license, and reserve Copilot Studio messages for high-value transformations. This logic applies to any workflow where an enrichment step precedes a generation step.



