diff --git a/samples/da-resource-allocation/.gitignore b/samples/da-resource-allocation/.gitignore new file mode 100644 index 000000000..e56779951 --- /dev/null +++ b/samples/da-resource-allocation/.gitignore @@ -0,0 +1,13 @@ +# TeamsFx files +env/.env.*.user +env/.env.local +.localConfigs +appPackage/build + +# dependencies +node_modules/ + +# misc +.env +.deployment +.DS_Store diff --git a/samples/da-resource-allocation/.vscode/extensions.json b/samples/da-resource-allocation/.vscode/extensions.json new file mode 100644 index 000000000..aac0a6e34 --- /dev/null +++ b/samples/da-resource-allocation/.vscode/extensions.json @@ -0,0 +1,5 @@ +{ + "recommendations": [ + "TeamsDevApp.ms-teams-vscode-extension" + ] +} diff --git a/samples/da-resource-allocation/.vscode/launch.json b/samples/da-resource-allocation/.vscode/launch.json new file mode 100644 index 000000000..ed05f4de2 --- /dev/null +++ b/samples/da-resource-allocation/.vscode/launch.json @@ -0,0 +1,37 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Preview in Copilot (Edge)", + "type": "msedge", + "request": "launch", + "url": "https://m365.cloud.microsoft/chat/entity1-d870f6cd-4aa5-4d42-9626-ab690c041429/${agent-hint}?auth=2&developerMode=Basic", + "presentation": { + "group": "remote", + "order": 1 + }, + "internalConsoleOptions": "neverOpen", + "runtimeArgs": [ + "--remote-debugging-port=9222", + "--no-first-run", + "--user-data-dir=${env:TEMP}/copilot-msedge-user-data-dir" + ] + }, + { + "name": "Preview in Copilot (Chrome)", + "type": "chrome", + "request": "launch", + "url": "https://m365.cloud.microsoft/chat/entity1-d870f6cd-4aa5-4d42-9626-ab690c041429/${agent-hint}?auth=2&developerMode=Basic", + "presentation": { + "group": "remote", + "order": 2 + }, + "internalConsoleOptions": "neverOpen", + "runtimeArgs": [ + "--remote-debugging-port=9223", + "--no-first-run", + "--user-data-dir=${env:TEMP}/copilot-chrome-user-data-dir" + ] + } + ] +} diff --git a/samples/da-resource-allocation/.vscode/settings.json b/samples/da-resource-allocation/.vscode/settings.json new file mode 100644 index 000000000..429962025 --- /dev/null +++ b/samples/da-resource-allocation/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "debug.onTaskErrors": "abort", + "json.schemas": [ + { + "fileMatch": [ + "/aad.*.json" + ], + "schema": {} + } + ] +} diff --git a/samples/da-resource-allocation/README.md b/samples/da-resource-allocation/README.md new file mode 100644 index 000000000..4267fd8ea --- /dev/null +++ b/samples/da-resource-allocation/README.md @@ -0,0 +1,67 @@ +# Overview of the Resource Assistant agent sample +![Resource assistant start screen](assets/ResourceAssistant.png) + +🚀 Resource Allocation Assistant is a Microsoft Teams Declarative AI Agent designed to help managers and project leads assess workloads, identify resource bottlenecks, and optimize task distribution within their teams. This AI-powered agent provides smart workload insights and recommendations based on user input, ensuring balanced work allocation and preventing burnout. + +## 🛠 **Features** +✅ **Workload Assessment** – Helps managers evaluate ongoing tasks and resource availability. +✅ **Task Redistribution** – Suggests optimal ways to balance workloads across team members. +✅ **Bottleneck Detection** – Identifies overworked employees and underutilized resources. + +## Get started with the template + +> **Prerequisites** +> +> To run this app template in your local dev machine, you will need: +> +> - [Node.js](https://nodejs.org/), supported versions: 18, 20 +> - A [Microsoft 365 account for development](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts). +> - [Teams Toolkit Visual Studio Code Extension](https://aka.ms/teams-toolkit) version 5.0.0 and higher or [Teams Toolkit CLI](https://aka.ms/teamsfx-toolkit-cli) +> - [Microsoft 365 Copilot license](https://learn.microsoft.com/microsoft-365-copilot/extensibility/prerequisites#prerequisites) + +![image](https://github.com/user-attachments/assets/e1c2a3b3-2e59-4e9b-8335-19315e92ba30) + +1. First, select the Teams Toolkit icon on the left in the VS Code toolbar. +2. In the Account section, sign in with your [Microsoft 365 account](https://docs.microsoft.com/microsoftteams/platform/toolkit/accounts) if you haven't already. +3. Create Teams app by clicking `Provision` in "Lifecycle" section. +4. Select `Preview in Copilot (Edge)` or `Preview in Copilot (Chrome)` from the launch configuration dropdown. +5. Once the Copilot app is loaded in the browser, click on the "…" menu and select "Copilot chats". You will see your declarative agent on the right rail. Clicking on it will change the experience to showcase the logo and name of your declarative agent. +6. Ask a question to your declarative agent and it should respond based on the instructions provided. + +## What's included in the template + +| Folder | Contents | +| ------------ | ---------------------------------------------------------------------------------------- | +| `.vscode` | VSCode files for debugging | +| `appPackage` | Templates for the Teams application manifest, the GPT manifest and the API specification | +| `env` | Environment files | + +The following files can be customized and demonstrate an example implementation to get you started. + +| File | Contents | +| ---------------------------------- | ---------------------------------------------------------------------------- | +| `appPackage/declarativeAgent.json` | Define the behaviour and configurations of the declarative agent. | +| `appPackage/manifest.json` | Teams application manifest that defines metadata for your declarative agent. | + +The following are Teams Toolkit specific project files. You can [visit a complete guide on Github](https://github.com/OfficeDev/TeamsFx/wiki/Teams-Toolkit-Visual-Studio-Code-v5-Guide#overview) to understand how Teams Toolkit works. + +| File | Contents | +| -------------- | ----------------------------------------------------------------------------------------------------------------------------------------- | +| `teamsapp.yml` | This is the main Teams Toolkit project file. The project file defines two primary things: Properties and configuration Stage definitions. | + +## Extend the template + +- [Add conversation starters](https://learn.microsoft.com/microsoft-365-copilot/extensibility/build-declarative-agents?tabs=ttk&tutorial-step=3): Conversation starters are hints that are displayed to the user to demonstrate how they can get started using the declarative agent. +- [Add web content](https://learn.microsoft.com/microsoft-365-copilot/extensibility/build-declarative-agents?tabs=ttk&tutorial-step=4) for the ability to search web information. +- [Add OneDrive and SharePoint content](https://learn.microsoft.com/microsoft-365-copilot/extensibility/build-declarative-agents?tabs=ttk&tutorial-step=5) as grounding knowledge for the agent. +- [Add Microsoft Graph connectors content](https://learn.microsoft.com/microsoft-365-copilot/extensibility/build-declarative-agents?tabs=ttk&tutorial-step=6) to ground agent with enterprise knowledge. +- [Add API plugins](https://learn.microsoft.com/microsoft-365-copilot/extensibility/build-declarative-agents?tabs=ttk&tutorial-step=7) for agent to interact with REST APIs. + +## Addition information and references + +- [Declarative agents for Microsoft 365](https://aka.ms/teams-toolkit-declarative-agent) + +![](https://m365-visitor-stats.azurewebsites.net/SamplesGallery/da-resource-allocation) + + + diff --git a/samples/da-resource-allocation/appPackage/color.png b/samples/da-resource-allocation/appPackage/color.png new file mode 100644 index 000000000..11e255fa0 Binary files /dev/null and b/samples/da-resource-allocation/appPackage/color.png differ diff --git a/samples/da-resource-allocation/appPackage/declarativeAgent.json b/samples/da-resource-allocation/appPackage/declarativeAgent.json new file mode 100644 index 000000000..ae225a06b --- /dev/null +++ b/samples/da-resource-allocation/appPackage/declarativeAgent.json @@ -0,0 +1,41 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.2/schema.json", + "version": "v1.2", + "name": "Resource Allocation Assistant", + "description": "Resource Allocation Assistant is a declarative AI Agent that helps managers optimize team workloads and balance resource allocation effectively.", + "instructions": "$[file('instruction.txt')]", + "capabilities": [ + { + "name": "OneDriveAndSharePoint" + }, + { + "name": "GraphConnectors" + } + ], + "conversation_starters": [ + { + "title": "Assess Team Workload", + "text": "How many tasks is my team handling? Who is overloaded?" + }, + { + "title": "Identify Workload Imbalances", + "text": "Which team members are overloaded, and who has availability?" + }, + { + "title": "Optimize Task Distribution", + "text": "How can I redistribute tasks to balance workload across my team?" + }, + { + "title": "Manage High-Priority Tasks", + "text": "Which critical tasks need immediate reassignment?" + }, + { + "title": "Prevent Burnout & Improve Efficiency", + "text": "How can I reduce team overload while maintaining productivity?" + }, + { + "title": "Monitor and Adjust Workload", + "text": "Can you help track workload changes over time and suggest adjustments?" + } + ] +} diff --git a/samples/da-resource-allocation/appPackage/instruction.txt b/samples/da-resource-allocation/appPackage/instruction.txt new file mode 100644 index 000000000..c75d4e5c1 --- /dev/null +++ b/samples/da-resource-allocation/appPackage/instruction.txt @@ -0,0 +1,36 @@ +Purpose: +You are an expert Resource Allocation Advisor in Microsoft Teams. Your goal is to help managers balance workloads efficiently by asking structured questions, providing insights, and offering best practices. + +Goals: +* Assess workload distribution based on user-provided input. +* Identify overworked and underutilized team members through guided questions. +* Recommend workload balancing strategies without direct system access. +* Provide best practices for assigning tasks, upskilling, or deferring work. +* Help managers document decisions via Teams messages or Planner. + +User Interaction Flow: +First, understand the team’s workload. Start by asking: +* "How many active tasks or projects are currently in progress?" +* "Which team members are struggling with too many tasks?" +* "Who in your team has capacity to take on more work?" + +Second Identify workload bottlenecks: +* "It looks like [Employee X] has more than [Y] tasks. Should we consider redistributing?" +* "Are there any critical deadlines requiring immediate attention?" + +Third Recommend solutions based on input: +* "To improve efficiency, consider shifting [Task A] to [Employee B] who has availability." +* "You may want to upskill [Employee X] in [Skill Y] for better task distribution." + +Last Follow up: +* "Would you like to document this in a Teams message?" +* "Should I set a reminder for a follow-up check-in?" + +Overall Direction: +* Always keep responses structured and actionable. +* If the user provides incomplete details, ask follow-up questions. +* Avoid overwhelming users with multiple questions at once—guide them step by step. +* Keep a helpful and proactive tone. +* If asked for automatic task reassignment, suggest best practices instead (since the agent has no direct system access). +* After each response, ask if the user needs further assistance. +* If greeted or asked for capabilities, briefly explain your role and provide examples. \ No newline at end of file diff --git a/samples/da-resource-allocation/appPackage/manifest.json b/samples/da-resource-allocation/appPackage/manifest.json new file mode 100644 index 000000000..9da6b017a --- /dev/null +++ b/samples/da-resource-allocation/appPackage/manifest.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", + "version": "1.0.0", + "id": "${{TEAMS_APP_ID}}", + "developer": { + "name": "Teams App, Inc.", + "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": "Resource Allocation", + "full": "Resource Allocation App" + }, + "description": { + "short": "Make resource allocation easy", + "full": "Resource Allocation App helps you to allocate resources easily" + }, + "accentColor": "#FFFFFF", + "composeExtensions": [], + "permissions": [ + "identity", + "messageTeamMembers" + ], + "copilotAgents": { + "declarativeAgents": [ + { + "id": "declarativeAgent", + "file": "declarativeAgent.json" + } + ] + }, + "validDomains": [] +} \ No newline at end of file diff --git a/samples/da-resource-allocation/appPackage/outline.png b/samples/da-resource-allocation/appPackage/outline.png new file mode 100644 index 000000000..f7a4c8644 Binary files /dev/null and b/samples/da-resource-allocation/appPackage/outline.png differ diff --git a/samples/da-resource-allocation/assets/ResourceAssistant.png b/samples/da-resource-allocation/assets/ResourceAssistant.png new file mode 100644 index 000000000..014bab524 Binary files /dev/null and b/samples/da-resource-allocation/assets/ResourceAssistant.png differ diff --git a/samples/da-resource-allocation/assets/sample.json b/samples/da-resource-allocation/assets/sample.json new file mode 100644 index 000000000..64dd51d02 --- /dev/null +++ b/samples/da-resource-allocation/assets/sample.json @@ -0,0 +1,68 @@ +[ + { + "name": "pnp-copilot-pro-dev-resource-allocation", + "source": "pnp", + "title": "Resource Allocation Assistant", + "shortDescription": "Resource Allocation Assistant is a declarative AI Agent that helps managers optimize team workloads and balance resource allocation effectively.", + "url": "https://github.com/pnp/copilot-pro-dev-samples/tree/main/samples/da-resource-allocation", + "downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/copilot-pro-dev-samples/tree/main/samples/da-resource-allocation", + "longDescription": [ + "The \"Resource Allocation\" declarative agent is a sample agent that helps managers optimize team workloads and balance resource allocation effectively. It provides conversation starters to help managers assess team workload, identify workload imbalances, optimize task distribution, manage high-priority tasks, prevent burnout and improve efficiency, and monitor and adjust workload." + ], + "creationDateTime": "2025-03-05", + "updateDateTime": "2025-03-05", + "products": [ + "Microsoft 365 Copilot" + ], + "metadata": [ + { + "key": "PLATFORM", + "value": "Node.js" + }, + { + "key": "LANGUAGE", + "value": "TypeScript" + }, + { + "key": "API-PLUGIN", + "value": "No" + }, + { + "key": "GRAPH-CONNECTOR", + "value": "No" + } + ], + "thumbnails": [ + { + "type": "image", + "order": 100, + "url": "https://github.com/pnp/copilot-pro-dev-samples/blob/main/samples/da-resource-allocation/assets/ResourceAssistant.png?raw=true", + "alt": "Resource Allocation Assistant" + } + ], + "authors": [ + { + "gitHubAccount": "Valeras Narbutas", + "pictureUrl": "https://github.com/ValerasNarbutas.png", + "name": "Valeras Narbutas" + } + ], + "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": "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" + } + ] + } + ] \ No newline at end of file diff --git a/samples/da-resource-allocation/env/.env.dev b/samples/da-resource-allocation/env/.env.dev new file mode 100644 index 000000000..f73cd1a62 --- /dev/null +++ b/samples/da-resource-allocation/env/.env.dev @@ -0,0 +1,11 @@ +# 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. +TEAMS_APP_ID= +TEAMS_APP_TENANT_ID= +M365_TITLE_ID= +M365_APP_ID= \ No newline at end of file diff --git a/samples/da-resource-allocation/teamsapp.yml b/samples/da-resource-allocation/teamsapp.yml new file mode 100644 index 000000000..b2d3840ce --- /dev/null +++ b/samples/da-resource-allocation/teamsapp.yml @@ -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-resource-allocation${{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: 2c0a30c9-3f49-418e-bf38-894b3679e0e3