An Azure service that provides access to OpenAI’s GPT-3 models with enterprise capabilities.
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:
- 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 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: