Only bot-based message extensions with search commands can be extended as agents for Microsoft 365 Copilot.
Microsoft 365 Copilot, powered by an advanced processing and orchestration engine, integrates Microsoft 365 apps, Microsoft Graph, and Large Language Models (LLMs) to transform your words into a potent productivity tool. Although Microsoft 365 Copilot can utilize apps and data within the Microsoft 365 ecosystem, many users rely on various external tools and services for work management and collaboration. By extending your message extension as an agent in Microsoft 365 Copilot, you can enable users to interact with third-party tools and services, therefore empowering them to achieve more with Microsoft 365 Copilot. You can achieve this extension by developing an agent or connecting to an external data source.
What is an agent?
An agent allows Microsoft 365 Copilot to interact directly with third-party data, apps, and services, enhance its capabilities, and broaden its range of capabilities. Agents allow Microsoft 365 Copilot to:
Fetch real-time information, such as the latest news coverage on a product launch.
Retrieve knowledge-based information, such as a team’s design files in Figma.
Descriptions enhance the usability and effectiveness of a message extension agent. The following description offer a clear and concise summary of the app’s features:
App description: App description helps improve your app discoverability in the Teams Store.
Command description: Command description maps user intent and utterance to search command inside an agent and must be built based on the analysis of the user intent and keywords.
Parameter description: Parameter description explains the requirements of the system in a natural language with output format.
Semantic description: Semantic description helps Microsoft 365 Copilot generate content by providing a conceptual understanding of the agent's capabilities and scenarios where it can help achieve user goals and match user’s intent with the agent's capabilities.
All bot-based search message extensions that are eligible for agent support must meet policy requirement and are subject to validation to ensure the agent meets quality, security, privacy, and usefulness expectations. You can create a bot-based search message extension using Teams Toolkit for Visual Studio Code, Visual Studio, Teams Toolkit command line interface (CLI), or Developer Portal for Teams and extend the message extension to function as an agent in Microsoft 365 Copilot.
Prerequisites
Before you get started, ensure that you're familiar with the following standards and guidelines for building message extension agents for Microsoft 365 Copilot:
Agents for Microsoft 365 Copilot are in preview and work only in Microsoft 365 Copilot in Teams.
Let's create a bot-based search message extension agent for Teams and Microsoft 365 Copilot and share results through the compose message area of the Microsoft Teams client.
Ensure that the Develop Copilot Plugin feature flag is enabled. To enable the feature flag, follow these steps:
Open Visual Studio Code.
Go to Manage
> Settings.
Enter Teams Toolkit in the Search settings search box.
Under Extensions, select the Fx-extension: Develop Copilot Plugin checkbox.
To create a bot-based search message extension agent using Visual Studio Code, follow these steps:
Open Visual Studio Code.
From the left pane, select Teams Toolkit.
Select Create a New App.
Select Message Extension.
Select Custom Search Results.
Select Start with a Bot.
Select a programming language.
Select Default folder.
Enter the name of your app and select Enter. Teams Toolkit scaffolds your app and creates a message extension.
To run your message extension in Teams, follow these steps:
From the left pane, select Teams Toolkit.
Under ACCOUNTS, perform the following steps:
Select Sign in to Microsoft 365 and enter your Microsoft 365 credentials.
Select Sign in to Azure and enter your Azure credentials.
From the left pane, select Run and Debug (Ctrl+Shift+D).
Select Debug in Teams (Edge) or Debug in Teams (Chrome). Teams Toolkit launches your app in Teams using a web browser.
Select Add. The app is installed on Teams.
Go to a chat and select Actions and apps.
From the message extension fly-out menu, enter the name of your message extension in the search box.
Select your message extension and enter your search query.
Select a product from the list. Teams unfurls the product as an Adaptive Card in the message compose area.
Select Send.
Trigger message extension in Microsoft 365 Copilot
To trigger the message extension as agent in Microsoft 365 Copilot in Teams, follow these steps:
Select Apps.
Search for Copilot and open Microsoft 365 Copilot.
Select Panel from the top-right corner.
Select the required agent from the right pane.
From the message compose area, send a message to Microsoft 365 Copilot to search for the latest update from Teams and Microsoft 365 Copilot.
Note
This prompt might not always ensure a response from your message extension in Microsoft 365 Copilot. If this occurs, try different prompts or provide feedback by downvoting the Microsoft 365 Copilot response and leaving a message.
Before you get started, ensure that you install the following tools to build and deploy your message extension:
Install the Visual Studio Enterprise 2022 Preview version 17.9.0 Preview 1.0 or later and install the Microsoft Teams development tools under ASP.NET and web development workload.
Ensure that the Copilot feature flag is enabled. To enable the feature flag, follow these steps:
Open Visual Studio.
Go to Tools > Options.
Enter Teams Toolkit in the Search Settings search box.
In the Preview Features section, select the Teams Toolkit: Develop Copilot Plugin checkbox.
Ensure that the multi-project launch profile is enabled. To enable the profile, follow these steps:
Open Visual Studio.
Go to Tools > Options.
In the Preview Features section, select the Enable Multi-Project Launch Profiles checkbox.
To create a bot-based search message extension agent using Visual Studio, follow these steps:
Open Visual Studio.
Go to File > New > Project... or Create a new Project.
Search for Teams and select Microsoft Teams App.
Enter the project details. Ensure that the Place solution and project in the same directory checkbox isn't selected.
Select Create.
Select Custom Search Results.
Select Create. The project is scaffolded.
In the debug dropdown menu, select Dev Tunnels > Create a Tunnel.
Select the account to create the tunnel. Azure, Microsoft Account (MSA), and GitHub are the account types that are supported.
Name: Enter a name for the tunnel.
Tunnel Type: Select Persistent or Temporary.
Access: Select Public.
Select OK. Visual Studio displays a confirmation message that a tunnel is created.
The tunnel you created is listed under Dev Tunnels > (name of the tunnel).
Go to Solution Explorer and select your project.
Right-click the project menu and select Teams Toolkit > Prepare Teams App Dependencies.
If prompted, sign in with a Microsoft 365 account.
In the debug dropdown menu, select Microsoft Teams (browser). Visual Studio launches Teams web client.
Select Add. The message extension is added to Teams.
Go to a chat and select Actions and apps.
From the message extension fly-out menu, enter the name of your message extension in the search box.
Select your message extension and enter your search query.
Select a product from the list. Teams unfurls the product into an Adaptive Card in the message compose area.
Select Send. The Adaptive Card is sent to the chat.
Trigger message extension in Microsoft 365 Copilot
To trigger the message extension as agent in Microsoft 365 Copilot, follow these steps:
Go to Visual Studio.
In the debug dropdown, select Copilot (browser). Visual Studio launches Teams web client.
Go to Teams web client > Apps.
Search for Copilot and open Microsoft 365 Copilot.
Select Panel from the top-right corner.
Select the required agent from the right pane.
From the message compose area, send a message to Microsoft 365 Copilot to search for the latest update from Teams and Microsoft 365 Copilot.
Note
This prompt might not always ensure a response from your message extension in Microsoft 365 Copilot. If this occurs, try different prompts or provide feedback by downvoting the Microsoft 365 Copilot response and leaving a message.
Before you get started, ensure that you set the environment variable DEVELOP_COPILOT_PLUGIN to true. To set the environment variables, follow these steps:
On your computer, select the Windows + X key.
Select System.
Under About > Device specifications, select Advanced system settings.
Under System Properties, select Environment Variables...
Under User variables, select New... A New User Variable dialog opens.
Update the following fields:
Variable name: DEVELOP_COPILOT_PLUGIN
Variable value: true
Select OK.
To create a bot-based search message extension agent using Teams Toolkit CLI, follow these steps:
Go to Command Prompt.
Enter the following command:
npm install -g @microsoft/teamsapp-cli
Enter teamsapp new in the terminal.
Select Message Extension. Use the arrow keys to switch between options.
Select Custom Search Results.
Select Start with a Bot.
Enter the location for your project and select Enter.
Enter the name of your application and select Enter.
Teams Toolkit scaffolds and creates a project in the specified location.
Go to the folder path where your project is created and enter the following command to provision your app in Azure:
teamsapp provision --env dev
Teams Toolkit CLI opens a browser window and requests you to sign in to your Microsoft Account.
Sign in to your Microsoft account. Teams Toolkit CLI executes validation and provisions your app on Azure.
From the list, select a subscription.
From the list, select a resource group.
If you receive a message, which reads Cost may incur according to the usage. Do you want to provision resources in dev environment using accounts listed above?, enter Y.
Teams Toolkit validates your app manifest and provisions your app on Azure.
In the command prompt window, enter the following command to preview your app in Teams:
teamsapp preview --env dev
A new browser window with Teams web client opens. You can add your app to Teams.
Select Add. The message extension is added to Teams.
Go to a chat and select Actions and apps.
From the message extension fly-out menu, enter the name of your message extension in the search box.
Select your message extension and enter your search query.
Trigger message extension in Microsoft 365 Copilot
To trigger the message extension as agent in Microsoft 365 Copilot in Teams, follow these steps:
Select Apps.
Search for Copilot and open Microsoft 365 Copilot.
Select Panel from the top-right corner.
Select the required agent from the right pane.
From the message compose area, send a message to Microsoft 365 Copilot to search for the latest update from Teams and Microsoft 365 Copilot.
Note
This prompt might not always ensure a response from your message extension in Microsoft 365 Copilot. If this occurs, try different prompts or provide feedback by downvoting the Microsoft 365 Copilot response and leaving a message.
To create a bot-based message extension using Developer Portal for Teams, follow these steps:
In the Add apps page, update the name and select the manifest version as Public developer preview (devPreview).
Under Configure, select App features.
Select Messaging extension.
Under Message extension type, select Bot.
If you get a disclaimer, which reads API Message extension is already in use by users. Would you like to change message extension type to bot?. Select Yes, change.
If you have an existing bot, select Existing bot or if you have a bot ID, select Enter Bot ID.
If you don't have a Bot ID, you can select Create a new bot, to create a new bot and enter the bot ID of the new bot that you've created.
Select Save.
Under Command, select + Add a command.
Add a command page appears.
In the Add a command page, select the Search as the type of command and update the following fields:
Command ID
Command title
Command description
Context in which the command works
Parameter name
Parameter title
Parameter description
Select Save. The command is added to the message extension.
Select Save.
A bot-based search message extension is created.
To test your bot-based message extension created in the Developer Portal for Teams, you can use the following methods:
Preview in Teams: In Developer Portal, open your message extension and select Preview in Teams in the upper-right corner. You're redirected to Teams, where you can add the app to Teams to preview the app.
Download app package: On the message extension page, select App package from the left pane and then, in the upper-left corner of the window, select Download app package. The app package is downloaded to your local machine in a .zip file. You can upload the app package to teams and test the message extension.
Enable message extension as a plugin for Copilot for meetings
Ensure that you've created a bot-based message extension and extended it as a plugin for Microsoft 365 Copilot. Before you get started, follow the guidelines listed in ensure your Copilot plugins work in Teams meetings to extend your plugin for Copilot for meetings.
To enable message extension as a plugin for Copilot for meetings, follow these steps:
Go to a Teams meeting.
Select Join.
In the meeting window, select Copilot.
Select Start transcription.
Select the Spoken language and select Confirm. The Copilot for Teams pane appears.
In the Copilot for Teams pane, at the bottom-right corner, select the Copilot Plugin Button.
Search for your plugin and turn on the toggle for your plugin.
From the compose area, select More prompts to send a static prompt or you can type your own prompt and select Send.
Copilot for meetings helps your meetings to be better and more productive. You can make meetings more interactive, which helps users by giving them a smoother and more interesting experience.
Step-by-step guide
Follow the step-by-step guide to build a bot-based search message extension agent for Microsoft 365 Copilot.
The source for this content can be found on GitHub, where you can also create and review issues and pull requests. For more information, see our contributor guide.
Platform Docs feedback
Platform Docs is an open source project. Select a link to provide feedback:
Learn how to build message extensions that allow users to interact with external services within their flow of work in Microsoft Teams and Microsoft 365 Copilot.