Microsoft Agent Framework: Copilot Studio Agent Provider Class Does Not Exist
Hi, I am currently exploring the Microsoft Agent Framework to develop an internal tool at the company I work for. I am trying to use Copilot Studio as the Provider for the Agent, but both the C# and Python versions of this class do not work. The required packages install correctly with dotnet and pip, but whenever I try to call the constructor, terminal says it does not exist.
Here is the error I got in the terminal in Python after downloading the package and including all necessary imports:
ModuleNotFoundError: The package agent-framework-copilotstudio is required to use CopilotStudioAgent. Please use pip install agent-framework-copilotstudio, or update your requirements.txt or pyproject.toml file.
I have also included the link to the documentation on the Microsoft Agent Framework Website. Thanks for your help, and I hope to hear from you soon.
-
Anshika Varshney 13,405 Reputation points β’ Microsoft External Staff β’ Moderator
-
Michael Zayed 0 Reputation points
Yes, I did have the chance to take a look at your feedback, and I did get it to work. Thank you!
-
Anshika Varshney 13,405 Reputation points β’ Microsoft External Staff β’ Moderator
Hello @Michael Zayed
Thank you for sharing the update I appreciate you taking the time to confirm the resolution!
Since Iβve converted comment into an answer, could you please take a moment to mark it as Accepted?
This helps others in the community with the same question find the solution more easily.
Thankyou!
Sign in to comment
2 answers
-
Anshika Varshney 13,405 Reputation points β’ Microsoft External Staff β’ Moderator
Hello @Michael Zayed
Thanks for sharing the details, this usually happens when the provider package is installed but not correctly recognized by the runtime or version.
Here are a few things to check:
- Make sure the package is installed in the correct environment For Python:
- Run
python -m pip install --upgrade pip - Then
python -m pip install --pre agent-framework-copilotstudio - Verify using
pip show agent-framework-copilotstudio
For .NET:
- Add the package using:
dotnet add package Microsoft.Agents.AI.CopilotStudio --prerelease - Verify with
dotnet list package
- Confirm the correct import/namespace The class will only be available if the correct module path is used. For example:
- Python:
from agent_framework.providers.copilotstudio import CopilotStudioAgent - C#:
using Microsoft.Agents.AI.CopilotStudio;
- Check preview/version compatibility This provider is still in preview, so:
- Make sure you are using the latest prerelease version
- Ensure Python/.NET SDK versions are compatible
- Restart your environment after installation (this is often required)
- Verify package actually contains the class Sometimes older versions of the package do not include this provider yet. If needed, reinstall or upgrade to the latest prerelease version.
If youβre still seeing the issue, it would help to share:
- Your Python version and
pip listoutput - The exact import statement you are using
- .NET SDK version (
dotnet --info) and package list - Full error message
This will help narrow down whether itβs an environment issue or a version mismatch.
Hope this helps. Do let me know if you have any further queries.
Thankyou!
-
AI answer
In Python,
CopilotStudioAgentis provided by the separateagent-framework-copilotstudiopackage and is imported fromagent_framework.microsoft, not directly fromagent_framework.To resolve the
ModuleNotFoundError:- Install the Copilot Studio provider package (note the
--preflag):pip install agent-framework-copilotstudio --pre - Ensure the code imports the correct type from the correct module:
import asyncio from agent_framework.microsoft import CopilotStudioAgent async def main(): agent = CopilotStudioAgent() result = await agent.run("What are our company policies on remote work?") print(result) asyncio.run(main()) - Set the required environment variables so
CopilotStudioAgentcan read its configuration:
(Use the appropriate syntax for the shell/OS in use.)set COPILOTSTUDIOAGENT__ENVIRONMENTID="<your-environment-id>" set COPILOTSTUDIOAGENT__SCHEMANAME="<your-agent-schema-name>" set COPILOTSTUDIOAGENT__AGENTAPPID="<your-client-id>" set COPILOTSTUDIOAGENT__TENANTID="<your-tenant-id>"
If the error still appears after installing with
--pre, verify that the environment where the script runs is the same one where the package was installed (for example, correct virtual environment or interpreter) and that there is no conflictingagent_frameworkinstallation without the Copilot Studio provider.For .NET, Copilot Studio is exposed as a provider within the Agent Framework; ensure the correct provider package is referenced and that the project targets the version of the Agent Framework that includes the Copilot Studio provider listed under the Providers Overview.
References:
AI-generated content may be incorrect. Read our transparency notes for more information. - Install the Copilot Studio provider package (note the
