Goal: Connect specialized Foundry Agents to Copilot Studio Orchestrator for seamless Teams and M365 Copilot integration of conversational Agents.
Environment:
-
Copilot Studio Orchestrator Agent connected to two specialized backend Foundry Agents through the built in connect to an external agent tab
-
Agents --> Add an Agent --> Connect to an external agent -->Microsoft Foundry
-
-
Copilot Studio Orchestrator Agent is published and added to M365 Copilot and Microsoft Teams channels.
-
Connect to an external agent Auth is through Microsoft Entra using makers credentials to prevent connection requests.
Simplified Error/Problem Explanation:
These errors DO NOT OCCUR in Copilot Studio Test Environment but in the published Teams/M365 Channel.
These errors only occur when the Copilot Studio Orchestrator Agent calls a backend Foundry Agent and the output is returned directly to Teams/M365. Queries exchanged directly with the Orchestrator work great and do not produce any errors.
-
Microsoft Teams Error: "Sorry, something unexpected happened. We’re looking into it. Error code: SystemError. Conversation ID:"
-
This will occur when the Foundry Agent returns its output to the Copilot Studio Orchestrator Agent. The returned Foundry Agent output is directly sent through to the Teams environment. This produces an error in Teams but not in the activity logs.
-
The agent assumes that the user has seen this output (because it does not receive the SystemError) and will not represent the output unless directly prompted in it's system instructions or by the user.
-
If told to re-present the backend Foundry output, the SystemError is still present but the agent will follow up with a summary of the output where it does not produce an error because it is coming straight from the Copilot Orchestrator.
-
-
M365 Copilot 'Error': "Sorry, I wasn't able to respond to that. Is there something else I can help with?"
-
Presents this message on every query that involves a backend Foundry agent call.
-
Will not automatically represent the data if instructed in the orchestrator instructions. Requires a manual request.
-
The problem seems to come from how backend Foundry Agents outputs are handled by Copilot Studio. Instead of passing through the orchestrator first, they are directly returned as an output (ideal in normal scenarios but not when it creates errors). This seems like it was designed this way because the Orchestrator Instructions do not control how the Foundry Agents output is presented.
This makes me believe that there is a problem with the raw Foundry Agent output being exposed to Teams and M365 Copilot. Since this built in connection type doesn't provide control over the output, like it does for Child Agents, I am unsure on how to solve this error.
Detailed Errors/Problem:
The Foundry Agent connections return a 'text'/json output to Copilot Studio Orchestrator on request. In the activity logs it shows that Azure AI Foundry automatically returns the data. The Copilot Orchestra Agent knows that this data was presented. The problem is that on the users end in Teams or M365 Copilot we don't see this data but instead receive an error. We can see the Foundry Agent outputted data in logs or in the 'Test your agent' environment in Copilot Studio but it does not appear in Teams or M365. Instead it throws a system error which the orchestrator agent does not receive since it is coming from Teams.
Microsoft Teams Error:
"Sorry, something unexpected happened. We’re looking into it. Error code: SystemError. Conversation ID:"
This error is produced in Teams and not from the backend Foundry agent output. You must prompt the orchestra agent to reproduce the output from the backend Foundry agent and it will produce it properly as a summary. The raw output from Azure Foundry through the built in connection is not compatible with Teams or M365.
The connection type between Foundry and Copilot is in preview, therefore this might be a temporary bug but there is no thread or documentation about this lack of functionality or error. The system error is documented but does not include this problem or a fix for it.
M365 Copilot 'Error':
"Sorry, I wasn't able to respond to that. Is there something else I can help with?"
M365 will automatically return this message when prompting a backend Foundry Agent. It will continue returning this with each query until Copilot Studio is finished calling the Foundry Agent. Then it will also assume that the data was presented (since it has it in it's activity logs but fails to present it on the UI). The only way to get it to present the data is to ask the agent to represent the data it just grabbed or found. It will not do this automatically (where it must be present in instructions) like in Teams.
You don't see these errors in the test environment in Copilot studio and originally the backend Foundry Agent information was being presented to the 'Test your agent' environment. My assumption is that there is a problem between Teams and M365 and Foundry output. I have found no work around in M365 but it seems like in Teams you can emphasize in the instructions that the orchestrator agents need to reproduce the output from the backend agent. It will then produce the provided error then produce a summarized version of the backend agent output.
Attempted Fixes:
-
Adjusted system prompt to not present Foundry data, represent Foundry data when ever it receives it (produces error but displays output)
-
Change Foundry Agent output from text to json, testing different formats.
-
Attempted to create other Copilot Agents to accept the Foundry output and connect those to the orchestrator.
-
Republishing
-
Removing and adding the Teams/M365 Copilot Channel
-
Removing and adding Agent in Teams Admin Section
-
Simplifying the backend Foundry Agent
Additional Material:
-
I found this post about "Integrate Custom Azure AI Agents with Copilot Studio and M365 Copilot": https://techcommunity.microsoft.com/blog/azure-ai-foundry-blog/integrate-custom-azure-ai-agents-with-copilot-studio-and-m365-copilot/4405070 But it is a year old so I am unsure if this is still best practice.
-
Link to known 'SystemError' issues: https://learn.microsoft.com/en-us/microsoft-copilot-studio/publication-add-bot-to-microsoft-teams#systemerror-after-publishing-or-republishing-an-agent
There seems to be some guides on setting up this connection but non that actually include an actual implementations with provided channels.
I am most curious about the standard for connecting Foundry agents to a Copilot Studio Orchestrator. Is there a standard practice to do this or is this preview connector the only current available functionality to implement this? Any suggestions or guidance on how to get rid of this system error or control the Foundry connection output would be greatly appreciated. Happy to answer any questions! Thanks.

Report
All responses (
Answers (