Skip to main content

A protocol library for Microsoft Agents

Project description

Microsoft Agents Activity

PyPI version

Core types and schemas for building conversational AI agents that work across Microsoft 365 platforms like Teams, Copilot Studio, and Webchat.

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.8.0 2026-02-23 0.8.0 Release Notes
0.7.0 2026-01-21 0.7.0 Release Notes
0.6.1 2025-12-01 0.6.1 Release Notes
0.6.0 2025-11-18 0.6.0 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

Architecture

The SDK follows a modular architecture:

  • Activity Layer: Protocol definitions for cross-platform messaging
  • Hosting Layer: Core agent lifecycle, middleware, and web hosting
  • Storage Layer: Persistent state management with Azure backends
  • Authentication Layer: Secure identity and token management
  • Integration Layer: Platform-specific adapters (Teams, Copilot Studio)

Installation

pip install microsoft-agents-activity

Quick Start

Code below taken from the Quick Start sample.

@AGENT_APP.conversation_update("membersAdded")
async def on_members_added(context: TurnContext, _state: TurnState):
    await context.send_activity(
        "Welcome to the empty agent! "
        "This agent is designed to be a starting point for your own agent development."
    )
    return True


@AGENT_APP.message(re.compile(r"^hello$"))
async def on_hello(context: TurnContext, _state: TurnState):
    await context.send_activity("Hello!")


@AGENT_APP.activity("message")
async def on_message(context: TurnContext, _state: TurnState):
    await context.send_activity(f"you said: {context.activity.text}")

Common Use Cases

Rich Messages with Cards

Code below taken from the Cards sample.

    @staticmethod
    async def send_animation_card(context: TurnContext):
        card = CardFactory.animation_card(
            AnimationCard(
                title="Microsoft Agents Framework",
                image=ThumbnailUrl(
                    url="https://i.giphy.com/Ki55RUbOV5njy.gif", alt="Cute Robot"
                ),
                media=[MediaUrl(url="https://i.giphy.com/Ki55RUbOV5njy.gif")],
                subtitle="Animation Card",
                text="This is an example of an animation card using a gif.",
                aspect="16:9",
                duration="PT2M",
            )
        )
        await CardMessages.send_activity(context, card)

    @staticmethod
    async def send_activity(context: TurnContext, card: Attachment):
        activity = Activity(type=ActivityTypes.message, attachments=[card])
        await context.send_activity(activity)

Activity Types

The library supports different types of communication:

  • Message - Regular chat messages with text, cards, attachments
  • Typing - Show typing indicators
  • ConversationUpdate - People joining/leaving chats
  • Event - Custom events and notifications
  • Invoke - Direct function calls
  • EndOfConversation - End chat sessions

Key Features

Type-safe - Built with Pydantic for automatic validation
Rich content - Support for cards, images, videos, and interactive elements
Teams ready - Full Microsoft Teams integration
Cross-platform - Works across all Microsoft 365 chat platforms
Migration friendly - Easy upgrade from Bot Framework

Quick Links

Sample Applications

Explore working examples in the Python samples repository:

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

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

microsoft_agents_activity-0.9.0.dev4.tar.gz (62.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

microsoft_agents_activity-0.9.0.dev4-py3-none-any.whl (134.8 kB view details)

Uploaded Python 3

File details

Details for the file microsoft_agents_activity-0.9.0.dev4.tar.gz.

File metadata

File hashes

Hashes for microsoft_agents_activity-0.9.0.dev4.tar.gz
Algorithm Hash digest
SHA256 80a0a5ab51942bc52d5fa4f7d3a9b33df6545701839a9c40483a97160d3069a5
MD5 882463c72e5d127513c0a216306fe759
BLAKE2b-256 654f53299605ed9ef4cc2ac50d71e7192f2469a8d4f874513575a9882ca139fb

See more details on using hashes here.

File details

Details for the file microsoft_agents_activity-0.9.0.dev4-py3-none-any.whl.

File metadata

File hashes

Hashes for microsoft_agents_activity-0.9.0.dev4-py3-none-any.whl
Algorithm Hash digest
SHA256 18f2a26be102b60c6c20fe3d30de4a881225d01876bc592b189df5102af86195
MD5 ac4bed1360731ae9bce746694d5eb3bf
BLAKE2b-256 008f72c598ff72ac9ff1aa3473dfcc1b9e7840bfab3934d3f9bf73d73d8fb512

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page