Copilot Studio integration for Microsoft Agent Framework.
Project description
Get Started with Microsoft Agent Framework Copilot Studio
Please install this package via pip:
pip install agent-framework-copilotstudio --pre
Copilot Studio Agent
The Copilot Studio agent enables integration with Microsoft Copilot Studio, allowing you to interact with published copilots through the Agent Framework.
Prerequisites
Before using the Copilot Studio agent, you need:
- Copilot Studio Environment: Access to a Microsoft Copilot Studio environment with a published copilot
- App Registration: An Azure AD App Registration with appropriate permissions for Power Platform API
- Environment Configuration: Set the required environment variables or pass them as parameters
Environment Variables
The following environment variables are used for configuration:
COPILOTSTUDIOAGENT__ENVIRONMENTID- Your Copilot Studio environment IDCOPILOTSTUDIOAGENT__SCHEMANAME- Your copilot's agent identifier/schema nameCOPILOTSTUDIOAGENT__AGENTAPPID- Your App Registration client IDCOPILOTSTUDIOAGENT__TENANTID- Your Azure AD tenant ID
Basic Usage Example
import asyncio
from agent_framework.microsoft import CopilotStudioAgent
async def main():
# Create agent using environment variables
agent = CopilotStudioAgent()
# Run a simple query
result = await agent.run("What is the capital of France?")
print(result)
asyncio.run(main())
Explicit Configuration Example
import asyncio
import os
from agent_framework.microsoft import CopilotStudioAgent, acquire_token
from microsoft_agents.copilotstudio.client import ConnectionSettings, CopilotClient, PowerPlatformCloud, AgentType
async def main():
# Acquire authentication token
token = acquire_token(
client_id=os.environ["COPILOTSTUDIOAGENT__AGENTAPPID"],
tenant_id=os.environ["COPILOTSTUDIOAGENT__TENANTID"]
)
# Create connection settings
settings = ConnectionSettings(
environment_id=os.environ["COPILOTSTUDIOAGENT__ENVIRONMENTID"],
agent_identifier=os.environ["COPILOTSTUDIOAGENT__SCHEMANAME"],
cloud=PowerPlatformCloud.PROD,
copilot_agent_type=AgentType.PUBLISHED,
custom_power_platform_cloud=None
)
# Create client and agent
client = CopilotClient(settings=settings, token=token)
agent = CopilotStudioAgent(client=client)
# Run a query
result = await agent.run("What is the capital of Italy?")
print(result)
asyncio.run(main())
Authentication
The package uses MSAL (Microsoft Authentication Library) for authentication with interactive flows when needed. Ensure your App Registration has:
- API Permissions: Power Platform API permissions (https://api.powerplatform.com/.default)
- Redirect URIs: Configured appropriately for your authentication method
- Public Client Flows: Enabled if using interactive authentication
Examples
For more comprehensive examples, see the Copilot Studio examples which demonstrate:
- Basic non-streaming and streaming execution
- Explicit settings and manual token acquisition
- Different authentication patterns
- Error handling and troubleshooting
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_framework_copilotstudio-1.0.0b251028.tar.gz.
File metadata
- Download URL: agent_framework_copilotstudio-1.0.0b251028.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34c60c61f024b93fc64bee5dd7526a13a2c59fd5c1188c79891756c74c2dbf73
|
|
| MD5 |
9728b74e4e7d55fbbdfdbc050fece780
|
|
| BLAKE2b-256 |
b70a9a26ec33ee3157780bc3ef14c3f6a1394a5c9022191a2e0eeb93fa926293
|
File details
Details for the file agent_framework_copilotstudio-1.0.0b251028-py3-none-any.whl.
File metadata
- Download URL: agent_framework_copilotstudio-1.0.0b251028-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.8.24
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa356680bbaf624f07f51fba0ea6f3b78799679181514d10d178579ce2da3e03
|
|
| MD5 |
37df3387b8c160baa40f5614f2b8787c
|
|
| BLAKE2b-256 |
1e1e84ae3a04e953b56ed1938fbe373e8227dff0c337d84554188567ee4ca778
|