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 / Enabling Code Interpreter
Copilot Studio
Answered

Enabling Code Interpreter

(1) ShareShare
ReportReport
Posted on by 25

Hello everyone,

 

I have enabled Code Interpreter on a couple of agents I am currently working on, and I am seeing inconsistent behaviour that I am trying to understand.

Agent A


  • Code Interpreter is enabled at the agent level

  • No prompt tools and no flows explicitly invoking Code Interpreter

  • I have only added/tuned the agent instructions

  • This works extremely well:

    • It creates Python‑based visualisations

    • Charts are rendered correctly both in Copilot Studio canvas and in Teams

    • In Teams, I’m prompted for permission to upload the chart to OneDrive, and once accepted:

      • The visual is rendered in chat

      • A copy is stored in my OneDrive 

  •  

Agent B

 

  • Code Interpreter is also enabled at the agent level

  • I copied the Code Interpreter‑related instructions from Agent A and pasted it on this agent.

  • However, rendering does not work in this agent


  •  

Some additional context:


     
  • Both agents have a similar overall architecture

  • Both use flows to retrieve data from SQL Server

  • Agent B has two additional flows compared to Agent A

  • Knowledge sources:

    • Agent A: none

    • Agent B: SQL tables added as knowledge (in addition to flows), mainly to provide a semantic layer

 my questions are:

I’m essentially trying to understand whether I’ve:


  • Bumped into something that “just works” in Agent A, or

  • Whether differences in instructions, flows, or knowledge sources can realistically change the model’s decision to invoke Code Interpreter.
 
  • Is Agent A working because the instructions are sufficient to make the model consistently trigger Code Interpreter?

  • Is this behaviour expected but inherently non‑deterministic?

  • Or should I assume that the most robust and supported approach is to always use a Prompt tool (with Code Interpreter enabled) invoked from a flow, even if agent‑level instructions sometimes appear to be enough?


  •  
 
Thank you!
 
 
 
I have the same question (0)
  • Verified answer
    rezarizvii Profile Picture
    333 on at
    Hi, hope you are doing well.
     
    This is expected behavior. The model decides when to invoke Code Interpreter, and that decision can change based on the overall context of the agent.
     
    In your case, Agent B has more inputs (knowledge sources + additional flows), so the model has alternative ways to respond. Because of that, it may choose not to invoke Code Interpreter as often as Agent A.
     
    Agent A works more consistently because the setup is simpler, so the model leans toward using Code Interpreter.
     
    To answer your questions directly:
    • Yes, differences in instructions, flows, and knowledge sources can affect whether Code Interpreter is invoked
    • Yes, this behavior is inherently non-deterministic
    • For consistent results, the more reliable approach is to use a Prompt tool with Code Interpreter enabled and call it from a flow rather than relying only on agent-level instructions
     
    Please  Does this answer your question if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider answering Yes to Was this reply helpful? or give it a Like! 🩷
    _______________________________
    Reza M. Rizvi
    Reza M. Rizvi
    LinkedIn  |  Email

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 624

#2
Vish WR Profile Picture

Vish WR 181

#3
Haque Profile Picture

Haque 180

Last 30 days Overall leaderboard