-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from rabwill/new-sample
Added new sample for sustainability
- Loading branch information
Showing
17 changed files
with
374 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# TeamsFx files | ||
env/.env.*.user | ||
env/.env.local | ||
.localConfigs | ||
appPackage/build | ||
|
||
# dependencies | ||
node_modules/ | ||
|
||
# misc | ||
.env | ||
.deployment | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"recommendations": [ | ||
"TeamsDevApp.ms-teams-vscode-extension" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Preview in Copilot (Edge)", | ||
"type": "msedge", | ||
"request": "launch", | ||
"url": "https://www.office.com/chat?auth=2", | ||
"presentation": { | ||
"group": "remote", | ||
"order": 1 | ||
}, | ||
"internalConsoleOptions": "neverOpen" | ||
}, | ||
{ | ||
"name": "Preview in Copilot (Chrome)", | ||
"type": "chrome", | ||
"request": "launch", | ||
"url": "https://www.office.com/chat?auth=2", | ||
"presentation": { | ||
"group": "remote", | ||
"order": 2 | ||
}, | ||
"internalConsoleOptions": "neverOpen" | ||
} | ||
] | ||
} |
11 changes: 11 additions & 0 deletions
11
samples/da-environmentSustainability/.vscode/settings.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"debug.onTaskErrors": "abort", | ||
"json.schemas": [ | ||
{ | ||
"fileMatch": [ | ||
"/aad.*.json" | ||
], | ||
"schema": {} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Environment Sustainability Agent (ESA) | ||
|
||
The **ESA - The Environment Sustainability Agent** is an intelligent assistant designed to help organizations monitor and optimize their environmental impact. It analyzes data on energy consumption,environment compliance, and carbon emissions, providing actionable insights to reduce inefficiencies and enhance sustainability practices. By guiding companies toward more eco-friendly operations, this AI helps achieve long-term sustainability goals while reducing operational costs. | ||
|
||
## Summary | ||
|
||
This sample illustrates the following concepts: | ||
|
||
- Building a declarative agent for Microsoft 365 Copilot with instructions | ||
- Adding a SharePoint capability to the agent | ||
|
||
|
||
![picture of the app in action](./assets/daSus.gif) | ||
|
||
|
||
## Prerequisites | ||
|
||
* Microsoft 365 tenant with Microsoft 365 Copilot | ||
* [Visual Studio Code](https://code.visualstudio.com/) with the [Teams Toolkit](https://marketplace.visualstudio.com/items?itemName=TeamsDevApp.ms-teams-vscode-extension) extension | ||
* [Node.js v18](https://nodejs.org/en/download/package-manager) | ||
|
||
|
||
## Contributors | ||
|
||
* [Rabia Williams](https://github.com/rabwill) | ||
|
||
## Version history | ||
|
||
Version|Date|Comments | ||
-------|----|---- | ||
1.0|October 22, 2025|Initial release | ||
|
||
## Disclaimer | ||
|
||
**THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.** | ||
|
||
--- | ||
|
||
## Minimal Path to Awesome | ||
|
||
* Clone this repository and in your Visual Studio Code, open folder **samples/da-environmentSustainability** | ||
* Alternatively you can also [download this solution as a .ZIP file](https://pnp.github.io/download-partial/?url=https://github.com/pnp/copilot-pro-dev-samples/tree/main/samples/da-environmentSustainability) then unzip it and go to **samples/da-environmentSustainability** folder from your Visual Studio Code window | ||
* Open the Teams Toolkit extension and sign in to your Microsoft 365 tenant with Microsoft 365 Copilot | ||
* Copy the doc file `SustainabilityReports.docx` in **docs** folder and upload into a SharePoint site in the same Microsoft 365 tenant which you used to sign to Teams Toolkit | ||
* Update the environment variable `SP_SITE_URL` in the **.env.dev** file with value of the SharePoint site where the doc was uploaded | ||
* Under the Teams Toolkit tab in Visual Studio Code, click "Provision" to install the application | ||
|
||
![Click provision](./assets/provision-app.png) | ||
|
||
* Go to Copilot app and on the agent panel choose **da-environmentSustainability** | ||
* Use the conversation starters to see the magic! | ||
|
||
|
||
## Features | ||
|
||
- Declarative agent with SharePoint capability | ||
|
||
![](https://m365-visitor-stats.azurewebsites.net/SamplesGallery/da-environmentSustainability) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions
33
samples/da-environmentSustainability/appPackage/declarativeAgent.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.0/schema.json", | ||
"version": "v1.0", | ||
"name": "da-environmentSustainability", | ||
"description": "Declarative agent created with Teams Toolkit", | ||
"instructions": "$[file('instruction.txt')]", | ||
"conversation_starters": [ | ||
{ | ||
"title": "Analyze energy consumption", | ||
"text":"Can you analyze our energy consumption for the past three months and suggest specific areas where we can reduce our energy usage, especially in our manufacturing division?" | ||
|
||
}, | ||
{ | ||
"title": "Calculate carbon footprint ", | ||
"text": "Please calculate our carbon footprint for this quarter, considering our business travel, energy use, and waste management. Provide suggestions on how we can offset the emissions." | ||
}, | ||
{ | ||
"title": "Recommend sustainability initiatives ", | ||
"text": "Based on our current energy and waste data, recommend three new sustainability initiatives we can implement this year to further reduce our environmental impact." | ||
} | ||
], | ||
"capabilities": [ | ||
{ | ||
|
||
"name": "OneDriveAndSharePoint", | ||
"items_by_url": [ | ||
{ | ||
"url": "${{SP_SITE_URL}}" | ||
} | ||
] | ||
} | ||
] | ||
} |
22 changes: 22 additions & 0 deletions
22
samples/da-environmentSustainability/appPackage/instruction.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
You are a smart AI assistant specialized in environmental sustainability, with expertise in analyzing energy usage, waste management, and carbon footprint reduction strategies. Your role is to help organizations make data-driven decisions to improve sustainability efforts, comply with regulations, and track progress over time. You will follow the guidelines below to assist in real-time: | ||
|
||
1. Actively monitor energy consumption across different departments and sources within the organization. | ||
2. Analyze patterns in energy usage and identify areas of inefficiency, offering suggestions for reduction (e.g., turning off unused systems, optimizing heating/cooling). | ||
3. Provide weekly reports on energy consumption, comparing it to historical data and benchmarking against industry standards. | ||
4. Monitor waste production, identifying opportunities for reduction, recycling, or repurposing waste materials. | ||
5. Suggest sustainable alternatives to current practices that reduce environmental impact, such as switching to renewable energy sources or reducing plastic use. | ||
6. Track carbon footprint by analyzing travel, production processes, and material use. Provide suggestions to offset carbon emissions. | ||
7. Proactively flag upcoming regulatory compliance deadlines related to environmental laws and generate reports for audits. | ||
8. Offer real-time updates on new sustainability initiatives or government incentives related to green technologies or energy savings. | ||
9. Send alerts when energy consumption or waste production exceeds predefined thresholds. | ||
10. Continuously refine your suggestions based on feedback from organizational stakeholders, adapting to the organization's goals and sustainability targets. | ||
11. Provide insights on cost savings related to implementing more energy-efficient processes. | ||
12. Engage with stakeholders by explaining the environmental impact of their actions in simple, actionable terms. | ||
13. Recommend educational resources and training for employees to promote sustainable practices across the organization. | ||
14. Collaborate with other AI systems to integrate environmental data into broader business decision-making processes. | ||
15. Stay updated on the latest developments in environmental science and sustainability technologies to provide innovative solutions. | ||
16. Act as a proactive advisor in strategic planning sessions, offering data-driven forecasts for long-term sustainability improvements. | ||
17. Help the organization set realistic, measurable sustainability goals and track progress toward achieving them. | ||
18. Ensure transparency in sustainability efforts by generating reports that can be shared with external stakeholders or published for public viewing. | ||
19. Identify potential partnerships or collaborations with green technology vendors or sustainability consultants. | ||
20. Encourage a culture of sustainability by recognizing and rewarding departments or individuals who make significant contributions to reducing the environmental impact. |
39 changes: 39 additions & 0 deletions
39
samples/da-environmentSustainability/appPackage/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
{ | ||
"$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", | ||
"manifestVersion": "1.19", | ||
"version": "1.0.2", | ||
"id": "${{TEAMS_APP_ID}}", | ||
"developer": { | ||
"name": "Rabia Williams", | ||
"websiteUrl": "https://www.example.com", | ||
"privacyUrl": "https://www.example.com/privacy", | ||
"termsOfUseUrl": "https://www.example.com/termofuse" | ||
}, | ||
"icons": { | ||
"color": "color.png", | ||
"outline": "outline.png" | ||
}, | ||
"name": { | ||
"short": "da-environmentSustainability", | ||
"full": "Full name for da-environmentSustainability" | ||
}, | ||
"description": { | ||
"short": "Short description for da-environmentSustainability", | ||
"full": "Full description for da-environmentSustainability" | ||
}, | ||
"accentColor": "#FFFFFF", | ||
"composeExtensions": [], | ||
"permissions": [ | ||
"identity", | ||
"messageTeamMembers" | ||
], | ||
"copilotAgents": { | ||
"declarativeAgents": [ | ||
{ | ||
"id": "declarativeAgent", | ||
"file": "declarativeAgent.json" | ||
} | ||
] | ||
}, | ||
"validDomains": [] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
[ | ||
{ | ||
"name": "pnp-copilot-pro-dev-da-environmentSustainability", | ||
"source": "pnp", | ||
"title": "ESA, The Environment Sustainability Agent using Microsoft 365 Copilot", | ||
"shortDescription": "This sample showcases how to build a declarative agent for Microsoft 365 Copilot connected to a SharePoint site as knowledge base, named ESA, the Environment Sustainability Agent. ESA is an intelligent assistant developed to assist organizations in monitoring and optimizing their environmental impact.", | ||
"url": "https://github.com/pnp/copilot-pro-dev-samples/tree/main/samples/da-environmentSustainability", | ||
"downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/copilot-pro-dev-samples/tree/main/samples/da-environmentSustainability", | ||
"longDescription": [ "This sample showcases how to build a declarative agent for Microsoft 365 Copilot connected to a SharePoint site as knowledge base designed to help organizations monitor and optimize their environmental impact. It analyzes data on energy consumption,environment compliance, and carbon emissions, providing actionable insights to reduce inefficiencies and enhance sustainability practices. By guiding companies toward more eco-friendly operations, this AI helps achieve long-term sustainability goals while reducing operational costs." | ||
], | ||
"creationDateTime": "2024-10-22", | ||
"updateDateTime": "2024-10-22", | ||
"products": [ | ||
"Microsoft 365 Copilot" | ||
], | ||
"metadata": [ | ||
{ | ||
"key": "PLATFORM", | ||
"value": "Node.js" | ||
}, | ||
{ | ||
"key": "LANGUAGE", | ||
"value": "TypeScript" | ||
}, | ||
{ | ||
"key": "API-PLUGIN", | ||
"value": "No" | ||
}, | ||
{ | ||
"key": "GRAPH-CONNECTOR", | ||
"value": "No" | ||
}, | ||
{ | ||
"key": "SHAREPOINT", | ||
"value": "Yes" | ||
} | ||
], | ||
"thumbnails": [ | ||
{ | ||
"type": "image", | ||
"order": 100, | ||
"url": "https://github.com/pnp/copilot-pro-dev-samples/raw/main/samples/da-environmentSustainability/assets/thumbnail.png", | ||
"alt": "Declarative agent showing energy consumption analysis" | ||
} | ||
|
||
], | ||
"authors": [ | ||
{ | ||
"gitHubAccount": "rabwill", | ||
"pictureUrl": "https://avatars.githubusercontent.com/u/20379311?v=4", | ||
"name": "Rabia Williams" | ||
} | ||
], | ||
"references": [ | ||
{ | ||
"name": "Microsoft 365 Copilot extensibility", | ||
"description": "Learn more about what Microsoft 365 Copilot and how you can extend it.", | ||
"url": "https://learn.microsoft.com/microsoft-365-copilot/extensibility/" | ||
}, | ||
{ | ||
"name": "Copilot Developer Camp", | ||
"description": "Hands on lab to create declarative agents and more.", | ||
"url": "https://aka.ms/copilotdevcamp" | ||
}, | ||
{ | ||
"name": "Declarative agents for Microsoft 365 Copilot overview", | ||
"description": "Learn more about what declarative agents for Microsoft 365 Copilot are.", | ||
"url": "https://learn.microsoft.com/microsoft-365-copilot/extensibility/overview-declarative-agent" | ||
}, | ||
{ | ||
"name": "Build a declarative agent for Microsoft 365 Copilot", | ||
"description": "Learn how to build a declarative agent for Microsoft 365 Copilot.", | ||
"url": "https://learn.microsoft.com/microsoft-365-copilot/extensibility/build-declarative-agents" | ||
} | ||
] | ||
} | ||
] |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This file includes environment variables that will be committed to git by default. | ||
|
||
# Built-in environment variables | ||
TEAMSFX_ENV=dev | ||
APP_NAME_SUFFIX=dev | ||
|
||
# Generated during provision, you can also add your own variables. | ||
SP_SITE_URL=https://<your-tenant>.sharepoint.com/sites/<your-site> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
# yaml-language-server: $schema=https://aka.ms/teams-toolkit/v1.7/yaml.schema.json | ||
# Visit https://aka.ms/teamsfx-v5.0-guide for details on this file | ||
# Visit https://aka.ms/teamsfx-actions for details on actions | ||
version: v1.7 | ||
|
||
environmentFolderPath: ./env | ||
|
||
# Triggered when 'teamsapp provision' is executed | ||
provision: | ||
# Creates a Teams app | ||
- uses: teamsApp/create | ||
with: | ||
# Teams app name | ||
name: da-environmentSustainability${{APP_NAME_SUFFIX}} | ||
# Write the information of created resources into environment file for | ||
# the specified environment variable(s). | ||
writeToEnvironmentFile: | ||
teamsAppId: TEAMS_APP_ID | ||
|
||
# Build Teams app package with latest env value | ||
- uses: teamsApp/zipAppPackage | ||
with: | ||
# Path to manifest template | ||
manifestPath: ./appPackage/manifest.json | ||
outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip | ||
outputFolder: ./appPackage/build | ||
# Validate app package using validation rules | ||
- uses: teamsApp/validateAppPackage | ||
with: | ||
# Relative path to this file. This is the path for built zip file. | ||
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip | ||
# Apply the Teams app manifest to an existing Teams app in | ||
# Teams Developer Portal. | ||
# Will use the app id in manifest file to determine which Teams app to update. | ||
- uses: teamsApp/update | ||
with: | ||
# Relative path to this file. This is the path for built zip file. | ||
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip | ||
# Extend your Teams app to Outlook and the Microsoft 365 app | ||
- uses: teamsApp/extendToM365 | ||
with: | ||
# Relative path to the build app package. | ||
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip | ||
# Write the information of created resources into environment file for | ||
# the specified environment variable(s). | ||
writeToEnvironmentFile: | ||
titleId: M365_TITLE_ID | ||
appId: M365_APP_ID | ||
|
||
# Triggered when 'teamsapp publish' is executed | ||
publish: | ||
# Build Teams app package with latest env value | ||
- uses: teamsApp/zipAppPackage | ||
with: | ||
# Path to manifest template | ||
manifestPath: ./appPackage/manifest.json | ||
outputZipPath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip | ||
outputFolder: ./appPackage/build | ||
# Validate app package using validation rules | ||
- uses: teamsApp/validateAppPackage | ||
with: | ||
# Relative path to this file. This is the path for built zip file. | ||
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip | ||
# Apply the Teams app manifest to an existing Teams app in | ||
# Teams Developer Portal. | ||
# Will use the app id in manifest file to determine which Teams app to update. | ||
- uses: teamsApp/update | ||
with: | ||
# Relative path to this file. This is the path for built zip file. | ||
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip | ||
# Publish the app to | ||
# Teams Admin Center (https://admin.teams.microsoft.com/policies/manage-apps) | ||
# for review and approval | ||
- uses: teamsApp/publishAppPackage | ||
with: | ||
appPackagePath: ./appPackage/build/appPackage.${{TEAMSFX_ENV}}.zip | ||
# Write the information of created resources into environment file for | ||
# the specified environment variable(s). | ||
writeToEnvironmentFile: | ||
publishedAppId: TEAMS_APP_PUBLISHED_APP_ID | ||
projectId: 9ea4a7ab-ef9b-479b-8077-87a9db01cfd5 |