Home Build a Declarative M365 Copilot Agent Using VS Code and Teams CLI
Post
Cancel

Build a Declarative M365 Copilot Agent Using VS Code and Teams CLI

Summary

With the rise of Microsoft 365 Copilot, businesses are looking for ways to build AI-powered assistants that seamlessly integrate with Microsoft Teams. A declarative agent is a lightweight, low-code solution that leverages AI Plugins and Adaptive Cards to process user input.

Prerequisites

Before you get started, make sure you have the following:

1
npm install -g @microsoft/teamsfx-cli

Step 1: Create a New Declarative Agent in VS Code

  1. Run the following command in the terminal to create a new project using the Teams Toolkit:
1
2
teamsapp new --capability "declarative-agent" --app-name "Toolkit CLI DA Blog Sample" -folder "ToolkitAgent" --interactive false
 --debug --verbose --with-plugin no
  1. Open project in VS Code
1
2
cd "ToolkitAgent\Toolkit CLI DA Blog Sample"
code .

This will create same structure as using Teams Toolkit in VS Code. From here you can start developing your declarative agent. I have been exploring Microsoft 365 Community (PnP) Copilot Pro Dev scenarios

  1. Login to M365
1
teamsapp auth login m365
  1. Package and install the app in Teams
1
2
3
teamsapp package
# Install the app in Teams
teamsapp install --file-path ./appPackage/build/appPackage.dev.zip

you should get response like

1
2
3
4
PS C:\Projects\temp\ToolkitAgent\Toolkit CLI DA Blog Sample> teamsapp install --file-path ./appPackage/build/appPackage.dev.zip
Using YOUR M365 USER
TitleId: U_283c7972-ec29-d062-a3a0-a0e71c5293bc
AppId: 8677e1f5-9757-4814-bf24-6b2a0429d9c9

to see app go to https://m365.cloud.microsoft/chat

Conclusion

I am excited to see how the declarative agent can be used in various scenarios. Personaly, tried very little yet but with amazing samples available in Microsoft 365 Community (PnP) Copilot Pro Dev scenarios it is easy to get started.

This post is licensed under CC BY 4.0 by the author.

Build a Declarative M365 Copilot Agent Using VS Code Teams Toolkit

-