在 Microsoft Security Copilot 中建立互動代理程式,需設定代理程式以支援動態且以任務為中心的對話。 最終使用者透過與 客服人員聊天 功能與您的客服人員互動。 要啟用此功能,請將所需屬性加入代理清單。
文章提供了如何建立互動代理程式的導覽,教導使用者如何使用 Security Copilot,並參考 Microsoft Docs 學習頁面上的公開文件。
建立互動式 Security Copilot 代理的步驟
要建立你的代理人清單,你可以在清單中引用互動代理人體驗所需的屬性。 欲了解更多資訊,請參閱 代理人清單。
互動代理 YAML
以下是互動式代理清單 YAML 的範例 SecurityCopilotDocsAgent 。
Descriptor:
Name: SecurityCopilotDocsAgent
DisplayName: Security Copilot Docs Agent
Description: >-
Answers user questions about Microsoft Security Copilot by searching
Microsoft Docs and returning relevant guidance.
Icon: ''
AgentDefinitions:
- Name: SecurityCopilotDocsAgent
DisplayName: Security Copilot Docs Agent
Description: >-
Answers user questions about Microsoft Security Copilot by searching
Microsoft Docs and returning relevant guidance.
Publisher: Custom
Product: SecurityCopilot
RequiredSkillsets:
- MCP.MSDocs
- SecurityCopilotDocsAgent
AgentSingleInstanceConstraint: None
Triggers:
- Name: Default
DefaultPollPeriodSeconds: 0
ProcessSkill: SecurityCopilotDocsAgent.SecurityCopilotDocsAgent
PromptSkill: SecurityCopilotDocsAgent.SecurityCopilotDocsAgent # Added for interactive agent experience
SkillGroups:
- Format: Agent
Skills:
- Name: SecurityCopilotDocsAgent
DisplayName: Security Copilot Docs Agent
Description: Uses Microsoft Docs to answer questions about Security Copilot usage.
Interfaces:
- InteractiveAgent # Added for interactive agent experience
Inputs:
- Name: UserRequest # Input to the prompt skill (must always be named UserRequest)
Description: The user's question about how to use Microsoft Security Copilot.
DefaultValue: ''
Required: true
SuggestedPrompts: # Starter prompts
- Prompt: Show me areas in which Security Copilot can help me?
Title: Security Copilot Overview
Personas:
- 3
IsStarterAgent: true
- Prompt: How do I build agents in Security Copilot?
Title: Building Agents
Personas:
- 3
IsStarterAgent: true
- Prompt: How do I get details on a specific Defender incident?
Title: Incident Knowledge
Personas:
- 3
IsStarterAgent: true
- Prompt: How do I execute a KQL query via Security Copilot?
Title: KQL Query
Personas:
- 3
IsStarterAgent: true
- Prompt: Give me more details on the above # Prompt suggestions
- Prompt: Where do I get troubleshooting information
- Prompt: My prompt is not giving the response I am seeking, how can I improve on it.
- Prompt: What is a ProcessSkill in an Agent and show is it different from PromptSkill
- Prompt: How do I import a custom plugin?
- Prompt: Does Security Copilot support MCP?
- Prompt: How do I build an API plugin?
- Prompt: How do I build a promptbook?
- Prompt: Can I run a Security Copilot prompt from LogicApp?
- Prompt: Can I execute a Security Copilot agent from LogicApp?
- Prompt: What is the purpose of a trigger in Agents?
Settings:
OrchestratorSkill: DefaultAgentOrchestrator
Instructions: >
# Mission You are an expert assistant for Microsoft Security
Copilot. When a user asks a question about how to use Security
Copilot, search Microsoft Docs for the most relevant and up-to-date
guidance. Make sure to return data relevant to Microsoft Security Copilot specifically.
# Data Handling Use the AskMsDocs skill to search Microsoft
documentation for Security Copilot and related topics. Summarize the
most relevant information and provide clear, actionable answers.
# Workflow 1. Receive the user's question as input. 2. Call the
AskMsDocs skill with the user's question. 3. Review the returned
documentation results. 4. Summarize the key guidance and steps for
the user. 5. If the answer is not found, state that no relevant
documentation was found.
# Output Provide a concise, accurate answer with references to
Microsoft Docs where possible.
ChildSkills:
- microsoft_docs_search
配置代理清單並建立互動代理的步驟如下:
步驟一:規劃您的互動代理人
當代理與使用者可能需要合作以提供導引式解決方案時,互動代理非常有用。 明確表達互動代理的目標與指示,指定可用的工具 (技能) ,並定義如何處理使用者請求。
步驟二:新增提示技能
屬性 PromptSkill 透過指定目標、指示及功能來定義使用者體驗,以回應使用者需求。 你可以參考不同類型的工具 (技能) :AGENT (推薦的) 、GPT、KQL 和 API。 關於建立不同工具類型的資訊,請參見工具。
將屬性
PromptSkill加入代理人清單。 這就產生了 與客服聊天 的選項。提示技能的格式應該是
SkillsetName.SkillName。 以下顯示屬性的代理清單PromptSkill範例區段,其中SkillsetName= SecurityCopilotDocsAgent,即Descriptor.nameSkillName技能中定義Format: Agent的 SecurityCopilotDocsAgent。PromptSkill: SecurityCopilotDocsAgent.SecurityCopilotDocsAgent在代理人定義中,你必須指定 技能
AgentDefinition集名稱,以及任意ChildSkills的技能集。 把所有這些都在RequiredSkillsets現場列出來。請將該
Interfaces欄位包含在特工技能描述符中。 對於互動代理,介面設定為InteractiveAgent。UserRequest作為輸入加入PromptSkill。
步驟三:新增提示
入門提示
啟動提示 有助於設定情境,並出現在互動代理體驗的開始階段。 它們幫助使用者了解代理人能做什麼,並設定期望值。
要設定起始提示詞:
SuggestedPrompts屬性用於旗IsStarterAgent標宣告。定義 a
Title,Personas提示詞就會對齊到。
以下展示僅在互動式客服體驗中顯示的起始提示的代理清單範例部分。
SuggestedPrompts:
- Prompt: Show me areas in which Security Copilot can help me?
Title: Security Copilot Overview
Personas:
- 3
IsStarterAgent: true
此提示僅在選擇 Persona 類型 時 ITAdmin 顯示。
Persona 類型 ID 如下:
| 識別碼 | 人格類型 |
|---|---|
| 0 | CISO |
| 1 | 上海合作組織分析師 |
| 2 | 威脅情報分析師 |
| 3 | 它阿德敏 |
| 4 | 身份管理員 |
| 5 | 資料安全管理員 |
| 6 | 雲端管理員 |
在SecurityCopilotDocsAgent代理人清單的互動式代理人部分,代理人技能顯示四個分別分配給不同角色的起始提示。
下圖展示了你可以選擇開始與代理人互動的起始提示。
即時建議
提示 建議是提示輸出後,經過精心挑選的後續提示清單。 這些建議確保使用者能保持在引導式的體驗中。
要設定提示建議:
提示會被加入帶有屬性
SuggestedPrompts的技能下。-
IsStarterAgentPersonas且在提示建議時必須省略,以避免被視為起始提示。
-
屬性下
SuggestedPrompts的所有提示都會根據會話情境產生並排序提示。 這些提示是以 作為SuggestedPrompts起始範本產生的。提示建議會顯示在結果中,作為繼續聊天對話的潛在提示。
如果你選擇任何提示建議,可以在提交前編輯提示。
請求被執行並回傳回應。
注意事項
Orchestrator 不會檢查動態產生提示建議所需的工具是否已啟用。 如果有提示程式執行時未啟用該工具,則會顯示錯誤訊息。 確保所有相關工具都已啟用並設定好。
以下 YAML 展示了代理清單的範例部分, SecurityCopilotDocsAgent 裡面有 11 個建議提示,將作為產生動態建議提示的範本。
- Prompt: Give me more details on the above
- Prompt: Where do I get troubleshooting information
- Prompt: My prompt is not giving the response I am seeking, how can I improve on it.
- Prompt: What is a ProcessSkill in an Agent and show is it different from PromptSkill
- Prompt: How do I import a custom plugin?
- Prompt: Does Security Copilot support MCP?
- Prompt: How do I build an API plugin?
- Prompt: How do I build a promptbook?
- Prompt: Can I run a Security Copilot prompt from LogicApp?
- Prompt: Can I execute a Security Copilot agent from LogicApp?
- Prompt: What is the purpose of a trigger in Agents?
下圖展示了提示處理完且結果回傳後產生的提示建議。
步驟四:提供指示
Instructions 是給代理者定義目標、如何處理請求與工作流程、限制,以及詳細說明結果的指示。
從樣本中,請參閱該藥劑的詳細 Instructions 說明。
步驟五:設定兒童技能
兒童技能是代理人可用來實現結果可預測且全面的工具與能力。 工具 (技能) 執行特定任務,並由代理人召喚以完成其目標。
從範例中可見,這是一個microsoft_docs_searchMCP.MSDocs在 RequiredSkillsets.
ChildSkills:
- microsoft_docs_search
步驟 6:上傳 YAML
在設定 Agent YAML 清單並設定所需屬性後,您必須上傳 YAML,才能使用 Chat with agent 功能。
- 把 YAML 上傳成自訂插件。 關於上傳的說明,請參見 「上傳自訂插件」。
已知限制
以下是實作互動代理的已知限制:
互動代理人僅支援一個輸入,且必須是
UserRequest。使用者可選擇與 客服聊天 ,並以身份與同意進行驗證,設定互動式聊天。 這並不會讓其他人使用代理,適當的使用者需要在 Active Agents 中設定代理,以確保其他人也能使用。
客服記憶體不包含在聊天上下文中。
測試提示
在將提示定義為起始提示之前,先將該提示作為新工作階段的第一個提示執行,並確保沒有錯誤,且提示詞輸出有效。
並非所有提示都適合作為入門提示。 例如,需要事先上下文的提示不適合作為入門提示,因為這些提示無法正常運作。