Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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:

  1. Copilot Studio Environment: Access to a Microsoft Copilot Studio environment with a published copilot
  2. App Registration: An Azure AD App Registration with appropriate permissions for Power Platform API
  3. 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 ID
  • COPILOTSTUDIOAGENT__SCHEMANAME - Your copilot's agent identifier/schema name
  • COPILOTSTUDIOAGENT__AGENTAPPID - Your App Registration client ID
  • COPILOTSTUDIOAGENT__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,
        # Raise aiohttp's per-line buffer above the 512 KB default so large Copilot Studio
        # activities (for example, sizeable connector payloads) don't raise LineTooLong.
        client_session_settings={"read_bufsize": 1024 * 1024},
    )

    # 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

Metadata

Release files for agent-framework-copilotstudio 1.0.0b261106

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agent-framework-copilotstudio 1.0.0b261106
File Size Uploaded Provenance Actions
agent_framework_copilotstudio-1.0.0b261106.tar.gz 9.6 kB Without provenance Details for agent_framework_copilotstudio-1.0.0b261106.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for agent-framework-copilotstudio 1.0.0b261106
File Interpreter ABI Platform Actions
agent_framework_copilotstudio-1.0.0b261106-py3-none-any.whl Python 3 none any Details for agent_framework_copilotstudio-1.0.0b261106-py3-none-any.whl

Total release size: 19.9 kB

Release files / agent_framework_copilotstudio-1.0.0b261106.tar.gz

Download URL agent_framework_copilotstudio-1.0.0b261106.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
49acf49c688fb4bd52751830f1f47bacc4a541a23f7d4be51b16ff79640dd9ad
BLAKE2b-256 checksum
How to use checksums
95382c9b8f83835e321f3cba45d327a4dac58b6fda33e4c63ba755d1f09a8745
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Release files / agent_framework_copilotstudio-1.0.0b261106-py3-none-any.whl

Download URL agent_framework_copilotstudio-1.0.0b261106-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7684a3d2240f3aa0349fec9d71721437ec33169877023c4913b1530fe34cb6db
BLAKE2b-256 checksum
How to use checksums
b8ffa0558b717291a4f479cd684df1d3d630c4c7ecab6324b61a824a8b4a7144
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via RestSharp/106.13.0.0

Security for agent-framework-copilotstudio 1.0.0b261106

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page