How to Ingest and Visualize Data Using Copilot Declarative Agent and Teams Toolkit
You can build a Copilot Declarative Agent using Teams Toolkit to make your workflow smarter. Start by using Visual Studio Code to create a custom API. Connect this API with Microsoft 365 so you can bring in your data from any source. You will see how easy it is to visualize your data and get instant insights. This hands-on process helps you learn by doing.
Key Takeaways
Begin making your Copilot Declarative Agent with Visual Studio Code and the Teams Toolkit. This setup lets you build a custom API and link it to Microsoft 365 for data.
Link your agent to trusted data sources like Microsoft Graph connectors or Azure Data Lake. This helps your agent give better answers and insights.
Use adaptive cards to show your data in Microsoft Teams. Make these cards with simple layouts and actions to help users understand and use them.
Test and update your agent often by listening to user feedback. This keeps your agent useful and helps your team.
Follow best ways to write instructions and fix common problems. Clear steps help your agent work well and stop mistakes.
Prerequisites
Tools Needed
You need some tools before you build your Copilot Declarative Agent. These tools help you make, test, and share your agent fast. Here is a table that lists the best tools and what they do:
You also need Visual Studio Code. This editor lets you write code and keep your files organized. Teams Toolkit is an add-on for Visual Studio Code. It helps you link your agent to Microsoft Teams and Microsoft 365.
Tip: Make sure you can use Microsoft 365. You do not need a Copilot license for basic agent work. If your agent needs company data, you need billing or a Copilot license. Your admin must turn on sideloading for custom apps in Teams. The Copilot Studio app must be set up by your Microsoft 365 admin.
Environment Setup
Getting your environment ready is important for easy development. Follow these steps to set up your workspace:
Install Visual Studio Code and add the Teams Toolkit extension.
Sign in to your Microsoft 365 account.
Ask your admin to turn on sideloading for custom apps in Teams.
Make sure generative AI features are turned on by your Power Platform or Dynamics 365 admin.
Deploy the Copilot Studio app in your tenant.
To keep your environment safe and working well, use clear steps for your agent. Break your work into small tasks. Use headers and lists to keep things neat. Give examples if you need to show hard actions. Test your agent a lot and change your steps if you get feedback.
Note: Write your steps in Markdown. This makes it easy for you and others to read and follow your workflows.
Copilot Declarative Agent Setup
Agent Creation
You can use Teams Toolkit in Visual Studio Code to build your Copilot Declarative Agent. This lets you make an agent that can answer questions and work with data in Microsoft 365. Here are the steps to set up your agent:
Open Visual Studio Code.
Click on Microsoft 365 Agents Toolkit and pick "Create a New Agent/App".
Choose "Declarative Agent" from the list.
Pick "No Action" to make a simple agent.
Use the default folder for your project files.
Name your app
My Agent
and press Enter.In the new Visual Studio Code window, click Microsoft 365 Agents Toolkit, then click "Provision" in the Lifecycle pane.
When you finish these steps, you can test your Copilot Declarative Agent. Go to the Copilot app at https://[m365](https://www.linkedin.com/school/m365-show/).cloud.microsoft/chat. Find the "New Chat" button and click the conversation drawer icon next to it. Pick your agent, "My Agent", and ask it a question. Your agent should send a welcome message back.
Tip: If you have problems making your agent, try clearing your browser cache and cookies. You can also use incognito mode or try a different browser. Logging out and back in, restarting your computer, or using another laptop might help. If nothing works, make a new agent in Copilot Studio to start over.
External Connection
Connecting your Copilot Declarative Agent to outside data sources makes it stronger. You can use Microsoft Graph connectors and custom API plugins to help your agent get and use data from many places.
Microsoft Graph connectors let your agent use data inside Microsoft 365. Your agent can answer questions using info from SharePoint, Outlook, or Teams.
Custom API plugins give your agent new abilities. Your agent can get or write data right away, which helps your business.
When you set up consumption billing, your agent can use Copilot connectors and SharePoint content. This lets your agent answer questions using your company’s data.
Here are some good things about using these tools:
Your Copilot Declarative Agent can work with Microsoft 365 Copilot.
You can make cool experiences for users.
Your agent can reach outside data sources and bring them into Microsoft Graph.
Note: Always use trusted data sources when you connect your agent to outside systems. Untrusted data can cause security issues or make your agent act in strange ways. Sensitive actions should have a person check them to keep your data safe.
Your Copilot Declarative Agent is more helpful when it connects to the right data. You can help your team get answers faster and make better choices.
Data Ingestion
Connect Data Source
You must connect your Copilot Declarative Agent to a data source first. In this example, you will use a fake Policy Management data source. Many groups use different places to keep their data. Some popular choices are built-in Graph connectors and Azure Data Lake. These sources help you bring outside data into Microsoft 365. This makes your agent smarter.
To connect your data source, do these steps:
Open Visual Studio Code.
Click the left side and pick Teams Toolkit.
Click Create a New App.
Pick Agent.
Choose Declarative Agent.
Pick No plugin to keep it easy.
Name your Copilot
RESTCountries
or use a name you like.
You need Visual Studio Code and the Teams Toolkit extension. Follow Microsoft’s setup steps so you do not have problems.
When you set up your agent, you can add the connection in your config file. Here is a code block that shows how to connect to a data source with a Graph connector:
{
"$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.2/schema.json",
"version": "v1.2",
"name": "RESTCountries",
"description": "This is a declarative agent designed to assist with searching for country information.",
"instructions": "$[file('instruction.txt')]",
"capabilities": [
{
"name": "GraphConnectors",
"connections": [
{
"connection_id": "restcountries"
}
]
}
]
}
You can use Copilot in Process Mining ingestion to find processes. It helps you match your data to the right schema. This makes it easier to organize your data as you bring it in.
Import Data
After you connect your data source, you need to bring the data into Microsoft 365. There are many ways to do this. The way you choose depends on what you know and what you need. Here are some common ways to import data with custom APIs:
Pick the way that works best for your team. If you like to code, use a C# console app or PowerShell script. If you do not want to code, use Azure Data Factory templates.
Here is a simple example of using a PowerShell script to bring in your policy data:
# Import policy data into Microsoft 365 using a custom API
$apiUrl = "https://your-api-endpoint.com/import"
$zipFile = "C:\Data\policydata.zip"
Invoke-RestMethod -Uri $apiUrl -Method Post -InFile $zipFile -ContentType "application/zip"
Always check your data before you import it. Make sure your files are in the right format. Also, check that your API endpoint is safe.
After you bring in your data, your Copilot Declarative Agent can use it. It can help answer questions or give insights. This helps you manage your policies better. Your team will get the information they need.
Visualization
Adaptive Cards
You can show your data in Microsoft Teams with adaptive cards. Adaptive cards help you make views that look nice and are easy to use. You design these cards using JSON. You can put text, images, buttons, and input fields on them. This helps people read and use your data easily.
Here are some tips for making adaptive cards:
Keep your JSON short and use small images so cards load fast.
Make sure people can use keyboard shortcuts and screen readers.
Add backup options for things that might not work everywhere.
Put related things together in containers to keep your card neat.
Use checks to help users enter the right information.
Make your card work with different types of content.
Test your card on computers and phones to see if it looks good.
Adaptive cards let you add actions like buttons or forms. You can use templates to keep your data and layout separate. This makes it easy to update your cards. You can also use special markup and changing content to make your cards more fun.
Here is a simple adaptive card example for policy data:
{
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{
"type": "TextBlock",
"text": "Policy Name: Data Retention",
"weight": "Bolder"
},
{
"type": "TextBlock",
"text": "Status: Active"
},
{
"type": "Image",
"url": "https://example.com/policy-image.png",
"size": "Small"
}
],
"actions": [
{
"type": "Action.OpenUrl",
"title": "View Details",
"url": "https://example.com/policy-details"
}
]
}
Data Views
You can show your data in different ways to help people understand it. Use dashboards, lists, and forms to organize your information. Dashboards let people see many things in one place. You can add filters so people find what they need fast. Lists help people look through related items. Forms help people give information with clear labels.
Here is a table with best ways to design data views in Teams:
You can use the Copilot Declarative Agent to power these views. This helps your team get answers and insights quickly. Try different layouts and tools to see what works best for your users.
Implementation
Debugging
You must check if your Copilot Declarative Agent works right before sharing it. First, turn on Developer Mode in Microsoft 365 Copilot Chat. Type -developer on
to start this mode. When you test your agent, you will see a debug card. This card shows things like agent metadata, what it can do, and actions.
Use Developer Mode to see how your agent answers questions.
Check the debug card to know which features are working.
Track the agent ID and conversation ID for each test.
Look for messages that show if things worked or failed.
You can use observability tools to learn more about your agent’s actions. These tools let you see what happens in each chat. If you find a problem, change your agent’s settings or update its instructions. Test again to see if you fixed the problem.
Tip: Test your agent many times. Even small changes can help your agent work better for users.
Provisioning
When you finish testing, you need to publish your agent so others can use it. Follow these steps to move from building to sharing:
Make your agent by picking Agents in the left sidebar and starting a new project.
Test how your agent answers and make changes if needed.
Update the agent’s introduction, instructions, and knowledge sources to help it work better.
Add prompts to help users start talking to your agent.
Publish your agent to a live or demo site so people can use it.
Always check your agent one last time before you publish it. Make sure it answers questions clearly and uses the right data. When you publish, your team can use the agent in Microsoft Teams or on the web. This helps you give your team a tool that supports your business.
Note: Keep your agent up to date. Look at feedback from users and make changes to improve it.
Troubleshooting
Common Issues
You may run into problems when you build or use your Copilot Declarative Agent. Knowing what to expect helps you fix things faster. Here are some common issues and ways to solve them:
If your agent repeats itself or gives too much information, you should update your instructions. Short and clear instructions help your agent work better.
You can also use the Test Panel in Copilot Studio to see how your agent responds. Try different questions and check the results. This helps you find problems before users do.
Best Practices
You can make your agent more reliable and faster by following some best practices. Here is a list to guide you:
Write clear instructions. Avoid long or confusing sentences.
Use Markdown to highlight important steps. Make key points bold or use backticks for code.
Test your agent often. Use the Test Panel to try different inputs.
Update your instructions based on feedback. Treat them as living documents.
Prevent common failures. Watch for over-eager tool use, repetition, and too much detail.
The T-C-R framework—Task, Clarity, Refine—helps you write better instructions. Start with the task, make it clear, and refine your steps over time.
You should always review your agent’s performance. Ask users for feedback and make changes as needed. Regular updates keep your agent helpful and safe. If you follow these tips, your Copilot Declarative Agent will work well for your team.
You learned how to build, bring in, and show data with Copilot Declarative Agent and Teams Toolkit. You can use these steps for work tasks like looking at legal cases or planning surgeries. Try new things like custom orchestration, agent-to-agent talk, and working with services such as Salesforce or SAP. Explore learning paths to get better at advanced actions and adaptive cards.
Custom orchestration helps you control your workflow
Connect with more than 1400 Power Platform connectors
Use advanced ways to set user permissions
Keep learning and trying new things to find more ways to use Copilot Declarative Agent and Teams Toolkit.
FAQ
How do you start building a Copilot Declarative Agent?
You open Visual Studio Code, install Teams Toolkit, and sign in to Microsoft 365. You select "Create a New Agent/App" and follow the prompts. You name your agent and begin adding features.
Can you connect to multiple data sources?
Yes, you can link your agent to several data sources. You use Microsoft Graph connectors or custom APIs. This helps your agent answer more questions and provide better insights.
What should you do if your data import fails?
Check your API endpoint and file format. Test with a small sample file. Make sure your connection is active. You can also review your import script for errors.
How do you make adaptive cards look good in Teams?
You use clear labels, small images, and simple layouts. Test your card on computers and phones. You group related items in containers and add actions like buttons for easy use.
Is it safe to use external data with your agent?
You should use trusted data sources. Always check your connections and review sensitive actions. Human review helps keep your data safe and your agent reliable.