Share via

Microsoft Agent Framework: Copilot Studio Agent Provider Class Does Not Exist

Michael Zayed 0 Reputation points
2026-06-04T17:48:58.38+00:00

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.

Link: https://learn.microsoft.com/en-us/agent-framework/agents/providers/copilot-studio?pivots=programming-language-python

Azure OpenAI in Foundry Models

1 answer

Sort by: Most helpful
  1. AI answer

    2026-06-04T17:49:23.6033333+00:00

    In Python, CopilotStudioAgent is provided by the separate agent-framework-copilotstudio package and is imported from agent_framework.microsoft, not directly from agent_framework.

    To resolve the ModuleNotFoundError:

    1. Install the Copilot Studio provider package (note the --pre flag):
         pip install agent-framework-copilotstudio --pre
      
    2. 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())
      
    3. Set the required environment variables so CopilotStudioAgent can read its configuration:
         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>"
      
      (Use the appropriate syntax for the shell/OS in use.)

    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 conflicting agent_framework installation 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.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.