microsoft-agents-copilotstudio-client 0.4.0.dev18__tar.gz → 0.5.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- microsoft_agents_copilotstudio_client-0.5.0/LICENSE +21 -0
- microsoft_agents_copilotstudio_client-0.5.0/PKG-INFO +184 -0
- {microsoft_agents_copilotstudio_client-0.4.0.dev18 → microsoft_agents_copilotstudio_client-0.5.0}/microsoft_agents/copilotstudio/client/copilot_client.py +6 -0
- microsoft_agents_copilotstudio_client-0.5.0/microsoft_agents_copilotstudio_client.egg-info/PKG-INFO +184 -0
- {microsoft_agents_copilotstudio_client-0.4.0.dev18 → microsoft_agents_copilotstudio_client-0.5.0}/microsoft_agents_copilotstudio_client.egg-info/SOURCES.txt +2 -0
- microsoft_agents_copilotstudio_client-0.5.0/microsoft_agents_copilotstudio_client.egg-info/requires.txt +1 -0
- {microsoft_agents_copilotstudio_client-0.4.0.dev18 → microsoft_agents_copilotstudio_client-0.5.0}/pyproject.toml +9 -2
- microsoft_agents_copilotstudio_client-0.5.0/readme.md +163 -0
- microsoft_agents_copilotstudio_client-0.4.0.dev18/PKG-INFO +0 -12
- microsoft_agents_copilotstudio_client-0.4.0.dev18/microsoft_agents_copilotstudio_client.egg-info/PKG-INFO +0 -12
- microsoft_agents_copilotstudio_client-0.4.0.dev18/microsoft_agents_copilotstudio_client.egg-info/requires.txt +0 -1
- {microsoft_agents_copilotstudio_client-0.4.0.dev18 → microsoft_agents_copilotstudio_client-0.5.0}/microsoft_agents/copilotstudio/client/__init__.py +0 -0
- {microsoft_agents_copilotstudio_client-0.4.0.dev18 → microsoft_agents_copilotstudio_client-0.5.0}/microsoft_agents/copilotstudio/client/agent_type.py +0 -0
- {microsoft_agents_copilotstudio_client-0.4.0.dev18 → microsoft_agents_copilotstudio_client-0.5.0}/microsoft_agents/copilotstudio/client/connection_settings.py +0 -0
- {microsoft_agents_copilotstudio_client-0.4.0.dev18 → microsoft_agents_copilotstudio_client-0.5.0}/microsoft_agents/copilotstudio/client/direct_to_engine_connection_settings_protocol.py +0 -0
- {microsoft_agents_copilotstudio_client-0.4.0.dev18 → microsoft_agents_copilotstudio_client-0.5.0}/microsoft_agents/copilotstudio/client/execute_turn_request.py +0 -0
- {microsoft_agents_copilotstudio_client-0.4.0.dev18 → microsoft_agents_copilotstudio_client-0.5.0}/microsoft_agents/copilotstudio/client/power_platform_cloud.py +0 -0
- {microsoft_agents_copilotstudio_client-0.4.0.dev18 → microsoft_agents_copilotstudio_client-0.5.0}/microsoft_agents/copilotstudio/client/power_platform_environment.py +0 -0
- {microsoft_agents_copilotstudio_client-0.4.0.dev18 → microsoft_agents_copilotstudio_client-0.5.0}/microsoft_agents_copilotstudio_client.egg-info/dependency_links.txt +0 -0
- {microsoft_agents_copilotstudio_client-0.4.0.dev18 → microsoft_agents_copilotstudio_client-0.5.0}/microsoft_agents_copilotstudio_client.egg-info/top_level.txt +0 -0
- {microsoft_agents_copilotstudio_client-0.4.0.dev18 → microsoft_agents_copilotstudio_client-0.5.0}/setup.cfg +0 -0
- {microsoft_agents_copilotstudio_client-0.4.0.dev18 → microsoft_agents_copilotstudio_client-0.5.0}/setup.py +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: microsoft-agents-copilotstudio-client
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: A client library for Microsoft Agents
|
|
5
|
+
Author: Microsoft Corporation
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/microsoft/Agents
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: microsoft-agents-hosting-core==0.5.0
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
Dynamic: requires-dist
|
|
21
|
+
|
|
22
|
+
# Microsoft Agents Copilot Studio Client
|
|
23
|
+
|
|
24
|
+
[](https://pypi.org/project/microsoft-agents-copilotstudio-client/)
|
|
25
|
+
|
|
26
|
+
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.
|
|
27
|
+
|
|
28
|
+
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.
|
|
29
|
+
|
|
30
|
+
# What is this?
|
|
31
|
+
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.
|
|
32
|
+
|
|
33
|
+
## Release Notes
|
|
34
|
+
<table style="width:100%">
|
|
35
|
+
<tr>
|
|
36
|
+
<th style="width:20%">Version</th>
|
|
37
|
+
<th style="width:20%">Date</th>
|
|
38
|
+
<th style="width:60%">Release Notes</th>
|
|
39
|
+
</tr>
|
|
40
|
+
<tr>
|
|
41
|
+
<td>0.5.0</td>
|
|
42
|
+
<td>2025-10-22</td>
|
|
43
|
+
<td>
|
|
44
|
+
<a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md">
|
|
45
|
+
0.5.0 Release Notes
|
|
46
|
+
</a>
|
|
47
|
+
</td>
|
|
48
|
+
</tr>
|
|
49
|
+
</table>
|
|
50
|
+
|
|
51
|
+
## Packages Overview
|
|
52
|
+
|
|
53
|
+
We offer the following PyPI packages to create conversational experiences based on Agents:
|
|
54
|
+
|
|
55
|
+
| Package Name | PyPI Version | Description |
|
|
56
|
+
|--------------|-------------|-------------|
|
|
57
|
+
| `microsoft-agents-activity` | [](https://pypi.org/project/microsoft-agents-activity/) | Types and validators implementing the Activity protocol spec. |
|
|
58
|
+
| `microsoft-agents-hosting-core` | [](https://pypi.org/project/microsoft-agents-hosting-core/) | Core library for Microsoft Agents hosting. |
|
|
59
|
+
| `microsoft-agents-hosting-aiohttp` | [](https://pypi.org/project/microsoft-agents-hosting-aiohttp/) | Configures aiohttp to run the Agent. |
|
|
60
|
+
| `microsoft-agents-hosting-teams` | [](https://pypi.org/project/microsoft-agents-hosting-teams/) | Provides classes to host an Agent for Teams. |
|
|
61
|
+
| `microsoft-agents-storage-blob` | [](https://pypi.org/project/microsoft-agents-storage-blob/) | Extension to use Azure Blob as storage. |
|
|
62
|
+
| `microsoft-agents-storage-cosmos` | [](https://pypi.org/project/microsoft-agents-storage-cosmos/) | Extension to use CosmosDB as storage. |
|
|
63
|
+
| `microsoft-agents-authentication-msal` | [](https://pypi.org/project/microsoft-agents-authentication-msal/) | MSAL-based authentication for Microsoft Agents. |
|
|
64
|
+
|
|
65
|
+
Additionally we provide a Copilot Studio Client, to interact with Agents created in CopilotStudio:
|
|
66
|
+
|
|
67
|
+
| Package Name | PyPI Version | Description |
|
|
68
|
+
|--------------|-------------|-------------|
|
|
69
|
+
| `microsoft-agents-copilotstudio-client` | [](https://pypi.org/project/microsoft-agents-copilotstudio-client/) | Direct to Engine client to interact with Agents created in CopilotStudio |
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
## Installation
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install microsoft-agents-copilotstudio-client
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Quick Start
|
|
79
|
+
|
|
80
|
+
### Basic Setup
|
|
81
|
+
|
|
82
|
+
Code below from the [main.py in the Copilot Studio Client](https://github.com/microsoft/Agents/blob/main/samples/python/copilotstudio-client/src/main.py)
|
|
83
|
+
```python
|
|
84
|
+
def create_client():
|
|
85
|
+
settings = ConnectionSettings(
|
|
86
|
+
environment_id=environ.get("COPILOTSTUDIOAGENT__ENVIRONMENTID"),
|
|
87
|
+
agent_identifier=environ.get("COPILOTSTUDIOAGENT__SCHEMANAME"),
|
|
88
|
+
cloud=None,
|
|
89
|
+
copilot_agent_type=None,
|
|
90
|
+
custom_power_platform_cloud=None,
|
|
91
|
+
)
|
|
92
|
+
token = acquire_token(
|
|
93
|
+
settings,
|
|
94
|
+
app_client_id=environ.get("COPILOTSTUDIOAGENT__AGENTAPPID"),
|
|
95
|
+
tenant_id=environ.get("COPILOTSTUDIOAGENT__TENANTID"),
|
|
96
|
+
)
|
|
97
|
+
copilot_client = CopilotClient(settings, token)
|
|
98
|
+
return copilot_client
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Start a Conversation
|
|
102
|
+
The code below is summarized from the [main.py in the Copilot Studio Client](https://github.com/microsoft/Agents/blob/main/samples/python/copilotstudio-client/src/main.py). See that sample for complete & working code.
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
copilot_client = create_client()
|
|
106
|
+
act = copilot_client.start_conversation(True)
|
|
107
|
+
|
|
108
|
+
...
|
|
109
|
+
|
|
110
|
+
replies = copilot_client.ask_question("Who are you?", conversation_id)
|
|
111
|
+
async for reply in replies:
|
|
112
|
+
if reply.type == ActivityTypes.message:
|
|
113
|
+
print(f"\n{reply.text}")
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Environment Variables
|
|
117
|
+
Set up your `.env` file:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Required
|
|
121
|
+
ENVIRONMENT_ID=your-power-platform-environment-id
|
|
122
|
+
AGENT_IDENTIFIER=your-copilot-studio-agent-id
|
|
123
|
+
APP_CLIENT_ID=your-azure-app-client-id
|
|
124
|
+
TENANT_ID=your-azure-tenant-id
|
|
125
|
+
|
|
126
|
+
# Optional
|
|
127
|
+
CLOUD=PROD
|
|
128
|
+
COPILOT_AGENT_TYPE=PUBLISHED
|
|
129
|
+
CUSTOM_POWER_PLATFORM_CLOUD=your-custom-cloud.com
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Features
|
|
133
|
+
|
|
134
|
+
✅ **Real-time streaming** - Server-sent events for live responses
|
|
135
|
+
✅ **Multi-cloud support** - Works across all Power Platform clouds
|
|
136
|
+
✅ **Rich content** - Support for cards, actions, and attachments
|
|
137
|
+
✅ **Conversation management** - Maintain context across interactions
|
|
138
|
+
✅ **Custom activities** - Send structured data to agents
|
|
139
|
+
✅ **Async/await** - Modern Python async support
|
|
140
|
+
|
|
141
|
+
## Troubleshooting
|
|
142
|
+
|
|
143
|
+
### Common Issues
|
|
144
|
+
|
|
145
|
+
**Authentication failed**
|
|
146
|
+
- Verify your app is registered in Azure AD
|
|
147
|
+
- Check that token has `https://api.powerplatform.com/.default` scope
|
|
148
|
+
- Ensure your app has permissions to the Power Platform environment
|
|
149
|
+
|
|
150
|
+
**Agent not found**
|
|
151
|
+
- Verify the environment ID and agent identifier
|
|
152
|
+
- Check that the agent is published and accessible
|
|
153
|
+
- Confirm you're using the correct cloud setting
|
|
154
|
+
|
|
155
|
+
**Connection timeout**
|
|
156
|
+
- Check network connectivity to Power Platform
|
|
157
|
+
- Verify firewall settings allow HTTPS traffic
|
|
158
|
+
- Try a different cloud region if available
|
|
159
|
+
|
|
160
|
+
## Requirements
|
|
161
|
+
|
|
162
|
+
- Python 3.10+ (supports 3.10, 3.11, 3.12, 3.13, 3.14)
|
|
163
|
+
- Valid Azure AD app registration
|
|
164
|
+
- Access to Microsoft Power Platform environment
|
|
165
|
+
- Published Copilot Studio agent
|
|
166
|
+
|
|
167
|
+
# Quick Links
|
|
168
|
+
|
|
169
|
+
- 📦 [All SDK Packages on PyPI](https://pypi.org/search/?q=microsoft-agents)
|
|
170
|
+
- 📖 [Complete Documentation](https://aka.ms/agents)
|
|
171
|
+
- 💡 [Python Samples Repository](https://github.com/microsoft/Agents/tree/main/samples/python)
|
|
172
|
+
- 🐛 [Report Issues](https://github.com/microsoft/Agents-for-python/issues)
|
|
173
|
+
|
|
174
|
+
# Sample Applications
|
|
175
|
+
|
|
176
|
+
|Name|Description|README|
|
|
177
|
+
|----|----|----|
|
|
178
|
+
|Quickstart|Simplest agent|[Quickstart](https://github.com/microsoft/Agents/blob/main/samples/python/quickstart/README.md)|
|
|
179
|
+
|Auto Sign In|Simple OAuth agent using Graph and GitHub|[auto-signin](https://github.com/microsoft/Agents/blob/main/samples/python/auto-signin/README.md)|
|
|
180
|
+
|OBO Authorization|OBO flow to access a Copilot Studio Agent|[obo-authorization](https://github.com/microsoft/Agents/blob/main/samples/python/obo-authorization/README.md)|
|
|
181
|
+
|Semantic Kernel Integration|A weather agent built with Semantic Kernel|[semantic-kernel-multiturn](https://github.com/microsoft/Agents/blob/main/samples/python/semantic-kernel-multiturn/README.md)|
|
|
182
|
+
|Streaming Agent|Streams OpenAI responses|[azure-ai-streaming](https://github.com/microsoft/Agents/blob/main/samples/python/azureai-streaming/README.md)|
|
|
183
|
+
|Copilot Studio Client|Console app to consume a Copilot Studio Agent|[copilotstudio-client](https://github.com/microsoft/Agents/blob/main/samples/python/copilotstudio-client/README.md)|
|
|
184
|
+
|Cards Agent|Agent that uses rich cards to enhance conversation design |[cards](https://github.com/microsoft/Agents/blob/main/samples/python/cards/README.md)|
|
|
@@ -35,6 +35,12 @@ class CopilotClient:
|
|
|
35
35
|
raise aiohttp.ClientError(
|
|
36
36
|
f"Error sending request: {response.status}"
|
|
37
37
|
)
|
|
38
|
+
|
|
39
|
+
# Set conversation ID from response header when status is 200
|
|
40
|
+
conversation_id_header = response.headers.get("x-ms-conversationid")
|
|
41
|
+
if conversation_id_header:
|
|
42
|
+
self._current_conversation_id = conversation_id_header
|
|
43
|
+
|
|
38
44
|
event_type = None
|
|
39
45
|
async for line in response.content:
|
|
40
46
|
if line.startswith(b"event:"):
|
microsoft_agents_copilotstudio_client-0.5.0/microsoft_agents_copilotstudio_client.egg-info/PKG-INFO
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: microsoft-agents-copilotstudio-client
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: A client library for Microsoft Agents
|
|
5
|
+
Author: Microsoft Corporation
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/microsoft/Agents
|
|
8
|
+
Classifier: Programming Language :: Python :: 3
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Requires-Python: >=3.10
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
Requires-Dist: microsoft-agents-hosting-core==0.5.0
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
Dynamic: requires-dist
|
|
21
|
+
|
|
22
|
+
# Microsoft Agents Copilot Studio Client
|
|
23
|
+
|
|
24
|
+
[](https://pypi.org/project/microsoft-agents-copilotstudio-client/)
|
|
25
|
+
|
|
26
|
+
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.
|
|
27
|
+
|
|
28
|
+
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.
|
|
29
|
+
|
|
30
|
+
# What is this?
|
|
31
|
+
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.
|
|
32
|
+
|
|
33
|
+
## Release Notes
|
|
34
|
+
<table style="width:100%">
|
|
35
|
+
<tr>
|
|
36
|
+
<th style="width:20%">Version</th>
|
|
37
|
+
<th style="width:20%">Date</th>
|
|
38
|
+
<th style="width:60%">Release Notes</th>
|
|
39
|
+
</tr>
|
|
40
|
+
<tr>
|
|
41
|
+
<td>0.5.0</td>
|
|
42
|
+
<td>2025-10-22</td>
|
|
43
|
+
<td>
|
|
44
|
+
<a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md">
|
|
45
|
+
0.5.0 Release Notes
|
|
46
|
+
</a>
|
|
47
|
+
</td>
|
|
48
|
+
</tr>
|
|
49
|
+
</table>
|
|
50
|
+
|
|
51
|
+
## Packages Overview
|
|
52
|
+
|
|
53
|
+
We offer the following PyPI packages to create conversational experiences based on Agents:
|
|
54
|
+
|
|
55
|
+
| Package Name | PyPI Version | Description |
|
|
56
|
+
|--------------|-------------|-------------|
|
|
57
|
+
| `microsoft-agents-activity` | [](https://pypi.org/project/microsoft-agents-activity/) | Types and validators implementing the Activity protocol spec. |
|
|
58
|
+
| `microsoft-agents-hosting-core` | [](https://pypi.org/project/microsoft-agents-hosting-core/) | Core library for Microsoft Agents hosting. |
|
|
59
|
+
| `microsoft-agents-hosting-aiohttp` | [](https://pypi.org/project/microsoft-agents-hosting-aiohttp/) | Configures aiohttp to run the Agent. |
|
|
60
|
+
| `microsoft-agents-hosting-teams` | [](https://pypi.org/project/microsoft-agents-hosting-teams/) | Provides classes to host an Agent for Teams. |
|
|
61
|
+
| `microsoft-agents-storage-blob` | [](https://pypi.org/project/microsoft-agents-storage-blob/) | Extension to use Azure Blob as storage. |
|
|
62
|
+
| `microsoft-agents-storage-cosmos` | [](https://pypi.org/project/microsoft-agents-storage-cosmos/) | Extension to use CosmosDB as storage. |
|
|
63
|
+
| `microsoft-agents-authentication-msal` | [](https://pypi.org/project/microsoft-agents-authentication-msal/) | MSAL-based authentication for Microsoft Agents. |
|
|
64
|
+
|
|
65
|
+
Additionally we provide a Copilot Studio Client, to interact with Agents created in CopilotStudio:
|
|
66
|
+
|
|
67
|
+
| Package Name | PyPI Version | Description |
|
|
68
|
+
|--------------|-------------|-------------|
|
|
69
|
+
| `microsoft-agents-copilotstudio-client` | [](https://pypi.org/project/microsoft-agents-copilotstudio-client/) | Direct to Engine client to interact with Agents created in CopilotStudio |
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
## Installation
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
pip install microsoft-agents-copilotstudio-client
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Quick Start
|
|
79
|
+
|
|
80
|
+
### Basic Setup
|
|
81
|
+
|
|
82
|
+
Code below from the [main.py in the Copilot Studio Client](https://github.com/microsoft/Agents/blob/main/samples/python/copilotstudio-client/src/main.py)
|
|
83
|
+
```python
|
|
84
|
+
def create_client():
|
|
85
|
+
settings = ConnectionSettings(
|
|
86
|
+
environment_id=environ.get("COPILOTSTUDIOAGENT__ENVIRONMENTID"),
|
|
87
|
+
agent_identifier=environ.get("COPILOTSTUDIOAGENT__SCHEMANAME"),
|
|
88
|
+
cloud=None,
|
|
89
|
+
copilot_agent_type=None,
|
|
90
|
+
custom_power_platform_cloud=None,
|
|
91
|
+
)
|
|
92
|
+
token = acquire_token(
|
|
93
|
+
settings,
|
|
94
|
+
app_client_id=environ.get("COPILOTSTUDIOAGENT__AGENTAPPID"),
|
|
95
|
+
tenant_id=environ.get("COPILOTSTUDIOAGENT__TENANTID"),
|
|
96
|
+
)
|
|
97
|
+
copilot_client = CopilotClient(settings, token)
|
|
98
|
+
return copilot_client
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Start a Conversation
|
|
102
|
+
The code below is summarized from the [main.py in the Copilot Studio Client](https://github.com/microsoft/Agents/blob/main/samples/python/copilotstudio-client/src/main.py). See that sample for complete & working code.
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
copilot_client = create_client()
|
|
106
|
+
act = copilot_client.start_conversation(True)
|
|
107
|
+
|
|
108
|
+
...
|
|
109
|
+
|
|
110
|
+
replies = copilot_client.ask_question("Who are you?", conversation_id)
|
|
111
|
+
async for reply in replies:
|
|
112
|
+
if reply.type == ActivityTypes.message:
|
|
113
|
+
print(f"\n{reply.text}")
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Environment Variables
|
|
117
|
+
Set up your `.env` file:
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
# Required
|
|
121
|
+
ENVIRONMENT_ID=your-power-platform-environment-id
|
|
122
|
+
AGENT_IDENTIFIER=your-copilot-studio-agent-id
|
|
123
|
+
APP_CLIENT_ID=your-azure-app-client-id
|
|
124
|
+
TENANT_ID=your-azure-tenant-id
|
|
125
|
+
|
|
126
|
+
# Optional
|
|
127
|
+
CLOUD=PROD
|
|
128
|
+
COPILOT_AGENT_TYPE=PUBLISHED
|
|
129
|
+
CUSTOM_POWER_PLATFORM_CLOUD=your-custom-cloud.com
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Features
|
|
133
|
+
|
|
134
|
+
✅ **Real-time streaming** - Server-sent events for live responses
|
|
135
|
+
✅ **Multi-cloud support** - Works across all Power Platform clouds
|
|
136
|
+
✅ **Rich content** - Support for cards, actions, and attachments
|
|
137
|
+
✅ **Conversation management** - Maintain context across interactions
|
|
138
|
+
✅ **Custom activities** - Send structured data to agents
|
|
139
|
+
✅ **Async/await** - Modern Python async support
|
|
140
|
+
|
|
141
|
+
## Troubleshooting
|
|
142
|
+
|
|
143
|
+
### Common Issues
|
|
144
|
+
|
|
145
|
+
**Authentication failed**
|
|
146
|
+
- Verify your app is registered in Azure AD
|
|
147
|
+
- Check that token has `https://api.powerplatform.com/.default` scope
|
|
148
|
+
- Ensure your app has permissions to the Power Platform environment
|
|
149
|
+
|
|
150
|
+
**Agent not found**
|
|
151
|
+
- Verify the environment ID and agent identifier
|
|
152
|
+
- Check that the agent is published and accessible
|
|
153
|
+
- Confirm you're using the correct cloud setting
|
|
154
|
+
|
|
155
|
+
**Connection timeout**
|
|
156
|
+
- Check network connectivity to Power Platform
|
|
157
|
+
- Verify firewall settings allow HTTPS traffic
|
|
158
|
+
- Try a different cloud region if available
|
|
159
|
+
|
|
160
|
+
## Requirements
|
|
161
|
+
|
|
162
|
+
- Python 3.10+ (supports 3.10, 3.11, 3.12, 3.13, 3.14)
|
|
163
|
+
- Valid Azure AD app registration
|
|
164
|
+
- Access to Microsoft Power Platform environment
|
|
165
|
+
- Published Copilot Studio agent
|
|
166
|
+
|
|
167
|
+
# Quick Links
|
|
168
|
+
|
|
169
|
+
- 📦 [All SDK Packages on PyPI](https://pypi.org/search/?q=microsoft-agents)
|
|
170
|
+
- 📖 [Complete Documentation](https://aka.ms/agents)
|
|
171
|
+
- 💡 [Python Samples Repository](https://github.com/microsoft/Agents/tree/main/samples/python)
|
|
172
|
+
- 🐛 [Report Issues](https://github.com/microsoft/Agents-for-python/issues)
|
|
173
|
+
|
|
174
|
+
# Sample Applications
|
|
175
|
+
|
|
176
|
+
|Name|Description|README|
|
|
177
|
+
|----|----|----|
|
|
178
|
+
|Quickstart|Simplest agent|[Quickstart](https://github.com/microsoft/Agents/blob/main/samples/python/quickstart/README.md)|
|
|
179
|
+
|Auto Sign In|Simple OAuth agent using Graph and GitHub|[auto-signin](https://github.com/microsoft/Agents/blob/main/samples/python/auto-signin/README.md)|
|
|
180
|
+
|OBO Authorization|OBO flow to access a Copilot Studio Agent|[obo-authorization](https://github.com/microsoft/Agents/blob/main/samples/python/obo-authorization/README.md)|
|
|
181
|
+
|Semantic Kernel Integration|A weather agent built with Semantic Kernel|[semantic-kernel-multiturn](https://github.com/microsoft/Agents/blob/main/samples/python/semantic-kernel-multiturn/README.md)|
|
|
182
|
+
|Streaming Agent|Streams OpenAI responses|[azure-ai-streaming](https://github.com/microsoft/Agents/blob/main/samples/python/azureai-streaming/README.md)|
|
|
183
|
+
|Copilot Studio Client|Console app to consume a Copilot Studio Agent|[copilotstudio-client](https://github.com/microsoft/Agents/blob/main/samples/python/copilotstudio-client/README.md)|
|
|
184
|
+
|Cards Agent|Agent that uses rich cards to enhance conversation design |[cards](https://github.com/microsoft/Agents/blob/main/samples/python/cards/README.md)|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
microsoft-agents-hosting-core==0.5.0
|
|
@@ -6,11 +6,18 @@ build-backend = "setuptools.build_meta"
|
|
|
6
6
|
name = "microsoft-agents-copilotstudio-client"
|
|
7
7
|
dynamic = ["version", "dependencies"]
|
|
8
8
|
description = "A client library for Microsoft Agents"
|
|
9
|
+
readme = {file = "readme.md", content-type = "text/markdown"}
|
|
9
10
|
authors = [{name = "Microsoft Corporation"}]
|
|
10
|
-
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
requires-python = ">=3.10"
|
|
11
14
|
classifiers = [
|
|
12
15
|
"Programming Language :: Python :: 3",
|
|
13
|
-
"
|
|
16
|
+
"Programming Language :: Python :: 3.10",
|
|
17
|
+
"Programming Language :: Python :: 3.11",
|
|
18
|
+
"Programming Language :: Python :: 3.12",
|
|
19
|
+
"Programming Language :: Python :: 3.13",
|
|
20
|
+
"Programming Language :: Python :: 3.14",
|
|
14
21
|
"Operating System :: OS Independent",
|
|
15
22
|
]
|
|
16
23
|
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Microsoft Agents Copilot Studio Client
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/microsoft-agents-copilotstudio-client/)
|
|
4
|
+
|
|
5
|
+
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.
|
|
6
|
+
|
|
7
|
+
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.
|
|
8
|
+
|
|
9
|
+
# What is this?
|
|
10
|
+
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.
|
|
11
|
+
|
|
12
|
+
## Release Notes
|
|
13
|
+
<table style="width:100%">
|
|
14
|
+
<tr>
|
|
15
|
+
<th style="width:20%">Version</th>
|
|
16
|
+
<th style="width:20%">Date</th>
|
|
17
|
+
<th style="width:60%">Release Notes</th>
|
|
18
|
+
</tr>
|
|
19
|
+
<tr>
|
|
20
|
+
<td>0.5.0</td>
|
|
21
|
+
<td>2025-10-22</td>
|
|
22
|
+
<td>
|
|
23
|
+
<a href="https://github.com/microsoft/Agents-for-python/blob/main/changelog.md">
|
|
24
|
+
0.5.0 Release Notes
|
|
25
|
+
</a>
|
|
26
|
+
</td>
|
|
27
|
+
</tr>
|
|
28
|
+
</table>
|
|
29
|
+
|
|
30
|
+
## Packages Overview
|
|
31
|
+
|
|
32
|
+
We offer the following PyPI packages to create conversational experiences based on Agents:
|
|
33
|
+
|
|
34
|
+
| Package Name | PyPI Version | Description |
|
|
35
|
+
|--------------|-------------|-------------|
|
|
36
|
+
| `microsoft-agents-activity` | [](https://pypi.org/project/microsoft-agents-activity/) | Types and validators implementing the Activity protocol spec. |
|
|
37
|
+
| `microsoft-agents-hosting-core` | [](https://pypi.org/project/microsoft-agents-hosting-core/) | Core library for Microsoft Agents hosting. |
|
|
38
|
+
| `microsoft-agents-hosting-aiohttp` | [](https://pypi.org/project/microsoft-agents-hosting-aiohttp/) | Configures aiohttp to run the Agent. |
|
|
39
|
+
| `microsoft-agents-hosting-teams` | [](https://pypi.org/project/microsoft-agents-hosting-teams/) | Provides classes to host an Agent for Teams. |
|
|
40
|
+
| `microsoft-agents-storage-blob` | [](https://pypi.org/project/microsoft-agents-storage-blob/) | Extension to use Azure Blob as storage. |
|
|
41
|
+
| `microsoft-agents-storage-cosmos` | [](https://pypi.org/project/microsoft-agents-storage-cosmos/) | Extension to use CosmosDB as storage. |
|
|
42
|
+
| `microsoft-agents-authentication-msal` | [](https://pypi.org/project/microsoft-agents-authentication-msal/) | MSAL-based authentication for Microsoft Agents. |
|
|
43
|
+
|
|
44
|
+
Additionally we provide a Copilot Studio Client, to interact with Agents created in CopilotStudio:
|
|
45
|
+
|
|
46
|
+
| Package Name | PyPI Version | Description |
|
|
47
|
+
|--------------|-------------|-------------|
|
|
48
|
+
| `microsoft-agents-copilotstudio-client` | [](https://pypi.org/project/microsoft-agents-copilotstudio-client/) | Direct to Engine client to interact with Agents created in CopilotStudio |
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## Installation
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install microsoft-agents-copilotstudio-client
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Quick Start
|
|
58
|
+
|
|
59
|
+
### Basic Setup
|
|
60
|
+
|
|
61
|
+
Code below from the [main.py in the Copilot Studio Client](https://github.com/microsoft/Agents/blob/main/samples/python/copilotstudio-client/src/main.py)
|
|
62
|
+
```python
|
|
63
|
+
def create_client():
|
|
64
|
+
settings = ConnectionSettings(
|
|
65
|
+
environment_id=environ.get("COPILOTSTUDIOAGENT__ENVIRONMENTID"),
|
|
66
|
+
agent_identifier=environ.get("COPILOTSTUDIOAGENT__SCHEMANAME"),
|
|
67
|
+
cloud=None,
|
|
68
|
+
copilot_agent_type=None,
|
|
69
|
+
custom_power_platform_cloud=None,
|
|
70
|
+
)
|
|
71
|
+
token = acquire_token(
|
|
72
|
+
settings,
|
|
73
|
+
app_client_id=environ.get("COPILOTSTUDIOAGENT__AGENTAPPID"),
|
|
74
|
+
tenant_id=environ.get("COPILOTSTUDIOAGENT__TENANTID"),
|
|
75
|
+
)
|
|
76
|
+
copilot_client = CopilotClient(settings, token)
|
|
77
|
+
return copilot_client
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Start a Conversation
|
|
81
|
+
The code below is summarized from the [main.py in the Copilot Studio Client](https://github.com/microsoft/Agents/blob/main/samples/python/copilotstudio-client/src/main.py). See that sample for complete & working code.
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
copilot_client = create_client()
|
|
85
|
+
act = copilot_client.start_conversation(True)
|
|
86
|
+
|
|
87
|
+
...
|
|
88
|
+
|
|
89
|
+
replies = copilot_client.ask_question("Who are you?", conversation_id)
|
|
90
|
+
async for reply in replies:
|
|
91
|
+
if reply.type == ActivityTypes.message:
|
|
92
|
+
print(f"\n{reply.text}")
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Environment Variables
|
|
96
|
+
Set up your `.env` file:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Required
|
|
100
|
+
ENVIRONMENT_ID=your-power-platform-environment-id
|
|
101
|
+
AGENT_IDENTIFIER=your-copilot-studio-agent-id
|
|
102
|
+
APP_CLIENT_ID=your-azure-app-client-id
|
|
103
|
+
TENANT_ID=your-azure-tenant-id
|
|
104
|
+
|
|
105
|
+
# Optional
|
|
106
|
+
CLOUD=PROD
|
|
107
|
+
COPILOT_AGENT_TYPE=PUBLISHED
|
|
108
|
+
CUSTOM_POWER_PLATFORM_CLOUD=your-custom-cloud.com
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Features
|
|
112
|
+
|
|
113
|
+
✅ **Real-time streaming** - Server-sent events for live responses
|
|
114
|
+
✅ **Multi-cloud support** - Works across all Power Platform clouds
|
|
115
|
+
✅ **Rich content** - Support for cards, actions, and attachments
|
|
116
|
+
✅ **Conversation management** - Maintain context across interactions
|
|
117
|
+
✅ **Custom activities** - Send structured data to agents
|
|
118
|
+
✅ **Async/await** - Modern Python async support
|
|
119
|
+
|
|
120
|
+
## Troubleshooting
|
|
121
|
+
|
|
122
|
+
### Common Issues
|
|
123
|
+
|
|
124
|
+
**Authentication failed**
|
|
125
|
+
- Verify your app is registered in Azure AD
|
|
126
|
+
- Check that token has `https://api.powerplatform.com/.default` scope
|
|
127
|
+
- Ensure your app has permissions to the Power Platform environment
|
|
128
|
+
|
|
129
|
+
**Agent not found**
|
|
130
|
+
- Verify the environment ID and agent identifier
|
|
131
|
+
- Check that the agent is published and accessible
|
|
132
|
+
- Confirm you're using the correct cloud setting
|
|
133
|
+
|
|
134
|
+
**Connection timeout**
|
|
135
|
+
- Check network connectivity to Power Platform
|
|
136
|
+
- Verify firewall settings allow HTTPS traffic
|
|
137
|
+
- Try a different cloud region if available
|
|
138
|
+
|
|
139
|
+
## Requirements
|
|
140
|
+
|
|
141
|
+
- Python 3.10+ (supports 3.10, 3.11, 3.12, 3.13, 3.14)
|
|
142
|
+
- Valid Azure AD app registration
|
|
143
|
+
- Access to Microsoft Power Platform environment
|
|
144
|
+
- Published Copilot Studio agent
|
|
145
|
+
|
|
146
|
+
# Quick Links
|
|
147
|
+
|
|
148
|
+
- 📦 [All SDK Packages on PyPI](https://pypi.org/search/?q=microsoft-agents)
|
|
149
|
+
- 📖 [Complete Documentation](https://aka.ms/agents)
|
|
150
|
+
- 💡 [Python Samples Repository](https://github.com/microsoft/Agents/tree/main/samples/python)
|
|
151
|
+
- 🐛 [Report Issues](https://github.com/microsoft/Agents-for-python/issues)
|
|
152
|
+
|
|
153
|
+
# Sample Applications
|
|
154
|
+
|
|
155
|
+
|Name|Description|README|
|
|
156
|
+
|----|----|----|
|
|
157
|
+
|Quickstart|Simplest agent|[Quickstart](https://github.com/microsoft/Agents/blob/main/samples/python/quickstart/README.md)|
|
|
158
|
+
|Auto Sign In|Simple OAuth agent using Graph and GitHub|[auto-signin](https://github.com/microsoft/Agents/blob/main/samples/python/auto-signin/README.md)|
|
|
159
|
+
|OBO Authorization|OBO flow to access a Copilot Studio Agent|[obo-authorization](https://github.com/microsoft/Agents/blob/main/samples/python/obo-authorization/README.md)|
|
|
160
|
+
|Semantic Kernel Integration|A weather agent built with Semantic Kernel|[semantic-kernel-multiturn](https://github.com/microsoft/Agents/blob/main/samples/python/semantic-kernel-multiturn/README.md)|
|
|
161
|
+
|Streaming Agent|Streams OpenAI responses|[azure-ai-streaming](https://github.com/microsoft/Agents/blob/main/samples/python/azureai-streaming/README.md)|
|
|
162
|
+
|Copilot Studio Client|Console app to consume a Copilot Studio Agent|[copilotstudio-client](https://github.com/microsoft/Agents/blob/main/samples/python/copilotstudio-client/README.md)|
|
|
163
|
+
|Cards Agent|Agent that uses rich cards to enhance conversation design |[cards](https://github.com/microsoft/Agents/blob/main/samples/python/cards/README.md)|
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: microsoft-agents-copilotstudio-client
|
|
3
|
-
Version: 0.4.0.dev18
|
|
4
|
-
Summary: A client library for Microsoft Agents
|
|
5
|
-
Author: Microsoft Corporation
|
|
6
|
-
Project-URL: Homepage, https://github.com/microsoft/Agents
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Requires-Python: >=3.9
|
|
11
|
-
Requires-Dist: microsoft-agents-hosting-core==0.4.0.dev18
|
|
12
|
-
Dynamic: requires-dist
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: microsoft-agents-copilotstudio-client
|
|
3
|
-
Version: 0.4.0.dev18
|
|
4
|
-
Summary: A client library for Microsoft Agents
|
|
5
|
-
Author: Microsoft Corporation
|
|
6
|
-
Project-URL: Homepage, https://github.com/microsoft/Agents
|
|
7
|
-
Classifier: Programming Language :: Python :: 3
|
|
8
|
-
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
-
Classifier: Operating System :: OS Independent
|
|
10
|
-
Requires-Python: >=3.9
|
|
11
|
-
Requires-Dist: microsoft-agents-hosting-core==0.4.0.dev18
|
|
12
|
-
Dynamic: requires-dist
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
microsoft-agents-hosting-core==0.4.0.dev18
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|