Exercise - Scaffold a new declarative agent
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.
- Open Visual Studio Code on your computer.
- Install the Microsoft 365 Agents Toolkit Visual Studio Code extension if it isn't already installed.
- In the Visual Studio Code sidebar, select Microsoft 365 Agents Toolkit > Create a New Agent/App.
- From the options presented, select Declarative Agent.
- Choose Start with TypeSpec for Microsoft 365 Copilot to create a basic declarative agent.
- Select Default folder to store your project root folder in the default location.
- Enter
My Agentas 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.
- In the new Visual Studio Code window, select Microsoft 365 Agents Toolkit from the sidebar.
- Navigate to the Lifecycle pane and select Provision to provision the agent.
- 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.
- Open a web browser and navigate to the Microsoft 365 Copilot application.
- Next to the New Chat button, select the conversation drawer icon.
- Locate and select the declarative agent named My Agent.
- 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:
- Ensure that the agent responds to your input in the Copilot environment.
- Confirm that the responses align with the basic functionality expected from a declarative agent.