Adding Graph Connector as a Data Source to a Microsoft Copilot Declarative Agent
Overview
Declarative agents in Microsoft Copilot are designed to simplify workflows and provide contextually relevant information to users. Integrating a Graph Connector as a data source into a Microsoft Copilot Declarative Agent enhances its capabilities by providing seamless access to external and enterprise data.
This article guides you through the process of adding a Graph Connector source to a Microsoft Copilot agent.
Purpose of Graph Connector
Microsoft Graph Connectors extend the reach of Microsoft Search by allowing organizations to index content from various third-party data sources. This indexed data can then be surfaced within Microsoft 365 apps, Teams, and, most importantly, Copilot, providing a unified and efficient search and retrieval experience.
The purpose of a Graph Connector is to bridge the gap between Microsoft 365 and external data sources. Many organizations rely on external systems beyond Microsoft 365 ecosystem to perform their operations, For e.g., ServiceNow to track incidents and tasks, Workday for HR and Finance operations, cloud-based applications, and more. Without proper integration, this data remains siloed, leading to inefficiencies in retrieving critical information.
Graph Connectors enable organizations to:
- Index content from external sources and make it discoverable within Microsoft 365.
- Ensure that all relevant data is accessible through a single interface.
- Maintain security and compliance by respecting the permissions defined in the source systems.
- Provide consistent and unified search results, improving productivity and collaboration.
By connecting these external data sources to Microsoft Graph, Graph Connectors ensure that Copilot has access to a wider pool of information, enabling it to answer user queries more comprehensively and accurately.
Use Cases
Below are few use cases for using Graph Connectors as data source for a declarative agent:
-
Customer Support: A declarative agent integrated with a Graph Connector can access customer data stored in CRM systems, ticketing platforms, and knowledge bases. This enables support agents to quickly retrieve customer details, history, and resolutions to similar issues, reducing response times.
-
Employee Onboarding: An HR declarative agent can access data from an employee management system, policy documents, and training platforms via Graph Connectors. New hires can receive personalized onboarding experiences by interacting with Copilot.
-
Sales Enablement: A sales-focused declarative agent can retrieve account details, sales metrics, and deal histories from CRM platforms and document repositories. This equips sales teams with relevant insights during customer interactions.
-
Research and Development: A declarative agent can pull technical documentation, research papers, and project data from file shares and knowledge management systems, enabling R&D teams to accelerate innovation.
-
Compliance and Auditing: Compliance teams can use Copilot to query policies, audit records, and regulatory guidelines stored in disparate systems via Graph Connectors, ensuring thorough and accurate audits.
Create declarative agent with Teams Toolkit
Declarative agent does not have any code as they use the power of Copilot for Microsoft 365 behind the scenes. The configuration happens through JSON based files.
Pre-requisites:
You need to have below things installed:
- Visual Studio Code
- Teams Toolkit extension (Pre-release version)
- Follow the instructions mentioned here
Follow below steps to create declarative agent with Teams Toolkit:
- Open Visual Studio Code.
- From the left pane, click Teams Toolkit.
- Click Create a New App.
-
Select Agent.
-
Select to create a new Declarative Agent.
-
Select the option No plugin to create a declarative Copilot only.
- Name the Copilot as RESTCountries.
Declarative agent manifest
We will build an agent based on the Graph connector implementation of Ingest REST Countries content using PowerShell
Get connector id:
Follow the below steps to get the id of Graph connector:
- Open Microsoft 365 Admin portal.
- Click Settings > Search & Intelligence.
- Click Data sources.
- Click the connector.
-
Note down the connector id (For e.g.,
restcountries
).
Update configuration:
Declarative agents require schema definitions to determine their operational scope. Update the schema file to restrict the data source to specify the Graph connector id.
Update the file at appPackage\declarativeAgent.json
to define your Copilot by adding add an capabilities
element.
{
"$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"
}
]
}
]
}
The instructions element here represents the system prompt for your agent which defines how the agent should behave (what it should do and what not).
Add below instructions to the file appPackage\instruction.txt
:
You are a country information specialist named "Country Explorer" that helps users find details about countries.
You are knowledgeable and approachable.
You always greet users warmly and introduce yourself with enthusiasm.
You enjoy using emojis to make interactions engaging and fun.
Test the Copilot
Follow the below steps to test the Copilot
- In the VS Code, open Teams Toolkit extension.
- Make sure you are logged-in to Microsoft 365 tenant.
-
Click Provision. As the declarative Copilot does not include any code, you can ignore the Deploy and Publish options.
-
Open Microsoft Copilot, from right menu select the agent to start the conversation.
Summary
Integrating Graph Connectors as a data source for Microsoft Copilot Declarative Agents unlocks the full potential of enterprise data. By bridging silos and enabling unified access to information, Graph Connectors enhance Copilot’s contextual understanding, improve productivity, and provide secure and personalized responses.
Organizations looking to implement this integration should evaluate their existing data repositories, identify key use cases, and leverage Microsoft Graph Connectors to ensure their Copilot Declarative Agents deliver maximum value to their users.
Code Download
The code developed during this article can be found here:
https://github.com/nanddeepn/code-samples/tree/master/Copilot/DeclarativeCopilots/RESTCountries
Leave a comment