diff --git a/samples/mcs-policy-agent-topics/README.md b/samples/mcs-policy-agent-topics/README.md new file mode 100644 index 000000000..af5520f94 --- /dev/null +++ b/samples/mcs-policy-agent-topics/README.md @@ -0,0 +1,131 @@ +# Policy Agent - Topic-Based Grounding + +A Custom Engine Agent built in Microsoft Copilot Studio that uses topic-based folder structure in SharePoint for deterministic, precise policy responses. + +## Demo + +https://github.com/user-attachments/assets/e6c3d7d3-015e-4f67-ac9e-2f5d4a6c8294 + +## Problem Statement + +Organizations with policies spread across multiple departments need precise, targeted responses. Common challenges include: +- Generic responses that don't address specific departmental policies +- Difficulty routing queries to the right knowledge source +- Lack of precision when policies overlap across departments +- Need for deterministic behavior in policy lookups + +## Solution Overview + +This solution uses a **Custom Engine Agent (CEA)** in Copilot Studio with topic-based SharePoint folder mapping: + +| Component | Description | +|-----------|-------------| +| **Custom Engine Agent** | Provides targeted responses based on topic classification | +| **Topic-Based Grounding** | SharePoint folders organized by department/topic | +| **Folder-to-Topic Mapping** | Each SharePoint folder maps to a specific agent topic | +| **Deterministic Routing** | Structured approach ensures precise, relevant answers | + +## Architecture + +``` + ┌─────────────────────────┐ + │ User Query │ + │ "What's the expense │ + │ claim process?" │ + └───────────┬─────────────┘ + │ + ┌───────────▼─────────────┐ + │ Custom Engine Agent │ + │ (Topic Classifier) │ + └───────────┬─────────────┘ + │ + ┌─────────────────┼─────────────────┐ + │ │ │ + ┌─────────▼─────┐ ┌───────▼───────┐ ┌─────▼─────────┐ + │ HR Topic │ │ Finance Topic │ │ IT Topic │ + │ │ │ │ │ │ + │ SharePoint │ │ SharePoint │ │ SharePoint │ + │ /HR Folder │ │ /Finance │ │ /IT Folder │ + └───────────────┘ └───────┬───────┘ └───────────────┘ + │ + ┌──────────▼──────────┐ + │ Targeted Response │ + │ from Finance │ + │ Policy Documents │ + └─────────────────────┘ +``` + +## Technical Details + +| Aspect | Details | +|--------|---------| +| **Platform** | Microsoft Copilot Studio | +| **Agent Type** | Custom Engine Agent (CEA) | +| **Knowledge Sources** | SharePoint folders organized by topic (Finance, HR, IT, etc.) | +| **Integration Logic** | Topic folders mapped to specific agent topics for targeted responses | +| **Routing Method** | Deterministic topic-based classification | + +## Sample Prompts + +- "What's the code of conduct policy for new employees?" +- "Explain the step-by-step process for submitting expense claims" +- "What are the IT security guidelines for remote work?" +- "How do I request time off according to HR policy?" + +## Business Value + +| Metric | Value | +|--------|-------| +| **Faster Info Retrieval** | Direct routing to relevant policy folder | +| **Better Resolution Rate** | Improved user query resolution percentage | +| **Enhanced Precision** | Deterministic systems provide accurate, targeted answers | +| **Structured Organization** | Clear folder structure makes maintenance easier | + +## Deployment + +### Prerequisites +- Microsoft Copilot Studio license +- SharePoint site with topic-organized folder structure +- VS Code with Copilot Studio extension (optional, for source control) + +### SharePoint Setup +Create folders for each policy domain: +``` +/Policies + ├── /Finance + │ ├── expense-policy.docx + │ └── travel-reimbursement.docx + ├── /HR + │ ├── code-of-conduct.docx + │ └── leave-policy.docx + └── /IT + ├── security-guidelines.docx + └── acceptable-use.docx +``` + +### Import Steps +1. Open Microsoft Copilot Studio +2. Import the agent source from the `src/` folder using the Copilot Studio extension for VS Code +3. Configure SharePoint knowledge sources with your topic folders (update the `site` URLs in `src/knowledge/`) +4. Map each folder to corresponding agent topics +5. Test the agent with sample prompts across different topics +6. Publish to your desired channel + +## Folder Structure + +``` +mcs-policy-agent-topics/ +├── README.md # This file +├── assets/ +│ └── sample.json # PnP sample gallery metadata +└── src/ + ├── agent.mcs.yml # Agent definition + ├── settings.mcs.yml # Agent settings + ├── knowledge/ # Topic-organized knowledge config + └── topics/ # Topic definitions (mapped to folders) +``` + +## Related Resources + +- [Copilot Studio Documentation](https://learn.microsoft.com/en-us/microsoft-copilot-studio/) +- [VS Code Copilot Studio Extension](https://marketplace.visualstudio.com/items?itemName=ms-CopilotStudio.vscode-copilotstudio) diff --git a/samples/mcs-policy-agent-topics/assets/sample.json b/samples/mcs-policy-agent-topics/assets/sample.json new file mode 100644 index 000000000..1ecd34468 --- /dev/null +++ b/samples/mcs-policy-agent-topics/assets/sample.json @@ -0,0 +1,73 @@ +[ + { + "name": "pnp-copilot-pro-dev-mcs-policy-agent-topics", + "source": "pnp", + "title": "Policy Agent (Topic-Based Grounding) for Copilot Studio", + "shortDescription": "A Custom Engine Agent in Copilot Studio that maps each policy domain (HR, Finance, IT, Legal, Operations) to its own SharePoint folder and topic for deterministic, precise routing.", + "url": "https://github.com/pnp/copilot-pro-dev-samples/tree/main/samples/mcs-policy-agent-topics", + "downloadUrl": "https://pnp.github.io/download-partial/?url=https://github.com/pnp/copilot-pro-dev-samples/tree/main/samples/mcs-policy-agent-topics", + "longDescription": [ + "A Custom Engine Agent built in Microsoft Copilot Studio that uses a topic-based grounding pattern: each policy domain maps to a dedicated SharePoint folder and a dedicated agent topic, giving deterministic routing and per-domain precision." + ], + "creationDateTime": "2026-06-25", + "updateDateTime": "2026-06-25", + "products": [ + "Microsoft 365 Copilot", + "Microsoft Copilot Studio", + "SharePoint" + ], + "metadata": [ + { + "key": "PLATFORM", + "value": "Copilot Studio" + }, + { + "key": "LANGUAGE", + "value": "None" + }, + { + "key": "AGENT-TYPE", + "value": "Custom Engine Agent" + }, + { + "key": "EXTENSION-TYPE", + "value": "Knowledge" + }, + { + "key": "API-PLUGIN", + "value": "No" + }, + { + "key": "GRAPH-CONNECTOR", + "value": "No" + } + ], + "thumbnails": [ + { + "type": "video", + "order": 101, + "url": "https://github.com/user-attachments/assets/e6c3d7d3-015e-4f67-ac9e-2f5d4a6c8294", + "alt": "Demo - Policy Agent with topic-based SharePoint grounding" + } + ], + "authors": [ + { + "gitHubAccount": "keshavk-msft", + "pictureUrl": "https://github.com/keshavk-msft.png", + "name": "Keshav" + } + ], + "references": [ + { + "name": "Microsoft 365 Copilot extensibility", + "description": "Learn more about Microsoft 365 Copilot and how you can extend it.", + "url": "https://learn.microsoft.com/microsoft-365-copilot/extensibility/" + }, + { + "name": "Microsoft Copilot Studio", + "description": "Build AI-driven agents and workflows with Microsoft Copilot Studio.", + "url": "https://learn.microsoft.com/en-us/microsoft-copilot-studio/" + } + ] + } +] \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/agent.mcs.yml b/samples/mcs-policy-agent-topics/src/agent.mcs.yml new file mode 100644 index 000000000..9052491d9 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/agent.mcs.yml @@ -0,0 +1,77 @@ +mcs.metadata: + componentName: KK Policy Agent(Topic) +kind: GptComponentMetadata +displayName: KK Policy Agent(Topic) +instructions: |+ + ### 🧭 **Agent Instruction for KK Policy Agent** + + #### 🎯 **Purpose** + + You are the **KK Policy Agent**, designed to assist employees in understanding, locating, and complying with organizational policies across various domains such as Finance, HR, IT & Security, Legal & Compliance, and more. + + #### 💬 **Your Role** + + Your role is to: + + * Provide **clear, accurate, and concise** responses regarding company policies. + * Reference the **correct topic** (Finance, HR, IT, etc.) based on user intent. + * Maintain a **professional and supportive tone**, ensuring users feel guided and confident in following organizational policies. + * Avoid speculation — only provide verified or documented policy information. + * Redirect users to **official resources or policy documents** where applicable. + + --- + + ### 🧩 **Behavior Guidelines** + + 1. **Policy Understanding** + + * When a user asks about any policy, identify the relevant category (e.g., HR, IT, Finance, Legal). + * Retrieve or summarize the applicable policy clearly. + * If multiple policies are relevant, summarize each briefly and provide guidance on which applies. + + 2. **Response Format** + Your answers should be: + + * **Concise and factual** (avoid long paragraphs). + * **Action-oriented** when the policy includes procedures (e.g., “To raise a reimbursement claim, submit the form via HR Portal → Reimbursements”). + * **Friendly yet formal**, ensuring clarity and confidence in communication. + + 3. **Escalation and Limitations** + + * If the question is outside your scope or unclear, respond with: + + > “I recommend contacting the respective department or reviewing the official policy document for the most accurate guidance.” + * Avoid providing personal opinions or assumptions. + + --- + + ### 🗂️ **Topic-Specific Instructions** + + | **Topic Name** | **Purpose / Coverage** | **Example Queries** | + | ----------------------------------------------- | -------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ | + | **Finance** | Covers policies on reimbursements, travel allowance, expense approvals, and budgeting. | “How can I claim travel expenses?” / “What’s the reimbursement limit?” | + | **HR** | Handles employee onboarding, leave, attendance, performance reviews, and employee relations. | “How many paid leaves do I get?” / “What’s the process for resignation?” | + | **IT & Security** | Provides information about cybersecurity, data access, password policies, and acceptable use of devices. | “What’s the password reset policy?” / “Can I use personal USB drives?” | + | **Legal & Compliance** | Details compliance, data privacy, confidentiality, and company code of conduct policies. | “What’s the non-disclosure policy?” / “How is data privacy handled?” | + | **Operations & Administration** | Includes office procedures, facilities, procurement, and travel logistics. | “How do I book a meeting room?” / “What’s the office visitor policy?” | + | **Greeting / Goodbye / Thank You / Start Over** | Manage conversational flow and user experience. | “Hi”, “Thanks”, “Bye”, “Restart chat” | + + --- + + ### ⚙️ **Tone and Style** + + * Maintain a **calm, confident, and informative** tone. + * Always show empathy and professionalism. + * Avoid jargon unless explicitly defined. + * Example tone: + + > “Sure, I can help with that. The IT & Security policy states that all devices must be encrypted before connecting to the corporate network.” + + --- + + ### 📚 **Fallback / Default Response** + + If the topic or query does not match any known policy: + + > “I couldn’t find a specific policy on that topic. You may refer to the HR or IT policy section on the intranet for detailed guidance, or contact the relevant department.” + diff --git a/samples/mcs-policy-agent-topics/src/icon.png b/samples/mcs-policy-agent-topics/src/icon.png new file mode 100644 index 000000000..5d6937a20 Binary files /dev/null and b/samples/mcs-policy-agent-topics/src/icon.png differ diff --git a/samples/mcs-policy-agent-topics/src/knowledge/cred8_agent_Ai98b3.topic.Finance_Policies_G5mmFrCLhDJsNuXKYu4Yz.mcs.yml b/samples/mcs-policy-agent-topics/src/knowledge/cred8_agent_Ai98b3.topic.Finance_Policies_G5mmFrCLhDJsNuXKYu4Yz.mcs.yml new file mode 100644 index 000000000..289e3e9d2 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/knowledge/cred8_agent_Ai98b3.topic.Finance_Policies_G5mmFrCLhDJsNuXKYu4Yz.mcs.yml @@ -0,0 +1,7 @@ +mcs.metadata: + componentName: Finance_Policies + description: This knowledge source provides information found in Finance_Policies SharePoint. +kind: KnowledgeSourceConfiguration +source: + kind: SharePointSearchSource + site: https://contoso.sharepoint.com/sites/PolicyHub/Shared%20Documents/Policies/Finance_Policies \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/knowledge/cred8_agent_Ai98b3.topic.HR_Policies_zwEbU9jckf88nCSmlyMXG.mcs.yml b/samples/mcs-policy-agent-topics/src/knowledge/cred8_agent_Ai98b3.topic.HR_Policies_zwEbU9jckf88nCSmlyMXG.mcs.yml new file mode 100644 index 000000000..3b699276e --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/knowledge/cred8_agent_Ai98b3.topic.HR_Policies_zwEbU9jckf88nCSmlyMXG.mcs.yml @@ -0,0 +1,7 @@ +mcs.metadata: + componentName: HR_Policies + description: This knowledge source provides information found in HR_Policies SharePoint. +kind: KnowledgeSourceConfiguration +source: + kind: SharePointSearchSource + site: https://contoso.sharepoint.com/sites/PolicyHub/Shared%20Documents/Policies/HR_Policies \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/knowledge/cred8_agent_Ai98b3.topic.IT_Security_Policies_cPBSzc5DjJr0gVgfvJnMF.mcs.yml b/samples/mcs-policy-agent-topics/src/knowledge/cred8_agent_Ai98b3.topic.IT_Security_Policies_cPBSzc5DjJr0gVgfvJnMF.mcs.yml new file mode 100644 index 000000000..2898713c4 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/knowledge/cred8_agent_Ai98b3.topic.IT_Security_Policies_cPBSzc5DjJr0gVgfvJnMF.mcs.yml @@ -0,0 +1,7 @@ +mcs.metadata: + componentName: IT_Security_Policies + description: This knowledge source provides information found in IT_Security_Policies SharePoint. +kind: KnowledgeSourceConfiguration +source: + kind: SharePointSearchSource + site: https://contoso.sharepoint.com/sites/PolicyHub/Shared%20Documents/Policies/IT_Security_Policies \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/settings.mcs.yml b/samples/mcs-policy-agent-topics/src/settings.mcs.yml new file mode 100644 index 000000000..cb950eeca --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/settings.mcs.yml @@ -0,0 +1,29 @@ +displayName: KK Policy Agent(Topic) +schemaName: cred8_agent_Ai98b3 +accessControlPolicy: ChatbotReaders +authenticationMode: Integrated +authenticationTrigger: Always +configuration: + channels: + - channelId: MsTeams + + settings: + GenerativeActionsEnabled: true + + isAgentConnectable: true + gPTSettings: + defaultSchemaName: cred8_agent_Ai98b3.gpt.default + + isLightweightBot: false + aISettings: + useModelKnowledge: true + isFileAnalysisEnabled: true + isSemanticSearchEnabled: true + optInUseLatestModels: false + + recognizer: + kind: GenerativeAIRecognizer + +publishedOn: 2025-10-07T06:09:13.0000000Z +template: default-2.1.0 +language: 1033 \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/ConversationStart.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/ConversationStart.mcs.yml new file mode 100644 index 000000000..b0c430556 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/ConversationStart.mcs.yml @@ -0,0 +1,15 @@ +mcs.metadata: + componentName: Conversation Start + description: This system topic triggers when the agent receives an Activity indicating the beginning of a new conversation. If you do not want the agent to initiate the conversation, disable this topic. +kind: AdaptiveDialog +beginDialog: + kind: OnConversationStart + id: main + actions: + - kind: SendActivity + id: sendMessage_M0LuhV + activity: + text: + - Hello, I'm {System.Bot.Name}, a virtual assistant. Just so you are aware, I sometimes use AI to answer your questions. If you provided a website during creation, try asking me about it! Next try giving me some more knowledge by setting up generative AI. + speak: + - Hello and thank you for calling {System.Bot.Name}. Please note that some responses are generated by AI and may require verification for accuracy. How may I help you today? \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/EndofConversation.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/EndofConversation.mcs.yml new file mode 100644 index 000000000..ae01aeee9 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/EndofConversation.mcs.yml @@ -0,0 +1,80 @@ +mcs.metadata: + componentName: End of Conversation + description: |- + This system topic is only triggered by a redirect action, + and guides the user through rating their conversation with the agent. +kind: AdaptiveDialog +startBehavior: CancelOtherTopics +beginDialog: + kind: OnSystemRedirect + id: main + actions: + - kind: Question + id: 41d42054-d4cb-4e90-b922-2b16b37fe379 + conversationOutcome: ResolvedImplied + alwaysPrompt: true + variable: init:Topic.SurveyResponse + prompt: Did that answer your question? + entity: BooleanPrebuiltEntity + + - kind: ConditionGroup + id: condition-0 + conditions: + - id: condition-0-item-0 + condition: =Topic.SurveyResponse = true + actions: + - kind: CSATQuestion + id: csat_1 + conversationOutcome: ResolvedConfirmed + + - kind: SendActivity + id: sendMessage_8r29O0 + activity: Thanks for your feedback. + + - kind: Question + id: question_1 + alwaysPrompt: true + variable: init:Topic.Continue + prompt: Can I help with anything else? + entity: BooleanPrebuiltEntity + + - kind: ConditionGroup + id: condition-1 + conditions: + - id: condition-1-item-0 + condition: =Topic.Continue = true + actions: + - kind: SendActivity + id: sendMessage_4eOE6h + activity: Go ahead. I'm listening. + + elseActions: + - kind: SendActivity + id: yHBz55 + activity: Ok, goodbye. + + - kind: EndConversation + id: jh1GMT + + elseActions: + - kind: Question + id: PM68ot + alwaysPrompt: true + variable: init:Topic.TryAgain + prompt: Sorry I wasn't able to help better. Would you like to try again? + entity: BooleanPrebuiltEntity + + - kind: ConditionGroup + id: KNxYBf + conditions: + - id: DPveFP + condition: =Topic.TryAgain = false + actions: + - kind: BeginDialog + id: cngqi4 + dialog: cred8_agent_Ai98b3.topic.Escalate + + elseActions: + - kind: SendActivity + id: GrVHEW + activity: Go ahead. I'm listening. \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/Escalate.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/Escalate.mcs.yml new file mode 100644 index 000000000..a2f17e7a5 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/Escalate.mcs.yml @@ -0,0 +1,66 @@ +mcs.metadata: + componentName: Escalate + description: |- + This system topic is triggered when the user indicates they would like to speak to a representative. + You can configure how the agent will handle human hand-off scenarios in the agent settings.. + If your agent does not handle escalations, this topic should be disabled. +kind: AdaptiveDialog +startBehavior: CancelOtherTopics +beginDialog: + kind: OnEscalate + id: main + intent: + displayName: Escalate + includeInOnSelectIntent: false + triggerQueries: + - Talk to agent + - Talk to a person + - Talk to someone + - Call back + - Call customer service + - Call me please + - Call support + - Call technical support + - Can an agent call me + - Can I call + - Can I get in touch with someone else + - Can I get real agent support + - Can I get transferred to a person to call + - Can I have a call in number Or can I be called + - Can I have a representative call me + - Can I schedule a call + - Can I speak to a representative + - Can I talk to a human + - Can I talk to a human assistant + - Can someone call me + - Chat with a human + - Chat with a representative + - Chat with agent + - Chat with someone please + - Connect me to a live agent + - Connect me to a person + - Could some one contact me by phone + - Customer agent + - Customer representative + - Customer service + - I need a manager to contact me + - I need customer service + - I need help from a person + - I need to speak with a live argent + - I need to talk to a specialist please + - I want to talk to customer service + - I want to proceed with live support + - I want to speak with a consultant + - I want to speak with a live tech + - I would like to speak with an associate + - I would like to talk to a technician + - Talk with tech support member + + actions: + - kind: SendActivity + id: sendMessage_s39DCt + conversationOutcome: Escalated + activity: |- + Escalating to a representative is not currently configured for this agent, however this is where the agent could provide information about how to get in touch with someone another way. + + Is there anything else I can help you with? \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/Fallback.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/Fallback.mcs.yml new file mode 100644 index 000000000..d55338c5e --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/Fallback.mcs.yml @@ -0,0 +1,22 @@ +mcs.metadata: + componentName: Fallback + description: This system topic triggers when the user's utterance does not match any existing topics. +kind: AdaptiveDialog +beginDialog: + kind: OnUnknownIntent + id: main + actions: + - kind: ConditionGroup + id: conditionGroup_LktzXw + conditions: + - id: conditionItem_tlGIVo + condition: =System.FallbackCount < 3 + actions: + - kind: SendActivity + id: sendMessage_QZreqo + activity: I'm sorry, I'm not sure how to help with that. Can you try rephrasing? + + elseActions: + - kind: BeginDialog + id: 5aXj5M + dialog: cred8_agent_Ai98b3.topic.Escalate \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/Finance.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/Finance.mcs.yml new file mode 100644 index 000000000..4ea6f3073 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/Finance.mcs.yml @@ -0,0 +1,37 @@ +mcs.metadata: + componentName: Finance +kind: AdaptiveDialog +modelDescription: |- + Finance Policies + These ensure financial integrity, compliance, and accountability. + Expense Reimbursement Policy + Travel & Entertainment Policy + Budgeting & Forecasting Policy + Procurement Policy + Asset Management Policy + Payroll Policy + Financial Reporting Policy + Audit & Compliance Policy + Investment Policy + Fraud Prevention Policy + Credit & Collections Policy + Donation & Sponsorship Policy +beginDialog: + kind: OnRecognizedIntent + id: main + intent: {} + actions: + - kind: SearchAndSummarizeContent + id: byYNk9 + userInput: =System.Activity.Text + fileSearchDataSource: + searchFilesMode: + kind: DoNotSearchFiles + + knowledgeSources: + kind: SearchSpecificKnowledgeSources + knowledgeSources: + - cred8_agent_Ai98b3.topic.Finance_Policies_G5mmFrCLhDJsNuXKYu4Yz + +inputType: {} +outputType: {} \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/Goodbye.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/Goodbye.mcs.yml new file mode 100644 index 000000000..71a4243f8 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/Goodbye.mcs.yml @@ -0,0 +1,42 @@ +mcs.metadata: + componentName: Goodbye + description: This topic triggers when the user says goodbye. By default, it does not end the conversation. If you would like to end the conversation when the user says goodbye, you can add an "End of Conversation" action to this topic, or redirect to the "End of Conversation" system topic. +kind: AdaptiveDialog +startBehavior: CancelOtherTopics +beginDialog: + kind: OnRecognizedIntent + id: main + intent: + displayName: Goodbye + includeInOnSelectIntent: false + triggerQueries: + - Bye + - Bye for now + - Bye now + - Good bye + - No thank you. Goodbye. + - See you later + + actions: + - kind: Question + id: question_zf2HhP + variable: Topic.EndConversation + prompt: Would you like to end our conversation? + entity: BooleanPrebuiltEntity + + - kind: ConditionGroup + id: condition_DGc1Wy + conditions: + - id: condition_DGc1Wy-item-0 + condition: =Topic.EndConversation = true + actions: + - kind: BeginDialog + id: dn94DC + dialog: cred8_agent_Ai98b3.topic.EndofConversation + + - id: condition_DGc1Wy-item-1 + condition: =Topic.EndConversation = false + actions: + - kind: SendActivity + id: sendMessage_LdLhmf + activity: Go ahead. I'm listening. \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/Greeting.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/Greeting.mcs.yml new file mode 100644 index 000000000..16cb4b061 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/Greeting.mcs.yml @@ -0,0 +1,28 @@ +mcs.metadata: + componentName: Greeting + description: This topic is triggered when the user greets the agent. +kind: AdaptiveDialog +beginDialog: + kind: OnRecognizedIntent + id: main + intent: + displayName: Greeting + includeInOnSelectIntent: false + triggerQueries: + - Good afternoon + - Good morning + - Hello + - Hey + - Hi + + actions: + - kind: SendActivity + id: sendMessage_abmysR + activity: + text: + - Hello, how can I help you today? + speak: + - Hello, how can I help? + + - kind: CancelAllDialogs + id: cancelAllDialogs_01At22 \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/HR.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/HR.mcs.yml new file mode 100644 index 000000000..0d92d8108 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/HR.mcs.yml @@ -0,0 +1,39 @@ +mcs.metadata: + componentName: HR +kind: AdaptiveDialog +modelDescription: |- + Human Resources (HR) Policies + These govern employee behavior, rights, and responsibilities. + Recruitment & Hiring Policy + Code of Conduct / Ethics Policy + Attendance & Leave Policy + Workplace Harassment Policy + Equal Employment Opportunity (EEO) Policy + Employee Grievance Policy + Performance Management Policy + Training & Development Policy + Remote Work / Hybrid Work Policy + Dress Code Policy + Termination & Exit Policy + Compensation & Benefits Policy + Employee Wellness Policy + Diversity & Inclusion Policy +beginDialog: + kind: OnRecognizedIntent + id: main + intent: {} + actions: + - kind: SearchAndSummarizeContent + id: 3D1B5Z + userInput: =System.Activity.Text + fileSearchDataSource: + searchFilesMode: + kind: DoNotSearchFiles + + knowledgeSources: + kind: SearchSpecificKnowledgeSources + knowledgeSources: + - cred8_agent_Ai98b3.topic.HR_Policies_zwEbU9jckf88nCSmlyMXG + +inputType: {} +outputType: {} \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/ITSecurity.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/ITSecurity.mcs.yml new file mode 100644 index 000000000..bcca691f7 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/ITSecurity.mcs.yml @@ -0,0 +1,34 @@ +mcs.metadata: + componentName: IT & Security +kind: AdaptiveDialog +modelDescription: |- + IT & Security Policies + Protect digital assets and ensure secure operations. + Information Security Policy + Data Privacy Policy + Acceptable Use Policy + Password Management Policy + Email & Communication Policy + Remote Access Policy + Software Usage Policy + Incident Response Policy + BYOD (Bring Your Own Device) Policy +beginDialog: + kind: OnRecognizedIntent + id: main + intent: {} + actions: + - kind: SearchAndSummarizeContent + id: I1nHGy + userInput: =System.Activity.Text + fileSearchDataSource: + searchFilesMode: + kind: DoNotSearchFiles + + knowledgeSources: + kind: SearchSpecificKnowledgeSources + knowledgeSources: + - cred8_agent_Ai98b3.topic.IT_Security_Policies_cPBSzc5DjJr0gVgfvJnMF + +inputType: {} +outputType: {} \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/LegalCompliance.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/LegalCompliance.mcs.yml new file mode 100644 index 000000000..e849910b7 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/LegalCompliance.mcs.yml @@ -0,0 +1,31 @@ +mcs.metadata: + componentName: Legal & Compliance +kind: AdaptiveDialog +modelDescription: |- + Legal & Compliance Policies + Ensure adherence to laws and regulations. + Anti-Bribery & Corruption Policy + Whistleblower Policy + GDPR / Data Protection Policy + Intellectual Property Policy + Contract Management Policy + Regulatory Compliance Policy +beginDialog: + kind: OnRecognizedIntent + id: main + intent: {} + actions: + - kind: SearchAndSummarizeContent + id: udeNWC + userInput: =System.Activity.Text + fileSearchDataSource: + searchFilesMode: + kind: DoNotSearchFiles + + knowledgeSources: + kind: SearchSpecificKnowledgeSources + knowledgeSources: + - cred8_agent_Ai98b3.topic.Legal_Compliance_Policies_OUsCnpvz6ucQVqG2o4Nx3 + +inputType: {} +outputType: {} \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/MultipleTopicsMatched.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/MultipleTopicsMatched.mcs.yml new file mode 100644 index 000000000..f840f5c83 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/MultipleTopicsMatched.mcs.yml @@ -0,0 +1,46 @@ +mcs.metadata: + componentName: Multiple Topics Matched + description: This system topic triggers when the agent matches multiple Topics with the incoming message and needs to clarify which one should be triggered. +kind: AdaptiveDialog +beginDialog: + kind: OnSelectIntent + id: main + triggerBehavior: Always + actions: + - kind: SetVariable + id: setVariable_M6434i + variable: init:Topic.IntentOptions + value: =System.Recognizer.IntentOptions + + - kind: SetTextVariable + id: setTextVariable_0 + variable: Topic.NoneOfTheseDisplayName + value: None of these + + - kind: EditTable + id: sendMessage_g5Ls09 + changeType: Add + itemsVariable: Topic.IntentOptions + value: "={ DisplayName: Topic.NoneOfTheseDisplayName, TopicId: \"NoTopic\", TriggerId: \"NoTrigger\", Score: 1.0 }" + + - kind: Question + id: question_zf2HhP + interruptionPolicy: + allowInterruption: false + + alwaysPrompt: true + variable: System.Recognizer.SelectedIntent + prompt: "To clarify, did you mean:" + entity: + kind: DynamicClosedListEntity + items: =Topic.IntentOptions + + - kind: ConditionGroup + id: conditionGroup_60PuXb + conditions: + - id: conditionItem_rs7GgM + condition: =System.Recognizer.SelectedIntent.TopicId = "NoTopic" + actions: + - kind: ReplaceDialog + id: YZXRDb + dialog: cred8_agent_Ai98b3.topic.Fallback \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/OnError.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/OnError.mcs.yml new file mode 100644 index 000000000..f8e41681d --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/OnError.mcs.yml @@ -0,0 +1,48 @@ +mcs.metadata: + componentName: On Error + description: This system topic triggers when the agent encounters an error. When using the test chat pane, the full error description is displayed. +kind: AdaptiveDialog +startBehavior: UseLatestPublishedContentAndCancelOtherTopics +beginDialog: + kind: OnError + id: main + actions: + - kind: SetVariable + id: setVariable_timestamp + variable: init:Topic.CurrentTime + value: =Text(Now(), DateTimeFormat.UTC) + + - kind: ConditionGroup + id: condition_1 + conditions: + - id: bL4wmY + condition: =System.Conversation.InTestMode = true + actions: + - kind: SendActivity + id: sendMessage_XJBYMo + activity: |- + Error Message: {System.Error.Message} + Error Code: {System.Error.Code} + Conversation Id: {System.Conversation.Id} + Time (UTC): {Topic.CurrentTime} + + elseActions: + - kind: SendActivity + id: sendMessage_dZ0gaF + activity: + text: + - |- + An error has occurred. + Error code: {System.Error.Code} + Conversation Id: {System.Conversation.Id} + Time (UTC): {Topic.CurrentTime}. + speak: + - An error has occurred, please try again. + + - kind: LogCustomTelemetryEvent + id: 9KwEAn + eventName: OnErrorLog + properties: "={ErrorMessage: System.Error.Message, ErrorCode: System.Error.Code, TimeUTC: Topic.CurrentTime, ConversationId: System.Conversation.Id}" + + - kind: CancelAllDialogs + id: NW7NyY \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/OperationsAdministration.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/OperationsAdministration.mcs.yml new file mode 100644 index 000000000..1b3fac3ec --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/OperationsAdministration.mcs.yml @@ -0,0 +1,31 @@ +mcs.metadata: + componentName: Operations & Administration +kind: AdaptiveDialog +modelDescription: |- + Operations & Administration Policies + Support day-to-day business operations. + Facility Access Policy + Health & Safety Policy + Travel Policy + Document Retention Policy + Vendor Management Policy + Business Continuity & Disaster Recovery Policy +beginDialog: + kind: OnRecognizedIntent + id: main + intent: {} + actions: + - kind: SearchAndSummarizeContent + id: MHlth7 + userInput: =System.Activity.Text + fileSearchDataSource: + searchFilesMode: + kind: DoNotSearchFiles + + knowledgeSources: + kind: SearchSpecificKnowledgeSources + knowledgeSources: + - cred8_agent_Ai98b3.topic.Operations_Administration_Policies_iE1XPGye22r4sdKOmqLhK + +inputType: {} +outputType: {} \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/ResetConversation.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/ResetConversation.mcs.yml new file mode 100644 index 000000000..80d52e658 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/ResetConversation.mcs.yml @@ -0,0 +1,18 @@ +mcs.metadata: + componentName: Reset Conversation +kind: AdaptiveDialog +startBehavior: UseLatestPublishedContentAndCancelOtherTopics +beginDialog: + kind: OnSystemRedirect + id: main + actions: + - kind: SendActivity + id: sendMessage_OPsT1O + activity: What can I help you with? + + - kind: ClearAllVariables + id: clearAllVariables_73bTFR + variables: ConversationScopedVariables + + - kind: CancelAllDialogs + id: cancelAllDialogs_12Gt21 \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/Search.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/Search.mcs.yml new file mode 100644 index 000000000..e1634f909 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/Search.mcs.yml @@ -0,0 +1,23 @@ +mcs.metadata: + componentName: Conversational boosting + description: Create generative answers from knowledge sources. +kind: AdaptiveDialog +beginDialog: + kind: OnUnknownIntent + id: main + priority: -1 + actions: + - kind: SearchAndSummarizeContent + id: search-content + variable: Topic.Answer + userInput: =System.Activity.Text + + - kind: ConditionGroup + id: has-answer-conditions + conditions: + - id: has-answer + condition: =!IsBlank(Topic.Answer) + actions: + - kind: EndDialog + id: end-topic + clearTopicQueue: true \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/Signin.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/Signin.mcs.yml new file mode 100644 index 000000000..c7eacc454 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/Signin.mcs.yml @@ -0,0 +1,22 @@ +mcs.metadata: + componentName: Sign in + description: This system topic triggers when the agent needs to sign in the user or require the user to sign in +kind: AdaptiveDialog +beginDialog: + kind: OnSignIn + id: main + actions: + - kind: ConditionGroup + id: conditionGroup_ypjGKL + conditions: + - id: conditionItem_7XYIIR + condition: =System.SignInReason = SignInReason.SignInRequired + actions: + - kind: SendActivity + id: sendMessage_1jHUNO + activity: Hello! To be able to help you, I'll need you to sign in. + + - kind: OAuthInput + id: gOjhZA + title: Login + text: To continue, please login \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/StartOver.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/StartOver.mcs.yml new file mode 100644 index 000000000..898513b0e --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/StartOver.mcs.yml @@ -0,0 +1,37 @@ +mcs.metadata: + componentName: Start Over +kind: AdaptiveDialog +beginDialog: + kind: OnRecognizedIntent + id: main + intent: + displayName: Start Over + includeInOnSelectIntent: false + triggerQueries: + - let's begin again + - start over + - start again + - restart + + actions: + - kind: Question + id: question_zguoVV + alwaysPrompt: false + variable: init:Topic.Confirm + prompt: Are you sure you want to restart the conversation? + entity: BooleanPrebuiltEntity + + - kind: ConditionGroup + id: conditionGroup_lvx2zV + conditions: + - id: conditionItem_sVQtHa + condition: =Topic.Confirm = true + actions: + - kind: BeginDialog + id: 0YKYsy + dialog: cred8_agent_Ai98b3.topic.ResetConversation + + elseActions: + - kind: SendActivity + id: sendMessage_lk2CyQ + activity: Ok. Let's carry on. \ No newline at end of file diff --git a/samples/mcs-policy-agent-topics/src/topics/ThankYou.mcs.yml b/samples/mcs-policy-agent-topics/src/topics/ThankYou.mcs.yml new file mode 100644 index 000000000..59823a822 --- /dev/null +++ b/samples/mcs-policy-agent-topics/src/topics/ThankYou.mcs.yml @@ -0,0 +1,20 @@ +mcs.metadata: + componentName: Thank you + description: This topic triggers when the user says thank you. +kind: AdaptiveDialog +beginDialog: + kind: OnRecognizedIntent + id: main + intent: + displayName: Thank you + includeInOnSelectIntent: false + triggerQueries: + - thanks + - thank you + - thanks so much + - ty + + actions: + - kind: SendActivity + id: sendMessage_9iz6v7 + activity: You're welcome. \ No newline at end of file