在 智能 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
配置代理清单和生成交互式代理的步骤如下:
步骤 1:规划交互式代理
当代理和用户可能需要协作以获取引导式体验来解决问题时,交互式代理非常有用。 阐明交互式代理的目标和说明,指定可用的工具 (技能) ,并定义如何处理用户请求。
步骤 2:添加提示技能
属性 PromptSkill 通过指定要用于处理用户请求的目标、说明和功能来定义用户体验。 可以引用不同类型的工具 (技能) :AGENT (推荐) 、GPT、KQL 和 API。 有关创建不同工具类型的信息,请参阅 工具。
将
PromptSkill属性添加到代理清单。 这会创建“ 使用代理聊天” 选项。PromptSkill 的格式应设置为
SkillsetName.SkillName。 下面显示了 属性的代理清单PromptSkill示例部分,其中SkillsetName= SecurityCopilotDocsAgent,即Descriptor.name和SkillName= SecurityCopilotDocsAgent,这是在Format: Agent技能中定义的。PromptSkill: SecurityCopilotDocsAgent.SecurityCopilotDocsAgent在代理定义中,必须指定 所在技能集
AgentDefinition的名称,以及任何ChildSkills的技能集。 在 字段中列出所有RequiredSkillsets列表。Interfaces在代理技能描述符中包含 字段。 对于交互式代理,请将 接口设置为InteractiveAgent。UserRequest作为输入添加到PromptSkill。
步骤 3:添加提示
初学者提示
初学者提示 有助于设置上下文,并显示在交互式代理体验的开头。 它们可帮助用户了解代理可以执行的作并设置预期。
配置初学者提示:
特性
SuggestedPrompts用于带有 标志的IsStarterAgent声明。定义 ,
Title并且Personas提示与 对齐。
下面显示了仅在交互式代理体验中显示的初学者提示的代理清单示例部分。
SuggestedPrompts:
- Prompt: Show me areas in which Security Copilot can help me?
Title: Security Copilot Overview
Personas:
- 3
IsStarterAgent: true
仅当选择了 的角色类型 ITAdmin 时,才会显示此提示。
角色类型 ID 如下所示:
| ID | 角色类型 |
|---|---|
| 0 | CISO |
| 1 | SCO 分析师 |
| 2 | 威胁 Intel 分析师 |
| 3 | ITAdmin |
| 4 | 标识管理员 |
| 5 | 数据安全管理员 |
| 6 | 云管理员 |
SecurityCopilotDocsAgent在代理清单的交互式代理部分中,代理技能显示分配给不同角色的四个初学者提示。
下图演示了可以选择开始与代理交互的初学者提示。
提示建议
提示建议 是显示提示输出后后续提示的特选列表。 这些建议可确保用户始终处于引导体验中。
配置提示建议:
提示是在具有 属性的技能下添加的
SuggestedPrompts。-
IsStarterAgent和Personas对于提示建议,必须省略,以避免它们被视为初学者提示。
-
属性下
SuggestedPrompts的所有提示都会根据会话的上下文生成提示并对其进行排名。 这些提示是使用SuggestedPrompts作为起始模板生成的。提示建议在结果中显示为继续聊天对话的潜在提示。
如果选择任何提示建议,则可以在提交前编辑提示。
执行请求并返回响应。
注意
如果启用了动态生成的提示建议所需的工具,则业务流程协调程序不会检查。 如果运行未启用该工具的提示,则显示错误。 确保启用并配置了所有相关工具。
以下 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?
下图演示了处理提示并返回其结果后生成的提示建议。
步骤 4:提供说明
Instructions 是给代理的指示,用于定义其目标、如何处理请求和工作流、限制以及详细说明其结果。
从示例中,请参阅为代理提供的详细 Instructions 内容。
步骤 5:设置子技能
子技能是代理可以应用的工具和功能,使结果可预测和全面。 (技能) 执行特定任务的工具,由代理调用以实现其目标。
在示例中, microsoft_docs_search 是在 下RequiredSkillsets定义的 MCP 插件MCP.MSDocs。
ChildSkills:
- microsoft_docs_search
步骤 6:上传 YAML
使用所需属性配置代理 YAML 清单后,必须上传 YAML,以便可以使用“与代理聊天”功能。
- 将 YAML 作为自定义插件上传。 有关上传的说明,请参阅 上传自定义插件。
已知限制
下面是实现交互式代理的已知限制:
交互式代理仅支持一个输入,该输入必须是
UserRequest。用户可以通过选择“ 与代理聊天” 并使用其身份和同意进行身份验证来设置交互式聊天。 这不会设置代理供其他人使用,相应的用户需要在活动代理中设置代理,以确保其他人可以使用此代理。
聊天上下文中不包括代理内存。
测试提示
在将提示定义为初学者提示之前,请将提示作为新会话中的第一个提示运行,并确保没有错误,并且提示输出有效。
并非所有提示都适合用作初学者提示。 例如,需要先前上下文的提示不适合初学者提示,因为没有上下文可供这些提示正常工作。