web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Copilot Studio / Code Interpreter can't...
Copilot Studio
Answered

Code Interpreter can't access a Knowledge-source file for full-dataset calculations

(0) ShareShare
ReportReport
Posted on by 2

Hi all,

 

I'm building a Copilot Studio agent that answers KPI questions (sums, counts, averages) over a manufacturing dataset. I want the agent to use Code Interpreter to compute accurate totals across my full dataset.

 

My setup:

 

  • 3 files added as Knowledge sources (Type shows as "Files"):

    1. AMTC_Insights_Data – the main data table (one row per work order)

    2. Column_Source_Mapping – field/synonym dictionary

    3. Business_Metric_Glossary – metric calculation rules


    4.  

  • Generative orchestration is On

  • Code Interpreter is enabled

  • Agent instructions tell it to use Code Interpreter over the Insights data for any SUM/COUNT/AVERAGE


  •  
 

The problem:
When I ask for a total (e.g., "total liquidated hours for June 2026"), the agent correctly resolves the column, aggregation, and period — but it only computes over a handful of retrieved rows, not the full dataset. It explicitly responds with something like:

 
 

"The CodeTool requires the actual dataset file to be attached as an input file (a f_<guid> reference), which isn't available from the knowledge source search results. The search tool returns only summarized text excerpts, not the complete structured file."

 

So it seems Code Interpreter cannot read a Knowledge-source file as a compute input — Knowledge appears to be semantic search (returns text snippets), while Code Interpreter needs the file attached to the conversation as an actual input file. The two pipelines don't seem connected.

 

My questions:

 

  1. Is this expected behavior — that Code Interpreter cannot load a Knowledge-source file for full-table computation?

  2. What is the recommended pattern to run accurate aggregations over a full dataset in Copilot Studio?

    • Attaching the file at runtime in chat?

    • Passing the file via Power Automate as a file input to Code Interpreter?

    • Moving to a tabular/database connector (Dataverse/SQL) and querying instead?


    •  

  3. If Knowledge + Code Interpreter is not the right combination for full-file math, what's the best-practice architecture?


  4.  
 

I've confirmed all three files are indexed as "Files" (not connectors), and the data file has finished indexing. The governance/mapping logic works perfectly — the only blocker is getting the complete dataset into the compute step.

 

Any guidance or confirmation would be hugely appreciated. Thanks! 🙏

 

Tags: Copilot Studio, Code Interpreter, Knowledge Sources, Power Platform

Screenshot 2026-08-28 180140.png
I have the same question (0)
  • Verified answer
    Mohsin Ali Profile Picture
    680 on at
    Hello @CU28081217-4  - Your understanding is mostly correct for the way the files are currently configured. An uploaded file configured as an agent Knowledge source is primarily used for grounding/retrieval, so you shouldn't assume that Code Interpreter will always receive the complete underlying file when the knowledge search returns relevant content.
     
    However, Microsoft does support Code Interpreter analysis of structured data through two documented patterns:
    • An end user uploads the CSV/Excel file directly during the conversation.
    • A structured file is stored in a SharePoint Documents library configured as a knowledge source.
    Now for your case, I would suggest moving `AMTC_Insights_Data` to a SharePoint document library and adding that SharePoint location as the knowledge source. With Code Interpreter and Work IQ enabled, Copilot Studio can use Code Interpreter against structured files from the SharePoint knowledge source for calculations such as aggregations.
     
    However, if your dataset is a persistent manufacturing dataset and you require deterministic KPIs such as SUM, COUNT, AVG and date/group filtering, I would suggest treating it as structured business data rather than knowledge content.
     
    In that case, storing the records in Dataverse/Azure SQL and exposing an appropriate query/action to the agent would provide a more reliable architecture. Let the database/query layer calculate the KPI over the complete dataset and let the agent handle the natural-language interpretation and presentation of the result.
     
    Additionally, please refer below the best practices and the limitations of using code-interpretor. 

  • Mohsin Ali Profile Picture
    680 on at
    Hello @CU28081217-4 - Just wanted to follow-up if the suggestions shared above really help to sort out the issue or pointed in right direction.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Mohsin Ali Profile Picture

Mohsin Ali 237

#2
Dua Sadiq Profile Picture

Dua Sadiq 127

#3
11manish Profile Picture

11manish 102 Super User 2026 Season 2

Last 30 days Overall leaderboard