Use declarative agents to extend Microsoft 365 Copilot. You define custom knowledge to create agents that can answer questions using authoritative content.
Suppose you work in a customer support team. You and your team handle queries about products that your organization makes from customers. You want to improve response times and provide a better experience. You store documents in a document library on a SharePoint Online site that contains product specifications, frequently asked questions, and policies for handling repairs, returns, and warranties. You want to be able to use natural language to query information in these documents and get answers quickly to customer queries.
Here, you create a declarative agent which can answer product support questions using information stored in documents in Microsoft 365:
By the end of this module, you'll demonstrate your ability to create a declarative agent for Microsoft 365 Copilot that can answer questions using information from documents.
You'll be building a declarative agent for Microsoft 365 Copilot that's grounded in your documents. Here, we discuss the project business logic and target behavior. We also cover the accounts and software you'll need.
The declarative agent:
- is available within Microsoft 365 Copilot
- provides examples of how users can ask it questions
- answers a user's questions using the information from the referenced documents
- in the answer, includes a reference to the relevant document
- politely refuses answering questions not related to its function
- admits when it doesn't have relevant information to answer a user's question
To complete this challenge, you need a Microsoft 365 tenant with the Microsoft 365 Copilot license, Visual Studio Code and the Teams Toolkit extension.
To complete this exercise, you need a Microsoft 365 tenant with the Microsoft 365 Copilot license. You access Microsoft 365 Copilot through the Microsoft 365 tenant. You need the Microsoft 365 Copilot license to get access to semantic index and be able to ground agents in work documents.
Here we provide sample documents for you to use in the challenge. The documents contain product specifications and frequently asked questions about specific Contoso Electronics products. Upload them to your OneDrive or an existing SharePoint site so that they're available for use in the declarative agent you'll build.
Important
Upload the files to OneDrive or an existing SharePoint site so that they're immediately available for you to use. If you choose to use a new SharePoint Online site, the documents will take longer to be indexed and available for use by Copilot.
You'll build the agent using Visual Studio Code. Visual Studio Code is an IDE that provides you with tooling to build agents for Microsoft 365 Copilot. To install Visual Studio Code for your operating system, visit https://code.visualstudio.com/.
Teams Toolkit is a Visual Studio Code extension that helps developers build agents for Microsoft 365 Copilot. It provides you with the project boilerplate and tasks to automate building and deploying agents. To install the Teams Toolkit extension for Visual Studio Code visit https://marketplace.visualstudio.com/items?itemName=TeamsDevApp.ms-teams-vscode-extension.
To get started, use the Teams Toolkit to create a new app with the declarative agent without an action template.
The customer support teams needs an agent that answers their questions using information from documents stored in Microsoft 365. Here, you start building a declarative agent. You'll validate how it's working against requirements to check your work.
The declarative agent:
- is available within Microsoft 365 Copilot
- provides examples of how users can ask it questions
- politely refuses answering questions not related to its function
At this point, you have a declarative agent with custom instructions and examples of questions that the users might ask. The agent is visible in Microsoft 365 Copilot chat.
- Navigate to Microsoft 365 Copilot chat. Is your agent visible?
- In Microsoft 365 Copilot chat, navigate to the agent. Does it show examples of the questions that a user might ask?
- Ask a question not related to Contoso products. Does the agent politely refuse to answer it?
The customer support teams needs an agent that answers their questions using information from documents stored in Microsoft 365. Here, you extend your declarative agent and ground it in your documents. You'll validate how it's working against requirements to check your work.
The declarative agent:
- answers a user's questions using the information from the referenced documents
- in the answer, includes a reference to the relevant document
- politely refuses answering questions not related to its function
- admits when it doesn't have relevant information to answer a user's question
At this point, you have a fully functional declarative agent grounded in work documents. The agent answers questions about products using the information from the referenced documents
- Navigate to your agent. Ask it a question about one of the products from the referenced documents. Does the agent answer using the information from the document?
- Does the answer include a reference to the document?
- Is the reference pointing to the correct document?
- Ask another question, this time about something that's not in the referenced documents. Does the agent admit that it doesn't have the information to answer the question?
- Ask a question not related to Contoso products. Does the agent politely refuse to answer it?