แก้ไข

Tutorial: Create declarative agents by using Microsoft 365 Agents Toolkit and JSON

A declarative agent provides a goal-directed conversational experience powered by Microsoft 365 Copilot. You define its purpose, instructions, knowledge, and actions. This guide provides information about how to build a declarative agent by using Microsoft 365 Agents Toolkit.

The agent that you build in this tutorial targets licensed Microsoft 365 Copilot users. You can also build agents for Microsoft 365 Copilot Chat users, with limited capabilities. For details, see Microsoft 365 Copilot developer licenses.

Note

Microsoft 365 Government tenants don't support publishing agents through Agents Toolkit.

Tip

Work IQ Dev Tools (preview) and Microsoft 365 Agents Toolkit provide related pro-code workflows. To choose based on your capability, package route, and target experience, see Choose development tools for your plugin.

Screenshot shows the answer from the declarative agent in Microsoft 365 Copilot.

For overview information, see Declarative agents for Microsoft 365 Copilot. To compare agent types, see Compare declarative and custom engine agents.

Note

Declarative agents based on Microsoft 365 Copilot are now supported in Word and PowerPoint.

Prerequisites

The following resources are required to complete the steps described in this article:

Note

The screenshots and user-interface references in this article use a release version of Microsoft 365 Agents Toolkit. Prerelease versions might differ from the user interface shown.

You should be familiar with the following standards and guidelines for declarative agents for Microsoft 365 Copilot:

Create and provision a declarative agent with Microsoft 365 Agents Toolkit

Start by creating a basic declarative agent.

  1. Open Visual Studio Code.

  2. Select Microsoft 365 Agents Toolkit > Create a New Agent/App.

    A screenshot of the Create a New Agent/App button in the Agents Toolkit sidebar

  3. Select Declarative Agent.

    A screenshot of the New Project options with Agent selected

  4. Select No Action to create a basic declarative agent.

  5. Select Default folder to store your project root folder in the default location.

  6. Enter My Agent as the Application Name and press Enter.

  7. In the new Visual Studio Code window that opens, select Microsoft 365 Agents Toolkit, then select Provision in the Lifecycle pane.

    A screenshot of the Provision option in the Lifecycle pane of Agents Toolkit

Test the agent

  1. Go to the Copilot application at https://m365.cloud.microsoft/chat.

  2. Next to the New Chat button, select the conversation drawer icon.

  3. Select the declarative agent My Agent.

    A screenshot of the declarative agent in Copilot

  4. Enter a question for your declarative agent and make sure it replies with "Thanks for using Microsoft 365 Agents Toolkit to create your declarative agent!"

    A screenshot of an answer from the declarative agent in Microsoft 365 Copilot

Next step