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 / Best Practices for Run...
Copilot Studio
Answered

Best Practices for Running Custom Code and Generating Outputs in Copilot Studio

(0) ShareShare
ReportReport
Posted on by 40

I have custom code stored in a GitHub repository that I would like to run. Given the limitations of Copilot Studio and AI Builder, I'm considering using an LLM API to generate images and to read Word documents or PDFs larger than 25MB.

What would be the best approach to run my custom code? For instance, would packaging it into a FastAPI and linking it through custom connectors be a viable solution? Additionally, if I want to display a generated picture within the Copilot Studio interface, is that possible?

I appreciate any insights or recommendations on how to achieve this.

Thank you!

I have the same question (0)
  • Suggested answer
    Romain The Low-Code Bearded Bear Profile Picture
    2,876 Super User 2026 Season 1 on at
    hello :) many question here , i will try to help for most of them (could you provide some clear information of what is the link in you'r case between reading document, AI builder, generating image, github etc.)
     
    AI builder have a 25mb limit for input file : true. 
    Copilot studio direct upload is 15mb.
    Copilot studio can read up to 512Mb file -> so you don't need a LLM to read file up to 512mb with copilot studio SharePoint Knowledge source.
     
    to display image there are many way wich work in the studio web IHM but if you target teams channel you need adaptive card
    here is a sample i snap from of my demo (sorry for the bear in the middle :D)
     
     
    To generate image you could use AI builder with Code generation enabled, it work very well : 
     
    And lastly when you have complexe document, very big, complexe image, etc : you don't need code, you could just use azure foundry as an index or agent with custom LLM
     
    And last if you real want to connect custom code there is a native MCP connexion tool in copilot studio, so just create whatever you want an expose it as a MCP
     
    click above on you will have this screen to connect
  • YJ-02010636-0 Profile Picture
    40 on at

    Thank you for the reply! Very helpful

    To clarify myself, I want to:

    1. Use Microsoft Teams as the primary UI

    2. Allow users to upload large files (PDF, Word, etc. — larger than AI Builder limits), which can be automatically stored in SharePoint

    3. Parse those complex files with custom Python code with GenAI APIs to return complex outputs:

      • structured text

      • generated documents

      • images / diagrams

    4. Render those outputs inside Teams

      Basically using Copilot Studio as an orchestrator, not the execution engine and just wondering if this is possible.
  • Verified answer
    Romain The Low-Code Bearded Bear Profile Picture
    2,876 Super User 2026 Season 1 on at
    ok thanks a lot :) so : there are few way to design the solution, but for Step 2 we have a little problem to overcome.
    Copilot studio input are limited to 15 mb for file. it below the 25mb of AI Builder.
     
    Step 1 : only if file under 15 mb with copilot studio
     
    So if my "large" file are under 25 mb but more thant 15mb : teams will not be an option sadly because the 15mb file for starting process what i will do : 
     
    Step 2 : Ask user to drop document in "drop" document library where my agent listen and will start OR will create an app to help user to give me the document that i will store inside sharepoint or dataverse
     
    Step 3 : use AI Builder Code interpretor (not enabled by default, need to click on "..." and enable it - if grey, it need to be enable in the admin environnement setting by admin power platform) : it could generate file, image, report, excel, what ever you need -> use this AI Builder from an agent or from an agent flow or from power automate :)
     
    Step 4 : if you need in teams you have connector to send message to teams. Since it could took some time to generate, if often tend to generate into a word document that i will store inside the one drive user. If it's fast, could send to the user by teams connector.
     
    -> how to overcome the file 15mb option in a copilot studio situation : 
    Don't use copilot studio chat : it's hard code lock by microsoft to 15mb at the moment.
    Use a sharepoint doc lib or power apps to upload much more bigger file.
    Send message to teams at the end. (i advice to start you'r test by trying to send image and message to teams and see if you like the resultat :) and then start to go deeper with AI builder etc.
     
    -> other option will need custom dev agent to be deployed to teams and those option need to be made carefully since most of those solution imply cloud solution with real time costing and a small error could cost a lot of money.
     

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Copilot Studio

#1
Valantis Profile Picture

Valantis 277

#2
11manish Profile Picture

11manish 206

#3
sannavajjala87 Profile Picture

sannavajjala87 156 Super User 2026 Season 1

Last 30 days Overall leaderboard