-
Notifications
You must be signed in to change notification settings - Fork 56
Author Readme files for each library and integrate into the PyPi descriptions. Fixes #156 #157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
9e2f3be
Author Readme files for each library and integrate those into the lon…
cleemullins f3b79af
Add long description to setup.py for PyPi compatibility
cleemullins e93e034
Fix formatting in setup.py by removing unnecessary line breaks in set…
cleemullins 476b49c
Remove long description from setup.py and ensure readme is specified …
cleemullins d3c2e42
Add readme specification to pyproject.toml for all libraries and remo…
cleemullins be73c21
Revert setup.py changes - restore to main branch state
cleemullins 7e912ae
Enhance README files across multiple libraries to include comprehensi…
cleemullins d4e82e2
Merge branch 'main' into Libary-Readmes-and-PyPi-Description-Setup
cleemullins c224b72
Review all sample code, remove AI written sample code. Simplify readm…
5834e7d
Removed erronous class
994c6b0
Added in a "This library is still evolving" message.
f5e33ef
Merge branch 'main' into Libary-Readmes-and-PyPi-Description-Setup
cleemullins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,135 @@ | ||
| # Microsoft Agents Activity | ||
|
|
||
| [](https://pypi.org/project/microsoft-agents-activity/) | ||
|
|
||
| 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. | ||
|
|
||
| ## Packages Overview | ||
|
|
||
| We offer the following PyPI packages to create conversational experiences based on Agents: | ||
|
|
||
| | Package Name | PyPI Version | Description | | ||
| |--------------|-------------|-------------| | ||
| | `microsoft-agents-activity` | [](https://pypi.org/project/microsoft-agents-activity/) | Types and validators implementing the Activity protocol spec. | | ||
| | `microsoft-agents-hosting-core` | [](https://pypi.org/project/microsoft-agents-hosting-core/) | Core library for Microsoft Agents hosting. | | ||
| | `microsoft-agents-hosting-aiohttp` | [](https://pypi.org/project/microsoft-agents-hosting-aiohttp/) | Configures aiohttp to run the Agent. | | ||
| | `microsoft-agents-hosting-teams` | [](https://pypi.org/project/microsoft-agents-hosting-teams/) | Provides classes to host an Agent for Teams. | | ||
| | `microsoft-agents-storage-blob` | [](https://pypi.org/project/microsoft-agents-storage-blob/) | Extension to use Azure Blob as storage. | | ||
| | `microsoft-agents-storage-cosmos` | [](https://pypi.org/project/microsoft-agents-storage-cosmos/) | Extension to use CosmosDB as storage. | | ||
| | `microsoft-agents-authentication-msal` | [](https://pypi.org/project/microsoft-agents-authentication-msal/) | 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` | [](https://pypi.org/project/microsoft-agents-copilotstudio-client/) | 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 | ||
|
|
||
| ```bash | ||
| pip install microsoft-agents-activity | ||
| ``` | ||
|
|
||
| ## Quick Start | ||
| Code below taken from the [Quick Start](https://github.com/microsoft/Agents/tree/main/samples/python/quickstart) sample. | ||
| ```python | ||
| @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](https://github.com/microsoft/Agents/tree/main/samples/python/cards) sample. | ||
|
|
||
|
|
||
| ```python | ||
| @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 | ||
|
|
||
| - 📦 [All SDK Packages on PyPI](https://pypi.org/search/?q=microsoft-agents) | ||
| - 📖 [Complete Documentation](https://aka.ms/agents) | ||
| - 💡 [Python Samples Repository](https://github.com/microsoft/Agents/tree/main/samples/python) | ||
| - 🐛 [Report Issues](https://github.com/microsoft/Agents-for-python/issues) | ||
|
|
||
| # Sample Applications | ||
| Explore working examples in the [Python samples repository](https://github.com/microsoft/Agents/tree/main/samples/python): | ||
|
|
||
| |Name|Description|README| | ||
| |----|----|----| | ||
| |Quickstart|Simplest agent|[Quickstart](https://github.com/microsoft/Agents/blob/main/samples/python/quickstart/README.md)| | ||
| |Auto Sign In|Simple OAuth agent using Graph and GitHub|[auto-signin](https://github.com/microsoft/Agents/blob/main/samples/python/auto-signin/README.md)| | ||
| |OBO Authorization|OBO flow to access a Copilot Studio Agent|[obo-authorization](https://github.com/microsoft/Agents/blob/main/samples/python/obo-authorization/README.md)| | ||
| |Semantic Kernel Integration|A weather agent built with Semantic Kernel|[semantic-kernel-multiturn](https://github.com/microsoft/Agents/blob/main/samples/python/semantic-kernel-multiturn/README.md)| | ||
| |Streaming Agent|Streams OpenAI responses|[azure-ai-streaming](https://github.com/microsoft/Agents/blob/main/samples/python/azureai-streaming/README.md)| | ||
| |Copilot Studio Client|Console app to consume a Copilot Studio Agent|[copilotstudio-client](https://github.com/microsoft/Agents/blob/main/samples/python/copilotstudio-client/README.md)| | ||
| |Cards Agent|Agent that uses rich cards to enhance conversation design |[cards](https://github.com/microsoft/Agents/blob/main/samples/python/cards/README.md)| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
115 changes: 115 additions & 0 deletions
115
libraries/microsoft-agents-authentication-msal/readme.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| # Microsoft Agents MSAL Authentication | ||
|
|
||
| [](https://pypi.org/project/microsoft-agents-authentication-msal/) | ||
|
|
||
| Provides secure authentication for your agents using Microsoft Authentication Library (MSAL). It handles getting tokens from Azure AD so your agent can securely communicate with Microsoft services like Teams, Graph API, and other Azure resources. | ||
|
|
||
| # 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. | ||
|
|
||
| ## Packages Overview | ||
|
|
||
| We offer the following PyPI packages to create conversational experiences based on Agents: | ||
|
|
||
| | Package Name | PyPI Version | Description | | ||
| |--------------|-------------|-------------| | ||
| | `microsoft-agents-activity` | [](https://pypi.org/project/microsoft-agents-activity/) | Types and validators implementing the Activity protocol spec. | | ||
| | `microsoft-agents-hosting-core` | [](https://pypi.org/project/microsoft-agents-hosting-core/) | Core library for Microsoft Agents hosting. | | ||
| | `microsoft-agents-hosting-aiohttp` | [](https://pypi.org/project/microsoft-agents-hosting-aiohttp/) | Configures aiohttp to run the Agent. | | ||
| | `microsoft-agents-hosting-teams` | [](https://pypi.org/project/microsoft-agents-hosting-teams/) | Provides classes to host an Agent for Teams. | | ||
| | `microsoft-agents-storage-blob` | [](https://pypi.org/project/microsoft-agents-storage-blob/) | Extension to use Azure Blob as storage. | | ||
| | `microsoft-agents-storage-cosmos` | [](https://pypi.org/project/microsoft-agents-storage-cosmos/) | Extension to use CosmosDB as storage. | | ||
| | `microsoft-agents-authentication-msal` | [](https://pypi.org/project/microsoft-agents-authentication-msal/) | 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` | [](https://pypi.org/project/microsoft-agents-copilotstudio-client/) | Direct to Engine client to interact with Agents created in CopilotStudio | | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| pip install microsoft-agents-authentication-msal | ||
| ``` | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### Basic Setup with Client Secret | ||
|
|
||
| Define your client secrets in the ENV file | ||
| ```python | ||
| CONNECTIONS__SERVICE_CONNECTION__SETTINGS__CLIENTID=client-id | ||
| CONNECTIONS__SERVICE_CONNECTION__SETTINGS__CLIENTSECRET=client-secret | ||
| CONNECTIONS__SERVICE_CONNECTION__SETTINGS__TENANTID=tenant-id | ||
| ``` | ||
|
|
||
| Load the Configuration (Code from [main.py Quickstart Sample](https://github.com/microsoft/Agents/blob/main/samples/python/quickstart/src/main.py)) | ||
|
|
||
| ```python | ||
| from .start_server import start_server | ||
|
|
||
| start_server( | ||
| agent_application=AGENT_APP, | ||
| auth_configuration=CONNECTION_MANAGER.get_default_connection_configuration(), | ||
| ) | ||
| ``` | ||
| Then start the Agent (code snipped from (start_server.py Quickstart Sample](https://github.com/microsoft/Agents/blob/main/samples/python/quickstart/src/start_server.py)): | ||
|
|
||
| ```python | ||
| def start_server( | ||
| agent_application: AgentApplication, auth_configuration: AgentAuthConfiguration | ||
| ): | ||
| async def entry_point(req: Request) -> Response: | ||
| agent: AgentApplication = req.app["agent_app"] | ||
| adapter: CloudAdapter = req.app["adapter"] | ||
| return await start_agent_process( | ||
| req, | ||
| agent, | ||
| adapter, | ||
| ) | ||
| [...] | ||
| ``` | ||
|
|
||
| ## Authentication Types | ||
| The M365 Agents SDK in Python supports the following Auth types: | ||
| ```python | ||
| class AuthTypes(str, Enum): | ||
| certificate = "certificate" | ||
| certificate_subject_name = "CertificateSubjectName" | ||
| client_secret = "ClientSecret" | ||
| user_managed_identity = "UserManagedIdentity" | ||
| system_managed_identity = "SystemManagedIdentity" | ||
| ``` | ||
|
|
||
| ## Key Classes | ||
|
|
||
| - **`MsalAuth`** - Core authentication provider using MSAL | ||
| - **`MsalConnectionManager`** - Manages multiple authentication connections | ||
|
|
||
| ## Features | ||
|
|
||
| ✅ **Multiple auth types** - Client secret, certificate, managed identity | ||
| ✅ **Token caching** - Automatic token refresh and caching | ||
| ✅ **Multi-tenant** - Support for different Azure AD tenants | ||
| ✅ **Agent-to-agent** - Secure communication between agents | ||
| ✅ **On-behalf-of** - Act on behalf of users | ||
|
|
||
| # Security Best Practices | ||
|
|
||
| - Store secrets in Azure Key Vault or environment variables | ||
| - Use managed identities when possible (no secrets to manage) | ||
| - Regularly rotate client secrets and certificates | ||
| - Use least-privilege principle for scopes and permissions | ||
|
|
||
| # Quick Links | ||
|
|
||
| - 📦 [All SDK Packages on PyPI](https://pypi.org/search/?q=microsoft-agents) | ||
| - 📖 [Complete Documentation](https://aka.ms/agents) | ||
| - 💡 [Python Samples Repository](https://github.com/microsoft/Agents/tree/main/samples/python) | ||
| - 🐛 [Report Issues](https://github.com/microsoft/Agents-for-python/issues) | ||
|
|
||
| # Sample Applications | ||
|
|
||
| w | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.