Discovery 智能体端到端部署
discovery-services-agent-deployer
通过一个命令端到端部署 Discovery 目录中的智能体:发现智能体、在存在工具时构建并绑定该工具、对没有工具的智能体跳过工具相关阶段、部署智能体,并可选择运行验证。当用户要求部署 Discovery 智能体、发布或重建智能体工具镜像、从仓库中的 Dockerfile/tool.yaml 注册 Discovery 工具、恢复失败的部署,或为该目录中的某个智能体生成预演(dry-run)部署计划时使用此技能。
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 289
- Forks
- 101
01 前言 Front Matter
- name
- discovery-services-agent-deployer
- description
- Deploy Discovery catalog agents end-to-end with one command: discover the agent, build and bind its tool when present, skip tool stages for agents without tools, deploy the agent, and optionally run validation. Use this skill whenever the user asks to deploy a Discovery agent, publish or rebuild an agent tool image, register a Discovery tool from a repo Dockerfile/tool.yaml, resume a failed deployment, or produce a dry-run deployment plan for an agent in this catalog.
- allowed-tools
- shell
02 资源文件 5
- 参考文档config.template.json650 B
- 参考文档references/configuration.md5.3 KB
- 参考文档references/operations.md13.1 KB
- 参考文档references/troubleshooting.md1.8 KB
- 脚本scripts/deploy-discovery-agent.ps1121.1 KB
03 SKILL.md 正文
Discovery Agent Deployer
Compatibility
Runs on Windows, macOS, and Linux through PowerShell 7+ (pwsh). Requires git, python with pip, and Azure CLI (az). Docker is optional because the runner can use Azure Container Registry Tasks when local Docker is unavailable.
New configurations default to Discovery GA 2026-06-01. Explicit preview versions in local configs and saved runs remain unchanged. See configuration for version-specific validation routes and knowledge-base binding formats.
What this skill does
Deploy one or more Discovery catalog agents from this repository with a single deterministic runner:
pwsh -NoProfile -ExecutionPolicy Bypass -File .github/skills/discovery-services-agent-deployer/scripts/deploy-discovery-agent.ps1 <agent-name>
The single PowerShell script discovers the agent folder, selects its tool folder when present, builds and pushes the image, creates or updates the Microsoft.Discovery/tools resource, patches a run-local copy of agent.yaml, deploys the agent, validates it with a temporary investigation, and prints a final summary. If the agent has no tool, it skips build and deploy-tool and continues with agent deployment. It persists stage status to stage-todos.json in the run directory so the invoking assistant can keep native Copilot task tracking in sync without duplicating progress logs.
Agent deployment sets humanInTheLoop and every bound tool's confirmation to Disabled, even if the source YAML enables them. This persists for subsequent uses of the deployed agent, not just validation. The source YAML is unchanged. This does not bypass Supercomputer nodepool confirmation, platform-required actions, or approval requests in agent instructions; unexpected validation approvals still require user input.
When to use
Use this skill for requests like:
- "/discovery-services-agent-deployer
chembl" - "/discovery-services-agent-deployer
chemblaizynthfinder" - "Deploy the
aizynthfinderagent" - "Build and publish the tool image for this Discovery agent"
- "Create the Discovery tool resource from this agent's Dockerfile and tool.yaml"
- "Resume the failed deployment in this run folder"
- "Show me what would be deployed for this agent before running it"
If the user only wants inventory, use the discovery-catalog skill instead.
Customer inputs
The happy path needs only the agent name. Optional parameters reduce rework or make automation explicit:
| Parameter | Purpose |
|---|---|
<agent-name> [agent-name...] or -AgentName <name>[,<name>...] |
Agent folder name under agents/. Positional names are preferred for slash-style use such as /discovery-services-agent-deployer chembl aizynthfinder. Required unless resuming. |
-PublisherName <name> |
Deprecated. Tolerated for backwards compatibility but ignored — agents live in the flat agents/<agent-name>/ layout with no publisher folder. The deployer prints a one-line deprecation notice when the flag is supplied. |
-BuildMode auto|remote|local |
Defaults to auto; if input is required, ask the customer for remote or local. Do not store build mode in config.json. |
-Resume <RunDir> |
Continues from a prior checkpointed run. |
-Stage init|build|deploy-tool|deploy-agent|validate|summary|stop |
Runs exactly one stage, allowing Copilot to update native TODOs between terminal commands. |
-RunDir <RunDir> |
Required with -Stage after init. |
-ConfirmSupercomputerNodepools |
Run-scoped confirmation that the customer chose Proceed for the current run's tool/SKU plan. Do not store this in config.json. |
-ValidationPrompt <prompt> |
Run-scoped validation prompt generated by Copilot from the deployed agent/tool context. Overrides config testPrompt for this run. |
-SkipValidation |
Deploys without the post-deploy investigation test. |
-WhatIfPlan |
Prints repo discovery and planned stages without Azure calls. |
Local environment values live in .github/skills/discovery-services-agent-deployer/config.json, copied from config.template.json. The populated file is intentionally gitignored; never commit it. Never assume the file exists. Stage 1 must verify these required values are present: subscriptionId, resourceGroup, acrName, location, workspaceEndpoint, project, tenantId, chatModel, and forceToolImageRebuild. acrResourceGroup is optional and is used when ACR is in a different resource group from Discovery resources. testPrompt is optional; when present and non-empty it overrides Copilot-generated validation prompts. For every missing required value, ask the user only for fields listed in CONFIG_FIELDS_TO_COLLECT; do not choose from examples or defaults yourself. Do not store buildMode or confirmSupercomputerNodepools in config.json; both are per-run choices.
Workflow
- For planning or uncertain agent names, run
-WhatIfPlanfirst. - Before creating native Copilot TODOs, validate every requested agent exists at
agents/<agent-name>/agent.yaml. - If any requested agent is missing, do not create deployment TODOs; stop and ask the user to fix the name.
- After validation succeeds and before starting deployment work, create the native Copilot TODO list for every requested agent.
- For deployment, invoke the single runner from the repo root.
- If the runner emits
CONFIG_INPUT_REQUIRED=true, ask the user for the listed values in Copilot chat, write the ignoredconfig.json, then rerun the stage. Do not fill missing fields from defaults, examples, or prior assumptions without a user answer. - If the runner emits
BUILD_MODE_INPUT_REQUIRED=true, ask the user to chooseremoteorlocal, then rerun with-BuildMode <choice>. Do not writebuildModetoconfig.json. - Before building a tool, show the
TOOL_BUILD_PLANwith image andrecommendedSkus. When the runner emitsSUPERCOMPUTER_NODEPOOL_CONFIRMATION_REQUIRED=true, stop immediately and ask the customer the exact question in theCOPILOT SUPERCOMPUTER NODEPOOL INPUT REQUESTblock through the assistant choice-prompt UI, not as plain text. In this CLI, use theask_usertool with exactly these choices:Proceed - I have Supercomputer nodepool capacity for at least one listed SKU.andStop - I do not have the required Supercomputer nodepool capacity.Do not continue, do not infer Proceed, and do not run with-ConfirmSupercomputerNodepoolsuntil the customer explicitly chooses Proceed. If Proceed, rerun the build with-ConfirmSupercomputerNodepools; if Stop, run-Stage stop -RunDir <RunDir>. - Before validation for tool-backed agents, use this priority order for the validation prompt: explicit
-ValidationPrompt, then non-empty configtestPrompt, then Copilot-generated prompt. If the runner emitsVALIDATION_PROMPT_INPUT_REQUIRED=true, do not ask the user; generate the prompt yourself from theCOPILOT VALIDATION PROMPT REQUESTblock and rerun-Stage validate -ValidationPrompt "<generated prompt>". - If validation fails or semantically reports blocked/failed output, mark
validatefailed andsummarystopped. Readvalidation-result.jsonwhen available. - If a stage fails, fix the reported issue and rerun with
-Resume <RunDir>, except for nodepool Stop where the user should rerun the skill later after capacity is available. - Report the final summary printed by the runner; do not invent status from partial logs.
For slash-style requests like /discovery-services-agent-deployer chembl aizynthfinder, treat the words after the skill name as positional agent names and invoke the runner as:
pwsh -NoProfile -ExecutionPolicy Bypass -File .github/skills/discovery-services-agent-deployer/scripts/deploy-discovery-agent.ps1 chembl aizynthfinder
Copilot task tracking
When running in VS Code GitHub Copilot or any environment that exposes a task/TODO UI above the prompt, the native TODO list is required for deployments. Create the TODOs only after all requested agent names pass preflight validation, but create them before invoking the long-running deployment path.
For agents with a tool, create the six-stage TODO list:
init- discover agent, validate prerequisites, collect config, create run directorybuild- build and push the tool imagedeploy-tool- create or update the Discovery tool resourcedeploy-agent- patch the run-local agent YAML and deploy the agentvalidate- run the post-deployment investigation test, unless-SkipValidationis setsummary- print and report final deployment summary
For agents without a tool, create only the four relevant TODOs: init, deploy-agent, validate, and summary. Do not create native TODO items for build or deploy-tool; the runner skips those stages internally.
To keep the native TODO UI accurate, use stage-at-a-time execution instead of one long end-to-end command whenever the TODO UI is visible. Mark the matching TODO in_progress, run exactly one stage, then mark it done only after the command exits successfully or emits TASK_STATUS=<stage>:done. If the runner emits TASK_STATUS=<stage>:input_required, collect the requested input in Copilot chat and rerun the same stage rather than marking it failed. For nodepool input, present the Proceed/Stop question through the available choice-prompt mechanism (ask_user in this CLI), never as a plain-text “reply with Proceed or Stop” message, and never self-confirm by immediately rerunning with -ConfirmSupercomputerNodepools. Do not start the next stage command until the native TODO state visibly reflects the completed stage. If the command output shows TASK_STATUS=deploy-agent:done, update deploy-agent to done before running validate; if it shows TASK_STATUS=validate:done, update validate to done before running summary. The runner also emits TASK_PLAN=<agent>/<stage> lines immediately after preflight succeeds; use these as a final prompt to create any missing native TODOs before stage work begins. Mark the active TODO failed if the stage command fails, then report the -Resume <RunDir> command.
Before sending the final success response, reconcile the native TODO list with the runner output. If validation and summary succeeded, the visible TODOs for deploy-agent, validate, and summary must be marked done. Never report "all stages succeeded" while any visible deployment TODO remains in progress or pending.
For two or more agents, create a separate TODO set per agent and include the agent name in each TODO label, for example chembl / build and online-researcher / deploy-agent. Use six TODOs for tool-backed agents and four TODOs for agents without tools. Run stages sequentially per agent using -Stage; this gives Copilot a chance to update chembl / build before starting chembl / deploy-tool. The end-to-end multi-agent runner remains available for automation, but it should not be used when the user expects the native Copilot TODO UI to advance during the run.
If no task/TODO UI is available, use the concise [runner] START/DONE/SKIP lines and stage-todos.json as the progress record.
Stage-at-a-time command sequence
Use this pattern when native Copilot TODOs are visible:
# init emits RUN_DIR=<path>; capture it for later stages
pwsh -NoProfile -ExecutionPolicy Bypass -File .github/skills/discovery-services-agent-deployer/scripts/deploy-discovery-agent.ps1 chembl -Stage init
pwsh -NoProfile -ExecutionPolicy Bypass -File .github/skills/discovery-services-agent-deployer/scripts/deploy-discovery-agent.ps1 -RunDir <RunDir> -Stage build
pwsh -NoProfile -ExecutionPolicy Bypass -File .github/skills/discovery-services-agent-deployer/scripts/deploy-discovery-agent.ps1 -RunDir <RunDir> -Stage deploy-tool
pwsh -NoProfile -ExecutionPolicy Bypass -File .github/skills/discovery-services-agent-deployer/scripts/deploy-discovery-agent.ps1 -RunDir <RunDir> -Stage deploy-agent
pwsh -NoProfile -ExecutionPolicy Bypass -File .github/skills/discovery-services-agent-deployer/scripts/deploy-discovery-agent.ps1 -RunDir <RunDir> -Stage validate -ValidationPrompt "<Copilot-generated validation prompt>"
pwsh -NoProfile -ExecutionPolicy Bypass -File .github/skills/discovery-services-agent-deployer/scripts/deploy-discovery-agent.ps1 -RunDir <RunDir> -Stage summary
After each command returns, update the matching native TODO before issuing the next command. This pause is part of the workflow, not optional; Copilot cannot reliably update the TODO UI after several stages have already been run in one uninterrupted sequence.
Commands
Dry-run plan
pwsh -NoProfile -ExecutionPolicy Bypass -File .github/skills/discovery-services-agent-deployer/scripts/deploy-discovery-agent.ps1 -AgentName aizynthfinder -WhatIfPlan
Equivalent positional form:
pwsh -NoProfile -ExecutionPolicy Bypass -File .github/skills/discovery-services-agent-deployer/scripts/deploy-discovery-agent.ps1 aizynthfinder -WhatIfPlan
Dry-run or deploy multiple agents
pwsh -NoProfile -ExecutionPolicy Bypass -File .github/skills/discovery-services-agent-deployer/scripts/deploy-discovery-agent.ps1 chembl aizynthfinder -WhatIfPlan
Deploy with automatic build mode
pwsh -NoProfile -ExecutionPolicy Bypass -File .github/skills/discovery-services-agent-deployer/scripts/deploy-discovery-agent.ps1 -AgentName aizynthfinder
Force remote ACR build
pwsh -NoProfile -ExecutionPolicy Bypass -File .github/skills/discovery-services-agent-deployer/scripts/deploy-discovery-agent.ps1 -AgentName aizynthfinder -BuildMode remote
Resume a failed run
pwsh -NoProfile -ExecutionPolicy Bypass -File .github/skills/discovery-services-agent-deployer/scripts/deploy-discovery-agent.ps1 -Resume agents/tmp/aizynthfinder/20260508-172700
Reporting contract
When the runner completes, summarize:
RUN_DIRIMAGE_REFTOOL_RESOURCE_IDif available- stage TODO statuses from native Copilot task tracking or
stage-todos.json - stage statuses from
SUMMARY_STAGE_* - validation status (
passed,pending, or skipped)
If the runner fails, report the failed stage, the action required from the script output, and the exact -Resume <RunDir> command when a run directory exists.
References
references/configuration.md- local config fields and Copilot-style input behaviorreferences/operations.md- runner behavior, checkpoints, and resume modelreferences/troubleshooting.md- common failures and recovery steps
Keep SKILL.md lean. Prefer the single public runner and references over ad-hoc scripts or long manual instructions. The deployer implementation is intentionally consolidated into scripts/deploy-discovery-agent.ps1 so there is only one executable script to maintain.
04 同仓库更多 Skills
quickstart-runner
Follow a supplied full QuickStart Scenario guide and its exact input files from a fresh Discovery project. Use for run this QuickStart, BioPharma, SiPhy, CMS or Bookshelf setup. Check readiness, obtain separate setup and execution approvals, and validate actual outputs. Do not replace the guide with a generated profile or infer permission from examples.
token-estimator-mvp
Estimate AI planning ranges from a work description or explicitly authorized safe project context. Provides coarse class ranges or conditional planning bases without requiring token guesses.
build-research-paper
Cross-domain / Scientific writing and publication — Build beautifully-formatted, arxiv-ready research paper PDFs from a mix of hand-authored LaTeX and/or markdown + PNG figures, using `tectonic` (default) or `pandoc` (escape hatch). Captures the reusable pattern that research projects keep re-discovering: `report/main.tex` + `references.bib` + `generate_figures.py` + iterative feedback/response scaffolding, all buildable with a single command. WHEN: write a research paper, arxiv submission, prepub, generate PDF from markdown, LaTeX paper, build main.tex, journal manuscript, referee revision, response to referee, resubmission package, publication-quality figures, matplotlib publication style, tectonic build, pandoc build, generate arxiv-ready PDF, bibliography from BibTeX.
Discovery 示例智能体导入
add-example-agents
从公共的 microsoft/discovery GitHub 仓库将智能体添加到此工作区,方式可以是:(a) 本地方式,用于 Copilot 应用,为每个智能体生成一个 `.agent.md` 伴随文件(以便每个智能体都可通过 `runSubagent` 调用);(b) 通过 `UpsertAgent` 将上游最新来源的智能体添加到 Microsoft Discovery 项目(存在时绑定已有的工具 ARM 资源,缺失时先在 Azure 中构建、推送并注册这些资源);或 (c) 将已添加到本地 Copilot 应用的智能体(来源于其 `.github/agents/<name>.agent.md` 伴随文件;带工具的智能体还带有 `discovery_catalog/<name>/` 文件夹以及本地构建的工具容器,而无工具的智能体仅有伴随文件)提升到指定的 Microsoft Discovery 项目 + Azure,且不再从上游重新获取或刷新。用户每次运行只能从这三个目标中精确选择一个。适用场景:'添加 discovery 智能体''下载 discovery 智能体''安装所有 Microsoft discovery 智能体''从 microsoft/discovery 添加智能体''从 microsoft/discovery 创建 copilot 智能体''将 discovery 智能体部署到 Foundry''将 discovery 智能体部署到 Azure''将本地智能体提升到 Microsoft Discovery''将本地智能体及其容器推送到 Discovery 项目''将本地应用智能体复制到 Azure'。始终将上游仓库 `agents/<name>/` 下每个选中的子文件夹刷新到 `discovery_catalog/<name>/`,使本地目录保持最新(出现新智能体、显现已移除的智能体、应用更新后的内容)。判断智能体是否"已在本地添加"使用 `.github/agents/<name>.agent.md`(Copilot 伴随文件),而非 `discovery_catalog/` 文件夹。对于本地部署,每个生成的 `.agent.md` 都带有延迟的 Docker 引导前言,使智能体仅在首次使用且工具镜像不存在时才构建该镜像。对于 Discovery + Azure 部署,会针对工作区的资源组(RG)通过 `GetDiscoveryTool` 对每个声明的工具进行预检,并**在工具已存在时完全跳过 Docker 构建 / ACR 推送 / AcrPull RBAC**(这在 `mdqacr` 等注册表上的共享目录镜像中很常见);仅构建并注册实际缺失的工具。始终通过 `UpsertAgent` 在选定的 Discovery 项目中创建智能体,并轮询 `GetAgent` 直到 `provisioningState=Succeeded`(MCP 的 `GetAgentOperation` 工具在实践中会返回不透明错误;切勿依赖它)。所有 MCP 调用都通过嵌入在本 SKILL.md 中、并在步骤 4d 期间具体化为 `.vscode/` 的 PowerShell 脚本进行——该技能不依赖同级的辅助文件,也不依赖 VS Code MCP 运行时在会话中途浮现 `mcp_microsoft-dis_*` 工具。通过 `agents action=create` 进行的本地 Discovery 运行时注册是可选的,默认跳过。不要用于:运行已部署的智能体(使用 runSubagent),或编辑单个智能体的提示词(直接编辑 `agent.yaml`)。
Podman Containerfile 迁移
migrate-podman-containerfile
将 Podman Containerfile 迁移为 Discovery 目录要求的规范 Dockerfile。当 PR 未通过 POL-022 检查、某个工具包含 Containerfile 或 Dockerfile.in,或贡献者要求将 Podman 构建文件转换为 Docker 构建文件时使用。仅在迁移在机械上安全时直接创建 Dockerfile,并拒绝处理存在歧义的预处理或多文件构建。
Discovery 入门工具包部署
discovery-services-starter-kit-deployer
端到端部署 Discovery 目录中的入门工具包(starter-kit):验证 kit.json 中的 agentRefs、构建并部署每个引用的智能体工具、逐一部署每个引用的智能体,并汇总已部署的智能体/工具以及可直接提供给客户的示例提示词。当用户要求部署 Discovery 入门工具包,或部署 starter-kits/*/kit.json 中列出的所有智能体时使用此技能。