Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Important
API plugins are only supported as actions within declarative agents. They are not enabled in Microsoft 365 Copilot.
API plugins connect your existing REST API to Microsoft 365 Copilot. You can use the Microsoft 365 Agents Toolkit (an evolution of Teams Toolkit) to generate a plugin from an existing REST API with an OpenAPI specification.
Prerequisites
- Requirements specified in Requirements for Copilot extensibility options
- An existing REST API with an OpenAPI specification (this walkthrough uses the Budget Tracker sample API)
- Visual Studio Code
- Microsoft 365 Agents Toolkit
Tip
For the best results, make sure that your OpenAPI specification follows the guidelines detailed in How to make an OpenAPI document effective in extending Copilot.
To follow along with this guide, download the Budget Tracker sample API and configure it to run on your local development machine. Build the sample at least once to generate the BudgetTracker.json file for the API.
Create the plugin
Note
The screenshots and references to user interface of the Microsoft 365 Agents Toolkit (an evolution of Teams Toolkit) in this document were generated using the latest Release version, 6.0. Pre-Release versions of Agents Toolkit may differ from the user interface in this document.
API plugins are a ZIP file that contains the following files.
- The OpenAPI specification for the REST API.
- An API plugin manifest that references the included OpenAPI specification and describes the available operations, authentication method, and response formats.
Open Visual Studio Code. If Agents Toolkit isn't already installed, see Install Agents Toolkit for installation instructions.
Select the Microsoft 365 Agents Toolkit icon in the left-hand Activity Bar.
Select Create a New Agent/App in the Agents Toolkit task pane.
Select Declarative Agent.
Select Add an Action, then select Start with an OpenAPI Description Document.
Select Browse and browse to the ___location of the OpenAPI specification from the Budget Tracker sample, located at ./openapi/BudgetTracker.json.
Select all the operations to enable for the plugin.
Choose a ___location for the API plugin project.
Enter
Budget Tracker
as a name for the plugin.
Once you complete these steps, Agents Toolkit generates the required files for the plugin and opens a new Visual Studio Code window with the plugin project loaded.
Note
If your identity server requires Proof Key for Code Exchange (PKCE), uncomment the following line in m365agents.yml in the API plugin project.
# isPKCEEnabled: true
Package and sideload the plugin
Open the plugin project in Visual Studio Code.
Select the Microsoft 365 Agents Toolkit icon in the left-hand Activity Bar.
In the Accounts pane, select Sign in to Microsoft 365. (If you're already signed in continue to the next step).
Confirm that both Custom App Upload Enabled and Copilot Access Enabled display under your Microsoft 365 account. If they don't, check with your organization admin. See Requirements for Copilot extensibility options for details.
In the Lifecycle pane, select Provision.
When asked to Enter client id for OAuth registration..., enter your Plugin client ID.
When asked to Enter client secret for OAuth registration..., enter your Plugin client secret.
Read the message in the dialog and select Confirm to continue.
Wait for the toolkit to report that is finished provisioning.
Your plugin is now available to test with your user account in Microsoft 365 Copilot in Microsoft Teams.
Use the plugin
Open Teams in your browser and sign in with the Microsoft 365 account you used to upload your plugin.
Select Chat in the left-hand Activity Bar.
Select Copilot in the Chat pane.
Select Budget Tracker in the Agents list on the right-hand side. If the list isn't available, select the Copilot chats and more icon in the top right corner.
Ask a question about budgets. For example, try
How much is left in the Fourth Coffee lobby renovation budget?
. When prompted, choose Always allow or Allow once to proceed.When asked to sign in, select Sign in to Budget Tracker.