This release is a pre-release and may not be stable for production use.
Microsoft Agents Copilot Studio Client
The Copilot Studio Client is for connecting to and interacting with agents created in Microsoft Copilot Studio. This library allows you to integrate Copilot Studio agents into your Python applications.
This client library provides a direct connection to Copilot Studio agents, bypassing traditional chat channels. It's perfect for integrating AI conversations into your applications, building custom UIs, or creating agent-to-agent communication flows.
What is this?
This library is part of the Microsoft 365 Agents SDK for Python - a comprehensive framework for building enterprise-grade conversational AI agents. The SDK enables developers to create intelligent agents that work across multiple platforms including Microsoft Teams, M365 Copilot, Copilot Studio, and web chat, with support for third-party integrations like Slack, Facebook Messenger, and Twilio.
Release Notes
| Version | Date | Release Notes |
|---|---|---|
| 0.5.0 | 2025-10-22 | 0.5.0 Release Notes |
Packages Overview
We offer the following PyPI packages to create conversational experiences based on Agents:
Additionally we provide a Copilot Studio Client, to interact with Agents created in CopilotStudio:
| Package Name | PyPI Version | Description |
|---|---|---|
microsoft-agents-copilotstudio-client |
Direct to Engine client to interact with Agents created in CopilotStudio |
Installation
pip install microsoft-agents-copilotstudio-client
Quick Start
Basic Setup
Code below from the main.py in the Copilot Studio Client
def create_client():
settings = ConnectionSettings(
environment_id=environ.get("COPILOTSTUDIOAGENT__ENVIRONMENTID"),
agent_identifier=environ.get("COPILOTSTUDIOAGENT__SCHEMANAME"),
cloud=None,
copilot_agent_type=None,
custom_power_platform_cloud=None,
)
token = acquire_token(
settings,
app_client_id=environ.get("COPILOTSTUDIOAGENT__AGENTAPPID"),
tenant_id=environ.get("COPILOTSTUDIOAGENT__TENANTID"),
)
copilot_client = CopilotClient(settings, token)
return copilot_client
Start a Conversation
The code below is summarized from the main.py in the Copilot Studio Client. See that sample for complete & working code.
copilot_client = create_client()
act = copilot_client.start_conversation(True)
...
replies = copilot_client.ask_question("Who are you?", conversation_id)
async for reply in replies:
if reply.type == ActivityTypes.message:
print(f"\n{reply.text}")
Environment Variables
Set up your .env file:
# Required
ENVIRONMENT_ID=your-power-platform-environment-id
AGENT_IDENTIFIER=your-copilot-studio-agent-id
APP_CLIENT_ID=your-azure-app-client-id
TENANT_ID=your-azure-tenant-id
# Optional
CLOUD=PROD
COPILOT_AGENT_TYPE=PUBLISHED
CUSTOM_POWER_PLATFORM_CLOUD=your-custom-cloud.com
Features
✅ Real-time streaming - Server-sent events for live responses
✅ Multi-cloud support - Works across all Power Platform clouds
✅ Rich content - Support for cards, actions, and attachments
✅ Conversation management - Maintain context across interactions
✅ Custom activities - Send structured data to agents
✅ Async/await - Modern Python async support
Troubleshooting
Common Issues
Authentication failed
- Verify your app is registered in Azure AD
- Check that token has
https://api.powerplatform.com/.defaultscope - Ensure your app has permissions to the Power Platform environment
Agent not found
- Verify the environment ID and agent identifier
- Check that the agent is published and accessible
- Confirm you're using the correct cloud setting
Connection timeout
- Check network connectivity to Power Platform
- Verify firewall settings allow HTTPS traffic
- Try a different cloud region if available
Requirements
- Python 3.10+ (supports 3.10, 3.11, 3.12, 3.13, 3.14)
- Valid Azure AD app registration
- Access to Microsoft Power Platform environment
- Published Copilot Studio agent
Quick Links
Sample Applications
| Name | Description | README |
|---|---|---|
| Quickstart | Simplest agent | Quickstart |
| Auto Sign In | Simple OAuth agent using Graph and GitHub | auto-signin |
| OBO Authorization | OBO flow to access a Copilot Studio Agent | obo-authorization |
| Semantic Kernel Integration | A weather agent built with Semantic Kernel | semantic-kernel-multiturn |
| Streaming Agent | Streams OpenAI responses | azure-ai-streaming |
| Copilot Studio Client | Console app to consume a Copilot Studio Agent | copilotstudio-client |
| Cards Agent | Agent that uses rich cards to enhance conversation design | cards |
Metadata
Release files for microsoft-agents-copilotstudio-client 0.6.0.dev9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| microsoft_agents_copilotstudio_client-0.6.0.dev9.tar.gz | 11.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| microsoft_agents_copilotstudio_client-0.6.0.dev9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.3 kB
Release files / microsoft_agents_copilotstudio_client-0.6.0.dev9.tar.gz
| Download URL | microsoft_agents_copilotstudio_client-0.6.0.dev9.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
533b5396754344be8cbc28778b4ef25d45ee21bec2fd9fa0518be859603303b5
|
|
BLAKE2b-256 checksum How to use checksums |
2614467626de63dc5937ffb63bbb3ccfbe565790d3c5788aa5309da9c11958ed
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|
Release files / microsoft_agents_copilotstudio_client-0.6.0.dev9-py3-none-any.whl
| Download URL | microsoft_agents_copilotstudio_client-0.6.0.dev9-py3-none-any.whl |
|---|---|
| Size | 11.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
837faa1e5a1cb7f88d349235130eb6f2fc1a5d9cabab26cdc8db3f388b4f4b74
|
|
BLAKE2b-256 checksum How to use checksums |
387db24490fbfd6938bfc4fedef88577d7f9c5cb7bc9be137de789b22f70ea11
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
RestSharp/106.13.0.0
|