[Copilot Studio] KPI Report End-to-End from Collection to Distribution: Final Configuration of Parent + Document Creation Sub
This page has been translated by machine translation. View original
Introduction
Hello, I'm Keima.
Comparing KPIs across multiple SaaS companies, adding charts and insights, and distributing the results as a report is a common task in corporate planning and customer success roles.
Throughout this series, I've individually examined each step of "collection → aggregation → charts → insights → documentation → distribution," and in this final installment, I'll integrate everything into a single agent that runs from start to finish with one request.
In this article, I'll walk through the process of building the integrated agent "KPI Integration Assistant" from an empty agent, one piece at a time, verified on actual hardware as of June 2026.
The parent agent will hold collection (SharePoint knowledge), a documentation sub (child agent), and a distribution flow, connecting everything from a single request all the way to comparison, insights, Word/Excel/PowerPoint generation, and download links.
I've also included tips on preventing garbled Japanese characters in chart axis labels, and tips for reliably producing download links.
I hope this serves as a useful reference for anyone looking to fully automate document creation end-to-end in Copilot Studio.
This article is the 12th (and final) installment in a series on building agents in Copilot Studio.
Throughout the series, the goal has been to build an agent that handles "collection → aggregation → charts → insights → documentation" end-to-end. This article serves as the finishing touch, integrating each step into a single agent.
Target audience: Anyone who wants to automate KPI comparison report creation in Copilot Studio, from collection through distribution.
Note: The company names (CloudNova / StreamForge / Datapeak) and KPI figures used in this article are all fictional data.
Series Article List
| # | Theme | Article |
|---|---|---|
| Part 1 | First Agent | Creating Your First Agent |
| Part 2 | Knowledge | Trying Knowledge-Grounded Answers Based on Files |
| Part 3 | Topics, Tools & Flows | Building "Actions" with Topics, Tools, and Agent Flows |
| Part 4 | Templates, Autonomous Triggers & Multi-Agent | Expanding Structure with Templates, Autonomous Triggers, and Multi-Agent |
| Part 5 | Collection (How to Pass Data) | Comparing Methods for Providing KPI Data to an Agent for Aggregation |
| Part 6 | Aggregation | Performing KPI Aggregation Deterministically Instead of Relying on LLM |
| Part 7 | Charts | Displaying KPIs as Charts Within the Chat |
| Part 8 | Insights | Generating Insights from Aggregated Figures |
| Part 9 | Documentation (Word) | Auto-Generating Word Reports by Inserting Figures into Templates |
| Part 10 | Documentation (PowerPoint / Excel) | Generating Real .pptx/.xlsx Files from Scratch with Code Interpreter |
| Part 11 | Distribution | Distributing Generated Word Reports as Download Links via Flow |
| Part 12 | Integration (Final) | (This article) |
1. What We're Building
What we'll build in this article is an agent with the following structure.
- Create a new, empty parent agent called "KPI Integration Assistant"
- Turn on Code Interpreter for aggregation and documentation, and turn off "Allow unauthenticated responses" to suppress hallucinations
- Hold collection as a single SharePoint raw data (Excel) file knowledge source
- Delegate documentation (generating Word, Excel, and PowerPoint files) to a child agent called "Documentation Sub"
- Fix distribution with an agent flow (OneDrive save + sharing link)
- Connect everything from a single request through comparison, insights, Word/Excel/PowerPoint generation, and download links
2. Overall Structure: Parent + Documentation Sub
The series articles were written by process step (collection, aggregation, charts, insights, documentation, distribution), but the actual running agent is structured not as a flat sequence of steps, but divided into a parent orchestrator, a sub handling documentation, and a flow for distribution that we want to keep fixed.
The only child agent (sub-agent) in this setup is "documentation."
Collection is handled by knowledge, and distribution by a flow — components separate from the sub-agent.
KPI Integration Assistant (Parent Agent)
Reception, collection, comparison, insights, and consolidation are all handled by the parent itself.
┌─ Components held directly by the parent (not sub-agents)
│ Knowledge : SharePoint raw data kpi-raw-data-yoy.xlsx → Collection
│ Tool : Distribution flow (OneDrive save → org sharing link) → Distribution
│
└─ Child agent delegated by parent (this is the only sub-agent)
Documentation Sub : Generates Word/Excel/PPT with Code Interpreter → Documentation
Since the parent directly references the SharePoint knowledge for collection, no collection-specific sub is created.
Aggregation, charts, and insights are also handled by the parent (and Code Interpreter) based on the figures from the knowledge source.
The correspondence between steps, the components that handle them, and the relevant series installments is as follows.
| Step | Component | Series Installment |
|---|---|---|
| Collection | SharePoint Document Library Knowledge | Parts 2 & 5 |
| Aggregation | Code Interpreter (Python) | Part 6 |
| Charts | Code Interpreter (Excel Native Charts & Images) | Parts 7 & 10 |
| Insights | Language Model Generation (policy defined in instructions) | Part 8 |
| Documentation | Code Interpreter (Word, PowerPoint, Excel) | Parts 9 & 10 |
| Distribution | Agent Flow (OneDrive save + sharing link) | Part 11 |
The reason for this division is that each step has a different nature.
Component selection in generative orchestration is a probabilistic judgment by the LLM, so distribution — where we want consistent behavior — is fixed with a flow.
On the other hand, Code Interpreter can take minutes to respond, which doesn't fit within the 100-second limit of synchronous flows, so it's kept as a chat capability of the child agent rather than being put in a flow.
Respond to the agent within the 100-second action limit. Optimize the flow logic, queries, and the amount of data returned so that a typical run is below this 100-second limit.
Source: Add an agent flow or workflow as a tool to an agent | Microsoft Learn
Child agents are lightweight subs contained within the parent, and no separate publishing or licensing is required.
Child agents are lightweight agents within your existing agent.
Source: Add other agents overview | Microsoft Learn
3. Step 1: Create the Parent Agent
First, create a new, empty agent.
From the left menu in Copilot Studio, open "Agents" → "New Agent" and proceed to manual configuration via something like "Skip to settings."
Name it "KPI Integration Assistant."
Once created, write the agent's role and how it should handle figures in the "Instructions" field on the overview screen.
This time, I wrote in Japanese, including delegation instructions.
You are the "KPI Integration Assistant."
Use only the KPI figures in the knowledge (CloudNova, StreamForge, Datapeak) in your responses. Do not fabricate figures. If a value is not available, state "Not provided."
When asked for comparisons or insights, return a comparison table of the three companies along with brief insights in Japanese.
When asked to create a Word, Excel, or PowerPoint file (report, table, or slides), always delegate to the child agent "Documentation Sub" and return the download link produced there.
Always respond to the user in Japanese.

Overview screen of "KPI Integration Assistant" created from an empty agent. Set the name and instructions (in Japanese).
The reason for explicitly stating "use only figures from knowledge; do not fabricate figures" in the instructions is to let generative AI handle the interpretation of figures, but not the figures themselves.
Calculations are delegated to the downstream Code Interpreter, while the generative AI is responsible only for interpretation.
4. Step 2: Turn On Code Interpreter and Turn Off Unauthenticated Responses
The core of aggregation, charts, and documentation is Code Interpreter.
To use it, enable it in the agent settings.
Open "Settings" → "Generative AI" and turn "Code Interpreter" on.
On the same screen, turn "Allow unauthenticated responses" off.
This prevents generative AI from fabricating figures that have no basis in the knowledge.

In Generative AI settings, Code Interpreter (Python execution) is turned on, and "Allow unauthenticated responses" is turned off.
5. Step 3: Add Collection as SharePoint Knowledge
Next, add the raw KPI data for the three companies as knowledge.
This is the "collection" step.
The key point here is that if you want Code Interpreter to perform aggregation, the raw data must be placed in a SharePoint Document Library, not uploaded as a file.
Code Interpreter can use structured files (Excel, CSV) for aggregation only in the following two ways:
- As an end user, uploading structured files during a chat with the agent
- As a maker, adding a SharePoint Documents library as a knowledge source that contains the structured files
Copilot Studio agents can use code interpreter to analyze structured files that are provided to the agent by the following two ways:
- As an end-user, when you upload structured files while chatting with the agent.
- As a maker, when you add SharePoint Documents library as a knowledge source, which in turn contains the structured files.
Source: Use code interpreter to analyze structured data (preview) | Microsoft Learn
In other words, simply uploading an Excel file as regular file knowledge does not allow Code Interpreter to directly read its contents and perform aggregation.
In this case, we place the raw data file for aggregation, kpi-raw-data-yoy.xlsx (monthly ARR, etc. for three companies), in a SharePoint Document Library and use that as the knowledge source.
This single file serves both as the "basis" when answering in text, and as the "raw data" when aggregating with Code Interpreter.
In the parent agent, go to "Knowledge" → "Add Knowledge", select "SharePoint", choose kpi-raw-data-yoy.xlsx from within the library using "Browse items," and add it.
After adding, wait until the status shows "Ready" (indexing complete) and the type is registered as SharePoint.

Parent agent overview screen after adding the raw data for aggregation (SharePoint Excel) as knowledge with status "Ready."
6. Step 4: Create the Documentation Sub (Child Agent)
Of aggregation, charts, and documentation, file generation is delegated to a child agent.
This is because Code Interpreter can take minutes to respond, which is difficult to fit into a synchronous flow.
Synchronous flows have a 100-second action limit, and flow logic, queries, and the amount of data returned must be optimized to stay within this limit.
Respond to the agent within the 100-second action limit. Optimize the flow logic, queries, and the amount of data returned so that a typical run is below this 100-second limit.
Source: Add an agent flow or workflow as a tool to an agent | Microsoft Learn
For this reason, Code Interpreter is kept as a chat capability of the child agent rather than being put in a flow.
From the parent, go to "Agents" → "Add Agent" → "New Agent" to create a child agent and name it "Documentation Sub" (in Japanese).
Write the Description and Instructions also in Japanese, explaining when and what it does.
Description:
Documentation Sub generates downloadable Office files from KPI figures.
When asked to create a Word document, Excel file, or PowerPoint, it creates the file using Code Interpreter and returns a download link.
Excel charts use openpyxl native BarChart (no embedded matplotlib images). This is to create charts that can be edited in Excel.
Instructions:
You create Office files (Word .docx / Excel .xlsx / PowerPoint .pptx) from the provided KPI figures.
Use Code Interpreter to create the file and always return a download link for the generated file.
Use only the figures provided; do not fabricate values.

Settings for child agent "Documentation Sub." Display name, description, and instructions are all in Japanese to test delegation.
In this verification, even without adding knowledge to the Documentation Sub, the parent passed the figures (comparison table or raw data) during delegation, and the child was able to process them with Code Interpreter to generate the files.
If the child says it can't create a file due to missing data, add the SharePoint knowledge to the child as well.
7. Step 5: Verify the Parent's Agent List
Once the child is created, open the "Agents" tab on the parent and confirm that "Documentation Sub" appears in the list.
Since no collection sub is created this time, this child is the only one.

Documentation Sub connected as a child agent (enabled = on) to the parent "KPI Integration Assistant."
8. Step 6: Fix Distribution with a Flow
Steps like distribution, where you want "exactly the same procedure every time," should be fixed with an agent flow rather than left to conversation.
Use the distribution flow created in Part 11 (OneDrive save → org sharing link) as-is and register it as a tool on the parent.
The distribution flow is built with these 5 steps:
- Place a trigger "When an agent calls a flow"
- Run a prompt (with Document output configured) to generate the Word report
- Create a file in OneDrive, saving the "Document Output Content Bytes" from the prompt output
- Use OneDrive's "Create a sharing link" to create a sharing link restricted to the organization
- Use "Respond to agent" to return the sharing link URL to the parent

Distribution agent flow (created in Part 11). Saves to OneDrive, creates an org-internal sharing link, and returns it to the parent.
Register this flow from the parent's "Tools" → "Add a tool" → "Flow", add a description that communicates when to use it, and turn it on.

Distribution flow registered as a tool with a description on the parent (enabled = on).
9. Step 7: Run It
At this point, collection (SharePoint knowledge), documentation (Documentation Sub + Code Interpreter), and distribution (flow) are all in place.
Based on actual testing, the following order of steps was the clearest way to proceed.
9.1 Have the Parent Produce Collection, Comparison, and Insights
First, request a comparison and insights in the parent's test chat.
Please compare the Q3 FY2025 KPIs for CloudNova, StreamForge, and Datapeak using the figures from the knowledge.
Provide a comparison table of the three companies and include notable points for each company and insights from the three-way comparison. Do not use figures not found in the knowledge.
The parent searches the SharePoint knowledge raw data and returns a comparison table and insights for the three companies.
At this point, only figures from the knowledge were used, and metrics not provided were not filled in with guesses (the "unauthenticated responses" setting turned off in Chapter 4 is taking effect).

The parent compares the three companies using figures from the SharePoint knowledge and returns notable points and insights. Only raw data included in the knowledge is used in the response.
9.2 Send a Single Sentence to the Parent to Generate Three Formats (Delegation to Documentation Sub)
Once the comparison table and insights are ready, request documentation next.
In the request, specify the target period (Q3 FY2025) and any labels you want in Japanese (such as the title), and ask for a download link at the end.
For example, for Word, the request would be:
Using the Q3 FY2025 (October–December 2025) data from the knowledge, please create an ARR comparison report for the three companies in Word.
Set the title to "FY2025 Q3 ARR Comparison Report," and include a three-company ARR comparison table (with year-over-year), notable points for each company, and three-company comparison insights, all in Japanese.
Do not use figures not found in the knowledge.
When it's done, please provide a link to download it.
The parent delegates to the child agent "Documentation Sub," and the Documentation Sub runs Code Interpreter to create the file and returns a card with a download button.

The parent delegates to "Documentation Sub," and a download card for the Q3 FY2025 Word (.docx) file is returned. The activity map shows a "Documentation Sub" node, confirming that delegation occurred.
Request Excel and PowerPoint in the same manner.
However, note that chart creation in Excel requires special care.
Using the ARR data for Q3 FY2025 (October–December 2025) from the knowledge, please create an Excel file with openpyxl.
Include a vertical bar chart comparing the ARR of the three companies as an editable chart, not an image.
Set the chart title to "FY2025 Q3 ARR Comparison (millions JPY)," the horizontal axis to company names, and the vertical axis to "ARR (millions JPY)."
Do not use figures not found in the knowledge.
When it's done, please provide a link to download it.

Excel also generated by "Documentation Sub." The specifications for an openpyxl native bar chart (Japanese title, axis labels) and a .xlsx download card are returned.
Using the ARR comparison data for Q3 FY2025 (October–December 2025) from the knowledge, please create a PowerPoint with python-pptx.
Use a slide structure of title slide, ARR bar chart, KPI table, and insights, with headings and labels in Japanese.
Make the bar chart an editable chart, not an image, with the title "FY2025 Q3 ARR Comparison (millions JPY)," the horizontal axis as company names, and the vertical axis as "ARR (millions JPY)."
Do not use figures not found in the knowledge.
When it's done, please provide a link to download it.

PowerPoint also generated by "Documentation Sub." A 4-slide structure of title slide, ARR bar chart, KPI table, and key insights, along with a .pptx download card, is returned.
9.3 Verify the Contents of the Generated Files
Using the download links for all three formats, I actually opened the files and checked their contents.
The screenshots of the contents were taken by opening the downloaded files locally.
The Word (.docx) file was a report containing the title, ARR comparison table (with year-over-year), monthly ARR trends, notable points for each company, and three-company comparison insights.

Generated Word report. Title, ARR comparison table (with year-over-year), monthly ARR trends, notable points, and insights are included. The period is explicitly stated as "FY2025 Q3 (Q3 FY2025)."
The Excel (.xlsx) file uses openpyxl native bar charts (BarChart), so clicking the chart allows editing it in Excel.
Since it's not just an image pasted in, setting the title and axis labels in Japanese causes no garbling, and formatting can be changed afterward.

Generated Excel. Monthly data on the "Data" sheet and native bar chart "FY2025 Q3 ARR Comparison (millions JPY)." Axis labels (company names, ARR (millions JPY)) are in Japanese without any garbling.
The PowerPoint (.pptx) had a 4-slide structure: title slide, ARR bar chart, KPI table, and key insights.
The bar chart is a python-pptx native chart, with headings and labels also in Japanese.

Generated PowerPoint (4 slides). Title slide / ARR bar chart (python-pptx native chart) / KPI table / Key insights. Both headings and labels are in Japanese.
All three formats were generated using the same Q3 FY2025 data, and the Japanese labels in the charts were produced without any garbling.
At this point, collection (SharePoint knowledge) → aggregation/documentation (Documentation Sub + Code Interpreter) was connected through a single request to one agent, and distribution was fixed as a flow.
Execution of the distribution flow (saving to OneDrive and issuing an org-internal sharing link) was confirmed in Part 11, and the OneDrive connector sign-in (authorization) is required on first use. This article covers fixing the flow as a tool on the parent.
10. Troubleshooting Points
Here is a summary of issues that were easy to run into during actual testing.
- Vague requests cause results to vary between runs: Without specifying the target period or aggregation method, the same request can result in different period and figure interpretations for each file. Clearly specifying the target period (e.g., Q3 FY2025) in the request, and adding the aggregation method (e.g., monthly average) if needed, improves stability (same thinking as Part 6's "don't let LLM handle aggregation").
- Delegation is probabilistic and doesn't always happen: With the same request, sometimes delegation occurs, sometimes the parent handles it itself, and sometimes only the code is returned as text. If it fails, try the request again.
- Code Interpreter file generation can fail depending on the format: Word was generated stably, but for Excel and PowerPoint with charts, failures were observed: stopping after displaying code with no output,
SystemError, or the file being returned as a citation reference without a download link. If it fails, lighten the chart and re-run, or try the request again. - openpyxl native charts are lighter than matplotlib images for Excel: Trying to paste matplotlib-drawn images tended to be heavy and caused
SystemErroror silent hangs. Instructing it to create Excel-native (later editable) charts usingopenpyxl.chart.BarChartwas lighter and more stable (9.2). - If no download link appears, ask for a "download link" and try a few times: Even with the same generation, some runs returned a card with a download button while others only returned a citation reference without a link. Explicitly requesting "please give me a link to download it" and retrying a few times will produce the card.
- Don't put Code Interpreter in a flow: Responses can take minutes, which hits the 100-second constraint of synchronous flows. Keep it as a chat capability of the child agent.
11. Summary
Throughout the series, I was able to integrate the full KPI comparison report pipeline of "collection → aggregation → charts → insights → documentation → distribution" into a single agent (parent "KPI Integration Assistant" + child "Documentation Sub" + distribution flow).
From collection through documentation was connected with a single request, and distribution was fixed as a flow (execution of the distribution flow was confirmed in Part 11, and OneDrive connector sign-in is required on first use).
Here is a summary of what was learned in each step, organized in a way that's useful for making decisions.
| Step | What It Can Do | Key Decision Points |
|---|---|---|
| Collection | Answer based on raw data from SharePoint knowledge | For Code Interpreter aggregation, place files in SharePoint library rather than uploading as file knowledge |
| Aggregation | Aggregate with Code Interpreter | Explicitly state the target period in the request and use figures from knowledge |
| Charts | Excel native charts / image generation with Code Interpreter | openpyxl native charts are lighter than pasting matplotlib images |
| Insights | Generate comparisons and observations backed by figures | Pass pre-calculated figures and let generative AI handle only interpretation |
| Documentation | Generate Word, Excel, PPT with child agent + Code Interpreter | Delegation is probabilistic; fix steps that must behave consistently with flows |
| Distribution | OneDrive save + org-internal download link | Fix deterministic steps with flows |
It felt genuinely practical to be able to delegate the entire KPI comparison workflow to an agent using mostly no-code tools.
By explicitly stating the target period (Q3 FY2025) in the request and using only figures from knowledge, it was possible to generate all three formats — Word, Excel, and PowerPoint — using the same data.
For charts, specifying "an editable native chart, not an image" allowed lighter generation than pasting matplotlib images, without garbling even when axis labels and titles were in Japanese.
On the other hand, leaving the target period or aggregation method vague and delegating to the LLM leaves room for results to vary between runs. It was realistic to let generative AI handle presentation-oriented parts like documentation, while clearly specifying the target period and figures to use in the request.
The verification used fictional KPI data for three fictional SaaS companies (CloudNova / StreamForge / Datapeak).
When operating with real data, the accuracy of the information placed in knowledge, the quality of description text for each component, and the thoroughness of making figure determination deterministic will greatly affect agent precision.