mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
47fa59f8e9
* fixes * fixes * Python: bump package versions for 1.4.0 release Cuts the python-1.4.0 release. MINOR bump on the released cohort (agent-framework, agent-framework-core, agent-framework-openai, agent-framework-foundry: 1.3.0 -> 1.4.0), driven by breaking changes in experimental skills API and new features. All 21 beta packages stamp 1.0.0b260514, all 3 alpha packages stamp 1.0.0a260514, and ag-ui remains at 1.0.0rc1 (freshly promoted). Date stamp reflects 2026-05-14 Pacific. - Released cohort: 1.3.0 -> 1.4.0 - Beta packages (21): 1.0.0b260507 -> 1.0.0b260514 - Alpha packages (3): 1.0.0a260507 -> 1.0.0a260514 - ag-ui: stays at 1.0.0rc1 (dep bound updated only) - Inter-package dependency lower bounds updated (>=1.3.0 -> >=1.4.0) - Fix chatkit StructuredInputItem exhaustiveness for openai-chatkit 1.6.4 - Update CHANGELOG compare links - uv.lock refreshed Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
47fa59f8e9
ยท
2026-05-15 09:31:03 +09:00
History
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