Registry / aws / agent-framework-copilotstudio

agent-framework-copilotstudio

JSON →
library1.0.0b260409pypypiunverified

The `agent-framework-copilotstudio` library provides a Python integration for connecting to Microsoft Copilot Studio agents using the Microsoft Agent Framework. It enables developers to build, orchestrate, and deploy AI agents and multi-agent workflows, supporting both low-code Copilot Studio agents and custom Python agents. The library is actively maintained, with frequent preview releases (indicated by 'b' in version numbers), and is part of Microsoft's broader Agent Framework ecosystem.

awstype-stubs
pip install agent-framework-copilotstudio --pre
Install & Compatibility
Where this runs
tested against v1.0.0b260521 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✓ —
✓ 5.58s
py 3.11
✓ —
✓ 4.73s
py 3.12
✓ —
✓ 4s
py 3.13
✓ —
✓ 4.03s
py 3.9
✕ build_error
✕ build_error
40MB installed
● package 40MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CopilotStudioAgent
from agent_framework.microsoft import CopilotStudioAgent

This quickstart demonstrates how to initialize and interact with a `CopilotStudioAgent`. It assumes the necessary environment variables (`COPILOTSTUDIOAGENT__ENVIRONMENTID`, `COPILOTSTUDIOAGENT__SCHEMANAME`, `COPILOTSTUDIOAGENT__AGENTAPPID`, `COPILOTSTUDIOAGENT__TENANTID`) are configured for authentication and agent identification. The example includes both a standard `run` command and a streaming `run` for real-time responses.

import asyncio import os # Ensure these environment variables are set before running: # COPILOTSTUDIOAGENT__ENVIRONMENTID="Default-<guid>" # COPILOTSTUDIOAGENT__SCHEMANAME="<your-agent-schema-name>" # COPILOTSTUDIOAGENT__AGENTAPPID="<your-client-id>" # COPILOTSTUDIOAGENT__TENANTID="<your-tenant-id>" # Example of how you might get them (replace with actual secure methods in production) # os.environ['COPILOTSTUDIOAGENT__ENVIRONMENTID'] = os.environ.get('COPILOTSTUDIOAGENT__ENVIRONMENTID', '') # os.environ['COPILOTSTUDIOAGENT__SCHEMANAME'] = os.environ.get('COPILOTSTUDIOAGENT__SCHEMANAME', '') # os.environ['COPILOTSTUDIOAGENT__AGENTAPPID'] = os.environ.get('COPILOTSTUDIOAGENT__AGENTAPPID', '') # os.environ['COPILOTSTUDIOAGENT__TENANTID'] = os.environ.get('COPILOTSTUDIOAGENT__TENANTID', '') from agent_framework.microsoft import CopilotStudioAgent async def main(): try: agent = CopilotStudioAgent() print(f"Agent initialized with Environment ID: {os.environ.get('COPILOTSTUDIOAGENT__ENVIRONMENTID', 'Not Set')}") print("Sending query to Copilot Studio agent...") result = await agent.run("What are our company policies on remote work?") print(f"Agent response: {result}") print("\nStreaming example:") print("Agent (streaming): ", end="", flush=True) async for chunk in agent.run("What is the largest city in France?", stream=True): if chunk.text: print(chunk.text, end="", flush=True) print() except Exception as e: print(f"An error occurred: {e}") print("Please ensure all required environment variables are set and your Copilot Studio agent is correctly configured and published.") if __name__ == "__main__": asyncio.run(main())
Debug
Known issues
gotchaIncorrect or missing environment variables will prevent the agent from connecting. Ensure `COPILOTSTUDIOAGENT__ENVIRONMENTID` (format: `Default-<guid>`), `COPILOTSTUDIOAGENT__SCHEMANAME`, `COPILOTSTUDIOAGENT__AGENTAPPID`, and `COPILOTSTUDIOAGENT__TENANTID` are correctly set and accessible to your application. Your Copilot Studio agent must also be published and accessible in the Power Platform Admin Center.
fix
Verify all required environment variables are correctly defined. Confirm your Azure AD app registration has public client flows enabled, necessary Power Platform API permissions, and admin consent. Ensure the Copilot Studio agent is published and its environment ID is in the `Default-<guid>` format.
affects: All versions
gotchaVague or overly short topic model descriptions in Copilot Studio can lead to poor agent performance and misinterpretation of user intents. The generative orchestration relies heavily on clear and descriptive topic descriptions.
fix
Provide detailed and unambiguous topic descriptions within Copilot Studio, focusing on outcomes rather than just features. This helps the underlying large language model correctly route user queries.
affects: All versions
gotchaWhen deploying Copilot Studio agents within Application Lifecycle Management (ALM) solutions, new agent components (like topics or tools) might not be automatically included in the solution. This can lead to missing or outdated components in new environments.
fix
Always manually add new agent components to your solution after creation. Although you may create an agent within the solution's context, new sub-components often require explicit inclusion.
affects: All versions
gotchaMultilevel agent chaining is not supported, which can limit complex multi-agent orchestration scenarios.
fix
Design multi-agent systems to avoid direct multilevel chaining. Consider alternative orchestration patterns or single-level interactions where a primary agent delegates to other agents without deep nesting.
affects: All versions
gotchaData loss prevention (DLP) errors can occur if connectors used by the agent are not in the same data group or are blocked by the tenant administrator.
fix
Review your Power Platform data policies. Ensure all connectors utilized by your Copilot Studio agent are allowed and configured within the appropriate data groups to prevent DLP violations. Consult with your Power Platform administrator if necessary.
affects: All versions
Upgrade
Version history
1.0.0b260521latest on PyPI
Audit
Dependencies
python-dotenvrequiredUsed for managing environment variables for configuration.
aiohttprequiredUsed for asynchronous HTTP requests, likely for communication with Copilot Studio APIs.
Agent activity
93 hits · last 30 days
node
12
claudebot
4
ahrefsbot
3
amazonbot
1
Resources