copilot-studio-workflow

作者: microsoft

用于构建、同步、打包和交付 Copilot Studio 代理的开发工作流。在处理 Copilot Studio YAML 文件时使用此技能…

npx skills add https://github.com/microsoft/fasttrack --skill copilot-studio-workflow

Copilot Studio Workflow

Overview

  • Copilot Studio agents are YAML-first assets (.mcs.yml) that sync between a local repo and the cloud.
  • Treat the development/demo environment as the real working environment and the production environment as a packaged distribution target.
  • Keep generic placeholder URLs in git (for example contoso.sharepoint.com); real demo URLs belong only in the live environment.
  • Follow the proven loop: pull → revert env-specific files → edit → push → publish → test → commit.

Prerequisites & First-Time Setup

When starting work on a Copilot Studio project for the first time, verify the following tools are installed and configured. Run .\scripts\cps-status.ps1 for a quick health check.

Required

ToolPurposeInstall
GitSource control for agent YAML filesgit-scm.com
VS CodeEditor for YAML and local developmentcode.visualstudio.com
Copilot Studio VS Code ExtensionPull/push agent YAML between local files and cloud environmentsVS Code Marketplace
Power Platform environmentA Copilot Studio-enabled environment to develop inPower Platform admin center

Recommended

ToolPurposeInstall
Power Platform CLI (pac)Solution export/import, component managementMicrosoft docs
Copilot Studio Plugin (by Microsoft CAT Team)YAML authoring, schema validation, topic creation, agent testing, push/pull management — 30+ specialized skillscopilot plugin marketplace add microsoft/skills-for-copilot-studio then copilot plugin install copilot-studio@skills-for-copilot-studio
PowerShell 7+Cross-platform script executiongithub.com/PowerShell

How this skill relates to the Copilot Studio Plugin: The CAT Team plugin handles YAML authoring, schema validation, and agent management. This workflow skill handles the surrounding engineering workflow — source control, environment sync, solution packaging, and platform gotchas. They are complementary: install both for the best experience.

First session checklist

  1. Run .\scripts\cps-status.ps1 to detect the project and check tool availability.
  2. Install the Copilot Studio Plugin if not already installed (see Recommended table above).
  3. If no agent.mcs.yml exists, clone an agent from the cloud using the VS Code extension or Copilot Studio manage flow.
  4. If pac CLI is needed for solution packaging, authenticate: pac auth create --environment <URL>.
  5. Verify the VS Code Copilot Studio extension can connect to your environment (open the agent folder, Sync → Pull).

Development Loop

  1. Pull from cloud using the VS Code Copilot Studio extension (Sync → Pull) or the Copilot Studio manage flow.
  2. Revert workflow files immediately. Cloud pulls often inject environment-specific URLs into workflows/*.json and settings.mcs.yml. Run .\scripts\cps-revert.ps1 (or git checkout -- **/workflows/ **/settings.mcs.yml) before reviewing diffs.
  3. Edit locally in .mcs.yml files: topics, actions, variables, instructions, triggers, and agent settings.
  4. Push to cloud with the VS Code extension (Sync → Push) or manage-agent tooling.
  5. Publish in Copilot Studio so the draft becomes live.
  6. Test in the real channel (Teams or Microsoft 365 Copilot). The test pane is useful for quick checks, but it is not representative of production behavior.
  7. Commit to git only after the live agent behaves correctly and workflow files are clean.

Solution Packaging

  • Use pac solution export to export the solution from the demo environment.
  • The solution should include the agent, Power Automate flows, and connection references.
  • For production distribution: export → unpack → scrub environment URLs → repack as a clean zip.
  • Teams import the solution zip, reconnect dependencies, re-enable flows, and follow the setup guide.

Adding New Components

  • A VS Code push creates Dataverse components, but it does not add new bot components to the Power Platform solution.
  • Add them explicitly with pac solution add-solution-component -sn <SOLUTION> -c <GUID> -ct botcomponent.
  • Find the component GUID with pac org fetch against botcomponent records.
  • Use .\scripts\cps-add-component.ps1 for guided lookup and add-to-solution flow.

Platform Gotchas

Initialization

  • OnConversationStart does not fire in Microsoft 365 Copilot and usually fires only once in Teams. Use OnActivity(type: Message) plus an IsBlank() just-in-time guard instead.
  • Copilot Studio does not stream partial messages; the platform batches output.

Packaging

  • VS Code push ≠ solution membership. New components must be added to the solution separately.
  • Global variables need YAML definitions in variables/ or solution imports can fail or create broken references.
  • Solution import deactivates Power Automate flows; always re-enable them after import.
  • Cloud pull brings environment-specific URLs into workflow files; always revert them before commit.
  • Extension push/pull is all-or-nothing; there is no selective sync.

Development

  • ConcurrencyVersionMismatch on push usually means someone changed the cloud copy. Pull again before pushing.
  • The Copilot Studio test pane does not match real channel behavior; validate in Teams or Microsoft 365 Copilot.
  • Housekeeping flow push error 0x80040216 is a known benign issue.

Deployment

  • Export scripts capture the state that exists at export time. Do not run packaging scripts after a YAML push unless you intend to rebuild from that exact state.
  • pac component type codes are brittle across environments; prefer the name-based -ct botcomponent pattern in your workflow.

Best Practices

Agent Architecture

  • Use a constitution file pattern (markdown files in SharePoint or OneDrive) for dynamic instructions — edit behavior without YAML surgery.
  • Keep agent instructions concise in agent.mcs.yml; load detailed context via global variables populated at runtime by a Power Automate flow.
  • Use OnActivity(type: Message) with an IsBlank() JIT guard for reliable context initialization across all channels (Teams, M365 Copilot).

YAML Hygiene

  • One topic per file. Name files to match the topic's purpose (for example Greeting.mcs.yml, EscalateToHuman.mcs.yml).
  • Define all global variables explicitly in variables/ with YAML files — never rely on UI-only definitions.
  • Use descriptive schemaName values — they appear in Dataverse queries and logs.

Testing

  • Always test in the real channel (Teams or M365 Copilot), not just the test pane.
  • MCP tools, connectors, and OAuth flows only work in published agents on real channels.
  • Use calendar-driven routines (for example [AgentName Routine] Weekly Review) for testing autonomous behaviors.

Solution Packaging

  • Establish a URL placeholder convention from day one (for example contoso.sharepoint.com). Retrofitting is painful.
  • Always revert workflow files after cloud pulls — one missed revert leaks production URLs into source control.
  • After pushing new components via VS Code, explicitly add them to the solution with pac solution add-solution-component.
  • Re-enable all Power Automate flows after every solution import — imports deactivate them silently.

Memory & State (for agents with persistent memory)

  • Use SharePoint lists for structured memory (facts, preferences, tasks) and markdown files for narrative or journal memory.
  • Design memory with expiration — stale facts degrade agent quality over time.
  • Keep memory scoped (for example preference:timezone, person:manager) for efficient retrieval.

Security & Governance

  • Review all MCP tools and connectors before enabling — each one expands the agent's access surface.
  • Use the KillSwitch pattern (a config flag that halts autonomous behavior) for any agent that acts without user prompting.
  • Audit agent activity through logging lists or flows — autonomous agents need observability.

Included Scripts

  • scripts/cps-status.ps1 — quick project health check: agent info, counts, git state, dirty workflow files, and pac availability.
  • scripts/cps-revert.ps1 — run after every cloud pull to revert workflows/*.json and settings.mcs.yml back to the repo-safe version.
  • scripts/cps-preflight.ps1 — run before push to check workflow hygiene, git state, and missing global variable definitions.
  • scripts/cps-add-component.ps1 — locate a bot component by schema pattern and add it to the Power Platform solution.

Quick Reference

TaskCommand / Path
First-time setup.\scripts\cps-status.ps1
Install pac CLIwinget install Microsoft.PowerPlatformCLI (Windows) or dotnet tool install --global Microsoft.PowerApps.CLI.Tool
Authenticate pacpac auth create --environment <URL>
Clone agent from cloudVS Code extension → open folder → Sync → Pull
Pull from cloudVS Code Copilot Studio extension → Sync → Pull
Push to cloudVS Code Copilot Studio extension → Sync → Push
Revert workflows.\scripts\cps-revert.ps1 or git checkout -- **/workflows/ **/settings.mcs.yml
PublishCopilot Studio → Publish
Pre-push check.\scripts\cps-preflight.ps1
Add component.\scripts\cps-add-component.ps1 -SolutionName "MySolution" -SchemaPattern "my.topic.Name"
Project status.\scripts\cps-status.ps1
Emergency stopSet KillSwitch = true in the config list

References

  • Deep dive: reference/gotchas.md
  • Workflow details: reference/workflow-guide.md

来自 microsoft 的更多技能

oss-growth
microsoft
OSS增长黑客角色
agent-framework-azure-ai-py
microsoft
使用Microsoft Agent Framework Python SDK(agent-framework-azure-ai)构建Azure AI Foundry代理。在创建使用AzureAIAgentsProvider的持久化代理、使用托管工具(代码解释器、文件搜索、网络搜索)、集成MCP服务器、管理对话线程或实现流式响应时使用。涵盖函数工具、结构化输出和多工具代理。
development
airunway-aks-setup
microsoft
在AKS上设置AI Runway——从裸集群到运行模型。涵盖集群验证、控制器安装、GPU评估、提供商设置和首次部署。适用场景:“设置AI Runway”、“接入AKS集群”、“安装AI Runway”、“airunway设置”、“将模型部署到AKS”、“在AKS上进行GPU推理”、“在AKS上配置KAITO”、“在AKS上运行LLM”、“在AKS上使用vLLM”、“在AKS上设置模型服务”、“AI Runway控制器”。
devops
appinsights-instrumentation
microsoft
使用Azure Application Insights对Web应用进行插桩的指南。提供遥测模式、SDK设置和配置参考。适用场景:如何对应用进行插桩、App Insights SDK、遥测模式、什么是App Insights、Application Insights指南、插桩示例、APM最佳实践。
devops
applicationinsights-web-ts
microsoft
使用Application Insights JavaScript SDK(@microsoft/applicationinsights-web)为浏览器/Web应用添加检测。用于真实用户监控(RUM)——页面视图、点击、AJAX/fetch依赖项、异常、自定义事件,以及与后端OpenTelemetry追踪关联的浏览器端GenAI代理追踪。涵盖SDK加载器脚本和npm设置、框架扩展(React、React Native、Angular)、点击分析、遥测初始化器,以及从浏览器发出的代理/工具/模型跨度所遵循的OTel GenAI语义约定。
devops
azure-ai-anomalydetector-java
microsoft
使用适用于 Java 的 Azure AI 异常检测器 SDK 构建异常检测应用程序。在实现单变量/多变量异常检测、时间序列分析或 AI 驱动的监控时使用。
development
azure-ai-language-conversations-py
microsoft
使用azure-ai-language-conversations Python SDK实现对话语言理解(CLU)。当使用ConversationAnalysisClient分析对话意图和实体、构建NLP功能或将语言理解集成到应用程序中时使用。
development
azure-ai-ml-py
microsoft
Azure Machine Learning SDK v2 for Python。用于机器学习工作区、作业、模型、数据集、计算资源和管道。 触发词:“azure-ai-ml”、“MLClient”、“工作区”、“模型注册表”、“训练作业”、“数据集”。
development