Step-by-Step Guide to Creating a Copilot Declarative Agent Using Teams Toolkit
A Copilot Declarative Agent lets you automate tasks in Microsoft 365 and Teams. You can use it to answer questions. It can summarize documents. It gives real-time support in a familiar interface. Many groups see good results like better teamwork. They get faster replies. Their data stays safe.
You will learn how to connect custom APIs. You will bring in data. You will show results in a visual way.
Key Takeaways
Get your computer ready by installing Visual Studio Code, Node.js 18.x LTS, and the Teams Toolkit extension. Make sure you have a Microsoft 365 tenant with admin rights.
Make your Copilot Declarative Agent in Visual Studio Code with Teams Toolkit. Upload your OpenAPI document. Set up the manifest with clear actions and permissions.
Link your agent to custom APIs and outside data sources in a safe way. Use Microsoft Graph Connectors and Azure services to make your agent better.
Add knowledge sources like SharePoint, Teams messages, and web search. This helps your agent get smarter and give better answers to users.
Test your agent well with local tools. Use Adaptive Cards to show data clearly. Keep your agent updated and safe by following best practices.
Get Started with Teams Toolkit
Prerequisites
Check that you have the right tools and accounts before starting. You need the newest Visual Studio Code. You must install Node.js version 18.x LTS. Add the Teams Toolkit extension (version 5.0) from the Visual Studio Code marketplace. You can use Windows, Mac, or Linux for this. You need a Microsoft 365 tenant with admin permissions. Make sure custom app upload is turned on in Teams.
💡 Tip: Try using Microsoft Edge or Google Chrome. These browsers work well with Teams Toolkit.
You do not need to worry about your computer’s hardware. The documentation does not say you need a certain CPU, RAM, or disk space.
Environment Setup
Update all your tools first. This helps stop errors and keeps things working well. Install Visual Studio Code and Node.js before anything else. Add the Teams Toolkit extension from the marketplace. Open Visual Studio Code and check if the extension is in your sidebar.
You can use tools like Ansible or Chef to set up your environment. Docker helps keep everything the same for everyone. Put your setup scripts in a shared place. This lets your team find and use them easily.
If you have problems, try these steps:
Update your tools and libraries.
Use npm to handle dependencies.
Look at logs to find errors.
Write down any problems and how you fixed them.
Teams Toolkit now works with declarative agents. You can make agents using JSON or YAML manifest files. The toolkit gives you fast debugging, live reloading, and secure tunneling. You get Single Sign-On and built-in hosting. You can publish agents to Microsoft 365 Copilot, Teams, websites, and more.
🛠️ Note: Keep your tools updated and write clear notes. This helps you fix setup problems faster.
Build a Copilot Declarative Agent
Create a New Project
You can make your Copilot Declarative Agent in Visual Studio Code. Use the Teams Toolkit extension to help you. Here are the steps to start your project:
Open Visual Studio Code on your computer.
Check that the Teams Toolkit extension is installed.
Go to the Teams Toolkit sidebar and pick Create a New App.
Pick Copilot Agent for your app type.
Choose Declarative Agent for your project type.
To add actions, click Add plugin and pick Start with an OpenAPI Description Document.
Give your OpenAPI specification. You can paste a URL or upload a JSON or YAML file.
Pick the API operations you want, like
GET /policies
orPOST /policies
.Choose a folder and name for your project, such as
PolicyManagementAgent
.Visual Studio Code will open a new window with your Copilot Declarative Agent project.
Follow any prompts to install extra extensions or set up the app.
Sign in to your Microsoft 365 account if needed.
Look at your project files and try to provision the app to test it.
📝 Tip: Always check your OpenAPI document for mistakes before you upload it. This helps your agent connect to APIs without problems.
Configure the Agent Manifest
The manifest is very important for your Copilot Declarative Agent. It tells Microsoft 365 Copilot and Teams what your agent can do. You will see a manifest file in your project, usually as JSON or YAML. This file has your agent’s name, description, permissions, and actions.
To set up your manifest:
Open the manifest file in Visual Studio Code.
Fill in the agent’s name, description, and version.
Add a short summary of what your agent does. For example, “This agent helps manage company policies by connecting to the Policy Management API.”
List the actions your agent can do. Each action should match something from your OpenAPI document.
Set permissions for each action. Only give the permissions your agent really needs.
Add sample prompts to help users. For example, “Show me all active policies.”
💡 Best Practice: Use simple words in your manifest. Describe each action with clear verbs like “search,” “list,” or “update.” This helps users and Copilot know what your agent can do.
Define Capabilities
Capabilities are the things your Copilot Declarative Agent can do. You set these by picking and setting up actions in your manifest. Each action connects to an API operation. This lets your agent do business tasks or work with other systems.
When you set up capabilities:
Pick actions that fit your business needs. For example, if you want your agent to get policy details, choose the
GET /policies
operation.Use clear words for each capability. For example, “search for policies by status” or “update a policy record.”
Make workflows with easy, step-by-step instructions. This makes your agent simple to use and understand.
Mention knowledge sources and actions right in your instructions.
Give examples for hard tasks. For example, show how to get a list of expired policies.
Do not repeat the same phrases or make your instructions too long.
Test your agent often. Create, publish, and improve your instructions to help your agent respond better.
🚀 Note: The actions you pick decide what your Copilot Declarative Agent can do. Good actions let your agent do tasks, connect to other systems, and give real-time results. For example, your agent can read from a database, send updates, or get live data from a policy management system.
🛡️ Tip: Always explain parameters clearly. Give each parameter a special name and a short, clear description. This helps your agent answer the right way and keeps your manifest neat.
By following these steps and tips, you will have a Copilot Declarative Agent that is strong, safe, and easy to use. Now you can start adding data and connect your agent to other sources.
Integrate Data and External Connections
Custom API Integration
You can link your Copilot Declarative Agent to custom APIs with Teams Toolkit. This helps your agent get data from other places, like a Policy Management system. Teams Toolkit gives you different ways to make these connections. Here are some common methods:
You can set up these connections from the Teams Toolkit sidebar or the Command Palette in Visual Studio Code. For example, you can make an Azure Function that links to your Policy Management API. This function gets policy data and sends it to your agent.
🔒 Security Tip: Always use safe APIs and cloud resources. Protect important data by following Microsoft 365 security and privacy rules.
Data Ingestion Process
To bring outside data into Microsoft 365, you need a safe data ingestion process. First, connect your custom API to your agent. Use OpenAPI specifications to show your endpoints. Test each connection to make sure your agent can read and write data.
When you connect outside APIs, remember these safety steps:
Limit sensitive actions unless someone checks them.
Use Microsoft 365 access controls to decide who can use your agent.
Make sure your agent follows Microsoft’s privacy and compliance rules.
Design your agent to avoid risky actions if you use unknown data.
You can use a pretend Policy Management data source as an example. Set up an API that lists, updates, or deletes company policies. Connect this API to your agent so users can manage policies in Teams.
Microsoft Graph Connectors
Microsoft Graph Connectors help your agent find and use data from many outside systems. These connectors index content from places like websites, file shares, and databases. Your agent can answer questions using this outside data, even if it is not in Microsoft 365.
Graph Connectors follow your organization’s permissions. They keep your data safe and follow the rules. You can use connectors for many jobs, such as:
Helping customer support teams find answers in CRM or ticketing systems.
Getting onboarding info from HR platforms.
Giving sales teams quick access to account data.
Helping with compliance by searching policy records.
By linking outside data to Microsoft Graph, your agent sees more information. This helps you get better answers and makes teamwork easier across your organization.
Enhance and Demonstrate the Agent
Add Knowledge Sources
You can make your Copilot Declarative Agent smarter by adding more knowledge sources. These sources help your agent answer more questions and give better help. Here is a table that shows some common knowledge sources you can add:
Starter prompts help users know what to ask your agent. These prompts show up when someone opens your agent. They remind users what your agent can do and help them start a chat. For example, prompts like “create a support ticket” or “check request status” help users and make it easier to use the agent.
💡 Starter prompts help users get answers faster. They also keep chats focused on real tasks.
To add SharePoint or Teams connectors, follow these steps:
Make your agent in Copilot Studio.
Add prompts for natural language actions.
Connect SharePoint or Teams as knowledge sources.
Use Power Platform connectors to give your agent more features.
Update instructions and test your agent.
Publish your agent to Microsoft 365 Copilot and Teams.
Set user permissions if needed.
Adaptive Card Visualization
Adaptive cards help you show data clearly inside Teams. Use these best tips:
Keep cards simple and focus on one job.
Use the same card style for all messages.
Add a “Cancel” button for actions.
Check user input with built-in checks.
Use the Adaptive Card Designer to build and test cards.
Make sure cards work on desktop, web, and mobile.
Group related items for better order.
🖼️ Adaptive cards make your agent’s answers easy to read and use.
Debug and Provision
Test your Copilot Declarative Agent before you share it. Try these steps:
Use Teams Toolkit’s local testing tools.
Check if your agent connects to all knowledge sources.
Watch for errors in logs and fix them.
Ask users to try your agent and give feedback.
You can see if your agent works well by checking if it gives the right answers, how many questions it solves, and if users like using it. This helps you make your agent better for everyone.
You now know how to make a Copilot Declarative Agent with Teams Toolkit. First, build your agent in Visual Studio Code. Next, set up the manifest and choose actions. Test your agent in Copilot chat. Add knowledge sources to help your agent give better answers. You can use cool features like Adaptive Cards. You can also connect more data sources, like SharePoint or CRM systems. If you want to learn more, check out Microsoft Copilot Studio and Teams Toolkit guides. When you finish, publish your agent and update your notes often.
FAQ
How do you update your Copilot Declarative Agent after publishing?
Open your project in Visual Studio Code. Change the manifest or actions if needed. Use Teams Toolkit to publish your agent again. Users get the new updates after you finish.
Can you connect more than one API to your agent?
Yes, you can add more APIs. Use an OpenAPI description for each API. List every action in your manifest. This lets your agent do different jobs from different places.
What should you do if your agent cannot access data?
Check your API connection and permissions first. Make sure your manifest has the right endpoints. Look at Teams Toolkit logs to find mistakes. Fix problems and test your agent again.
Is it possible to test your agent before sharing it with others?
You can use Teams Toolkit’s local testing tools. Run your agent in a test space. Try out different actions and see what happens. Fix any problems before you share your agent.
How do you keep your agent secure?
Always use safe APIs. Give only needed permissions in your manifest. Store secrets in Azure Key Vault. Follow Microsoft 365 security rules to keep your data and users safe.