diff --git a/samples/da-PostPilotAgent/README.md b/samples/da-PostPilotAgent/README.md new file mode 100644 index 0000000..c002641 --- /dev/null +++ b/samples/da-PostPilotAgent/README.md @@ -0,0 +1,50 @@ +# Agent PostPilot + +Helps write LinkedIn posts for Copilot prompt of the week. + +![image](./assets/demo.gif) + +## 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: 16, 18 +> - 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. | + +## Addition information and references + +- [Declarative agents for Microsoft 365](https://aka.ms/teams-toolkit-declarative-agent) diff --git a/samples/da-PostPilotAgent/appPackage/build/appPackage.dev.zip b/samples/da-PostPilotAgent/appPackage/build/appPackage.dev.zip new file mode 100644 index 0000000..9c94275 Binary files /dev/null and b/samples/da-PostPilotAgent/appPackage/build/appPackage.dev.zip differ diff --git a/samples/da-PostPilotAgent/appPackage/build/declarativeAgent.dev.json b/samples/da-PostPilotAgent/appPackage/build/declarativeAgent.dev.json new file mode 100644 index 0000000..45a0d79 --- /dev/null +++ b/samples/da-PostPilotAgent/appPackage/build/declarativeAgent.dev.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.0/schema.json", + "version": "v1.0", + "name": "Agent PostPilot", + "description": "Declarative agent created to generate LinkedIn post to announce prompt of the week", + "instructions": "As a Copilot prompt announcing agent, your task is to generate LinkedIn posts based on a given prompt. Follow the exact format below:\n\nšŸš€ Copilot Prompt of the Week!\n\nšŸŒŸ Shoutout to [Name of contributor] for this contribution!\n\nšŸ’” Prompt Focus: [A very concise description of the prompt's main focus]\n\nšŸ“ Prompt: \"[Insert the actual prompt here]\"\n\nšŸ”— Try it out or see the full prompt in action here: [link]\n\nšŸ’” For more samples head to: https://aka.ms/copilot-prompt-library\n\nInstructions:\n\nIn šŸ’” Prompt Focus, provide a very concise summary of the main focus of the prompt in 10 or less words.\nIn šŸ“ Prompt, include the actual prompt text provided.\nMaintain the formatting and emojis as shown.\nEnsure the post is professional and suitable for LinkedIn.", + "conversation_starters": [ + { + "title": "Generate post", + "text": "Generate post for the prompt: " + } + ] +} \ No newline at end of file diff --git a/samples/da-PostPilotAgent/appPackage/build/manifest.dev.json b/samples/da-PostPilotAgent/appPackage/build/manifest.dev.json new file mode 100644 index 0000000..94068e5 --- /dev/null +++ b/samples/da-PostPilotAgent/appPackage/build/manifest.dev.json @@ -0,0 +1,39 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/teams/v1.19/MicrosoftTeams.schema.json", + "manifestVersion": "1.19", + "version": "1.0.1", + "id": "e5aa1327-4649-41f0-8024-0ffa38a98e99", + "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 PostPilot", + "full": "Prompt of the week post generator agent" + }, + "description": { + "short": "Short description for PromptOTW-agent", + "full": "Full description for PromptOTW-agent" + }, + "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-PostPilotAgent/appPackage/color.png b/samples/da-PostPilotAgent/appPackage/color.png new file mode 100644 index 0000000..44cd6e3 Binary files /dev/null and b/samples/da-PostPilotAgent/appPackage/color.png differ diff --git a/samples/da-PostPilotAgent/appPackage/declarativeAgent.json b/samples/da-PostPilotAgent/appPackage/declarativeAgent.json new file mode 100644 index 0000000..f4030a5 --- /dev/null +++ b/samples/da-PostPilotAgent/appPackage/declarativeAgent.json @@ -0,0 +1,13 @@ +{ + "$schema": "https://developer.microsoft.com/json-schemas/copilot/declarative-agent/v1.0/schema.json", + "version": "v1.0", + "name": "Agent PostPilot", + "description": "Declarative agent created to generate LinkedIn post to announce prompt of the week", + "instructions": "$[file('instruction.txt')]", + "conversation_starters": [ + { + "title": "Generate post", + "text": "Generate post for the prompt: " + } + ] +} \ No newline at end of file diff --git a/samples/da-PostPilotAgent/appPackage/instruction.txt b/samples/da-PostPilotAgent/appPackage/instruction.txt new file mode 100644 index 0000000..1a50530 --- /dev/null +++ b/samples/da-PostPilotAgent/appPackage/instruction.txt @@ -0,0 +1,20 @@ +As a Copilot prompt announcing agent, your task is to generate LinkedIn posts based on a given prompt. Follow the exact format below: + +šŸš€ Copilot Prompt of the Week! + +šŸŒŸ Shoutout to [Name of contributor] for this contribution! + +šŸ’” Prompt Focus: [A very concise description of the prompt's main focus] + +šŸ“ Prompt: "[Insert the actual prompt here]" + +šŸ”— Try it out or see the full prompt in action here: [link] + +šŸ’” For more samples head to: https://aka.ms/copilot-prompt-library + +Instructions: + +In šŸ’” Prompt Focus, provide a very concise summary of the main focus of the prompt in 10 or less words. +In šŸ“ Prompt, include the actual prompt text provided. +Maintain the formatting and emojis as shown. +Ensure the post is professional and suitable for LinkedIn. \ No newline at end of file diff --git a/samples/da-PostPilotAgent/appPackage/manifest.json b/samples/da-PostPilotAgent/appPackage/manifest.json new file mode 100644 index 0000000..13309e9 --- /dev/null +++ b/samples/da-PostPilotAgent/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.1", + "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 PostPilot", + "full": "Prompt of the week post generator agent" + }, + "description": { + "short": "Short description for PromptOTW-agent", + "full": "Full description for PromptOTW-agent" + }, + "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-PostPilotAgent/appPackage/outline.png b/samples/da-PostPilotAgent/appPackage/outline.png new file mode 100644 index 0000000..f7a4c86 Binary files /dev/null and b/samples/da-PostPilotAgent/appPackage/outline.png differ diff --git a/samples/da-PostPilotAgent/assets/demo.gif b/samples/da-PostPilotAgent/assets/demo.gif new file mode 100644 index 0000000..61cc494 Binary files /dev/null and b/samples/da-PostPilotAgent/assets/demo.gif differ diff --git a/samples/da-PostPilotAgent/assets/sample.json b/samples/da-PostPilotAgent/assets/sample.json new file mode 100644 index 0000000..ac3d099 --- /dev/null +++ b/samples/da-PostPilotAgent/assets/sample.json @@ -0,0 +1,77 @@ +[ + { + "name": "pnp-copilot-pro-dev-da-environmentSustainability", + "source": "pnp", + "title": "Agent PostPilot", + "shortDescription": "Agent helps write LinkedIn post to announce Prompt of the week", + "url": "https://github.com/pnp/copilot-pro-dev-samples/tree/main/samples/da-PostPilotAgent", + "downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/copilot-pro-dev-samples/tree/main/samples/da-PostPilotAgent", + "longDescription": [ "Agent helps write LinkedIn post to announce Prompt of the week" + ], + "creationDateTime": "2024-11-13", + "updateDateTime": "2024-11-12", + "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": "No" + } + ], + "thumbnails": [ + { + "type": "image", + "order": 100, + "url": "https://github.com/pnp/copilot-pro-dev-samples/raw/main/samples/da-PostPilotAgent/assets/thumbnail.png", + "alt": "Declarative agent to generate prompt of the week LinkedIn post" + } + + ], + "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" + } + ] + } + ] \ No newline at end of file diff --git a/samples/da-PostPilotAgent/assets/thumbnail.png b/samples/da-PostPilotAgent/assets/thumbnail.png new file mode 100644 index 0000000..1e01ec5 Binary files /dev/null and b/samples/da-PostPilotAgent/assets/thumbnail.png differ diff --git a/samples/da-PostPilotAgent/env/.env.dev b/samples/da-PostPilotAgent/env/.env.dev new file mode 100644 index 0000000..31b83f9 --- /dev/null +++ b/samples/da-PostPilotAgent/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=e5aa1327-4649-41f0-8024-0ffa38a98e99 +TEAMS_APP_TENANT_ID=f0118ea9-172a-475d-90a2-f53bfba7cbac +M365_TITLE_ID=U_baa97d48-151f-dee8-85d8-3568e0850fdb +M365_APP_ID=d34c66f5-05e5-412c-9731-daa6295397ff \ No newline at end of file diff --git a/samples/da-PostPilotAgent/env/.env.dev.user b/samples/da-PostPilotAgent/env/.env.dev.user new file mode 100644 index 0000000..c83ac7f --- /dev/null +++ b/samples/da-PostPilotAgent/env/.env.dev.user @@ -0,0 +1 @@ +TEAMS_APP_UPDATE_TIME=2024-11-13T00:08:59.8577882+00:00 \ No newline at end of file diff --git a/samples/da-PostPilotAgent/teamsapp.yml b/samples/da-PostPilotAgent/teamsapp.yml new file mode 100644 index 0000000..6812aa8 --- /dev/null +++ b/samples/da-PostPilotAgent/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: PromptOTW-agent${{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: 6ae9179d-7e19-4f5a-bb3d-2f93d98ee7a6