Skip to main content
Pre-release

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

Microsoft Agents Copilot Studio Client

PyPI version

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:

Package Name PyPI Version Description
microsoft-agents-activity PyPI Types and validators implementing the Activity protocol spec.
microsoft-agents-hosting-core PyPI Core library for Microsoft Agents hosting.
microsoft-agents-hosting-aiohttp PyPI Configures aiohttp to run the Agent.
microsoft-agents-hosting-teams PyPI Provides classes to host an Agent for Teams.
microsoft-agents-storage-blob PyPI Extension to use Azure Blob as storage.
microsoft-agents-storage-cosmos PyPI Extension to use CosmosDB as storage.
microsoft-agents-authentication-msal PyPI MSAL-based authentication for Microsoft Agents.

Additionally we provide a Copilot Studio Client, to interact with Agents created in CopilotStudio:

Package Name PyPI Version Description
microsoft-agents-copilotstudio-client PyPI 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/.default scope
  • 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)

Source distribution for microsoft-agents-copilotstudio-client 0.6.0.dev9
File Size Uploaded
microsoft_agents_copilotstudio_client-0.6.0.dev9.tar.gz 11.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for microsoft-agents-copilotstudio-client 0.6.0.dev9
File Interpreter ABI Platform
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

Release history Release notifications | RSS feed

1.8.0

2 release files

1.7.0

2 release files

1.6.0

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

This release

0.6.0.dev9 This release

2 release files

0.5.3

2 release files

0.5.2

2 release files

0.5.1

2 release files

0.5.0

2 release files

0.4.0

2 release files

0.3.2

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.0.0

2 release files

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