Building, integrating, or customizing apps and workflows within Microsoft Teams using developer tools and APIs
By default, the Copilot middleware takes every single action your bot can perform and crams their full JSON descriptions into the hidden system prompt on every single turn. So, if you have more than a few actions, that hidden prompt gets so heavy that it starves the LLM of tokens, leaving absolutely no room for the actual chat history.
Given this, to fix this without breaking your bot's mapping logic, you basically need to put that system prompt on a strict diet. Here are the two cleanest ways to handle it:
- Dynamic action loading Don't load your entire function registry globally. Run a quick pre-check (like regex or a basic intent classifier) on the user's message, then only inject the specific actions relevant to that flow into the
ActionPlanner. - Minify your schemas Your
function.jsonfiles are token hogs. Strip all verbose text from your descriptions. Drop optional parameters and ensuremax_input_tokensis set inconfig.jsonso it safely truncates old chat history instead of crashing.
Hope this saves you some debugging time.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.