Exercise - Scaffold a new declarative agent

Completed

In this exercise, learners will scaffold a new declarative agent using the Microsoft 365 Agents Toolkit and TypeSpec within Visual Studio Code, gaining foundational knowledge of declarative agents and their integration with Microsoft 365 Copilot.

Task 1: Set up a new declarative agent project in Visual Studio Code

Goal: Create a new declarative agent project using the Microsoft 365 Agents Toolkit in Visual Studio Code. This step sets up the foundational structure for your agent.

  1. Open Visual Studio Code on your computer.
  2. Install the Microsoft 365 Agents Toolkit Visual Studio Code extension if it isn't already installed.
  3. In the Visual Studio Code sidebar, select Microsoft 365 Agents Toolkit > Create a New Agent/App. A screenshot shows the Create a New App button in the Microsoft 365 Agents Toolkit sidebar.
  4. From the options presented, select Declarative Agent. A screenshot shows the New Project options with Agent selected.
  5. Choose Start with TypeSpec for Microsoft 365 Copilot to create a basic declarative agent.
  6. Select Default folder to store your project root folder in the default location.
  7. Enter My Agent as the Application Name and press Enter.

Task 2: Provision agent resources

Goal: Configure the declarative agent by naming the application and provisioning it within the Microsoft 365 Agents Toolkit.

  1. In the new Visual Studio Code window, select Microsoft 365 Agents Toolkit from the sidebar.
  2. Navigate to the Lifecycle pane and select Provision to provision the agent. A screenshot shows the Provision option in the Lifecycle pane of the Microsoft 365 Agents Toolkit.
  3. Wait for the provisioning process to complete. This step prepares the agent for testing and integration.

Task 3: Test your declarative agent in Microsoft 365 Copilot

Goal: Test the functionality of the declarative agent in the Microsoft 365 Copilot environment to ensure it works as expected.

  1. Open a web browser and navigate to the Microsoft 365 Copilot application.
  2. Next to the New Chat button, select the conversation drawer icon.
  3. Locate and select the declarative agent named My Agent. A screenshot shows the declarative agent in Copilot.
  4. Enter a question or prompt for the declarative agent to test its response.

Check your work: Test the newly created declarative agent

To verify the agent's functionality:

  1. Ensure that the agent responds to your input in the Copilot environment.
  2. Confirm that the responses align with the basic functionality expected from a declarative agent.