microsoft-agents-activity

A protocol library for Microsoft Agents

89 个版本 Python >=3.10
Microsoft Corporation
安装
pip install microsoft-agents-activity
poetry add microsoft-agents-activity
pipenv install microsoft-agents-activity
conda install microsoft-agents-activity
描述

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
1.1.0 2026-06-19 1.1.0 Release Notes
1.0.0 2026-05-22 1.0.0 Release Notes
0.9.0 2026-04-15 0.9.0 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
版本列表
1.2.0.dev4 2026-06-24
1.2.0.dev1 2026-06-23
1.2.0.dev0 2026-06-20
1.1.0 2026-06-19
1.1.0.dev9 2026-06-19
1.1.0.dev8 2026-06-18
1.1.0.dev7 2026-06-16
1.1.0.dev1 2026-06-03
1.1.0.dev0 2026-05-23
1.0.0 2026-05-22
0.10.0.dev9 2026-05-22
0.10.0.dev8 2026-05-20
0.10.0.dev7 2026-05-19
0.10.0.dev6 2026-05-15
0.10.0.dev5 2026-05-13
0.10.0.dev4 2026-05-02
0.10.0.dev3 2026-04-30
0.10.0.dev2 2026-04-29
0.10.0.dev1 2026-04-17
0.10.0.dev0 2026-04-16
0.9.1 2026-05-04
0.9.0 2026-04-15
0.9.0.dev9 2026-04-08
0.9.0.dev8 2026-04-04
0.9.0.dev7 2026-04-03
0.9.0.dev6 2026-04-02
0.9.0.dev5 2026-04-01
0.9.0.dev4 2026-03-27
0.9.0.dev3 2026-03-24
0.9.0.dev2 2026-03-17
0.9.0.dev11 2026-04-15
0.9.0.dev10 2026-04-11
0.9.0.dev1 2026-02-25
0.8.0 2026-02-24
0.8.0.dev4 2026-02-18
0.8.0.dev3 2026-02-12
0.8.0.dev2 2026-02-05
0.8.0.dev0 2026-02-04
0.7.0 2026-01-21
0.7.0.dev8 2025-12-03
0.7.0.dev6 2025-12-02
0.7.0.dev4 2025-11-27
0.7.0.dev16 2026-02-04
0.7.0.dev12 2025-12-17
0.7.0.dev10 2025-12-09
0.7.0.dev1 2025-11-21
0.7.0.dev0 2025-11-19
0.6.1 2025-12-01
0.6.0 2025-11-18
0.6.0.dev9 2025-11-01
0.6.0.dev8 2025-10-31
0.6.0.dev7 2025-10-29
0.6.0.dev4 2025-10-28
0.6.0.dev17 2025-11-15
0.6.0.dev16 2025-11-14
0.6.0.dev15 2025-11-13
0.6.0.dev11 2025-11-12
0.6.0.dev10 2025-11-06
0.6.0.dev1 2025-10-23
0.5.3 2025-10-31
0.5.2 2025-10-31
0.5.1 2025-10-28
0.5.0 2025-10-22
0.5.0.dev7 2025-10-14
0.5.0.dev5 2025-10-11
0.5.0.dev3 2025-10-09
0.5.0.dev19 2025-10-22
0.5.0.dev17 2025-10-21
0.5.0.dev11 2025-10-16
0.5.0.dev10 2025-10-15
0.4.0 2025-10-07
0.4.0.dev7 2025-09-11
0.4.0.dev6 2025-09-10
0.4.0.dev4 2025-09-09
0.4.0.dev3 2025-09-05
0.4.0.dev18 2025-10-08
0.4.0.dev16 2025-10-07
0.4.0.dev14 2025-10-03
0.4.0.dev10 2025-10-02
0.4.0.dev1 2025-08-28
0.3.2 2025-09-17
0.3.1 2025-09-09
0.3.0 2025-08-27
0.3.0.dev0 2025-08-19
0.2.0 2025-08-18
0.2.0.dev1 2025-08-15
0.1.2 2025-08-12
0.1.1 2025-07-28
0.0.0 2025-07-25