microsoft / microsoft/GitHub-Copilot-for-Azure
Replace microsoft-foundry skill model-capacity probe with a script
- Dominant language
- Python
- Stars
- 250
- Forks
- 204
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 67
Description
## Summary
Copilot has identified a portion of a skill that is a good candidate for replacement with a script.
The candidate is the **model-capacity probe** in the `microsoft-foundry` skill's deploy-model area — a fixed `az rest .../modelCapacities` query (current region and all-regions variants) plus a `jq` parse into available/unavailable, reimplemented inline in four files.
## Candidate description
To find where a model can be deployed, the skill runs the same deterministic query:
1. `az rest --method GET .../modelCapacities?...` (optionally scoped to `/locations/`).
2. Parse the large `value[]` array, keeping only `location`, `skuName`, and `availableCapacity`.
3. If capacity is 0 in the current region, scan all regions and rank by `availableCapacity`.
This is a strong script candidate because it is:
- **The single most-repeated sequence** in the deploy-model file set, appearing in four files (`preset-workflow.md`, `workflow.md`, `customize-workflow.md`, `capacity/SKILL.md`).
- **Output-heavy / few-fields-needed** — only three fields of a large JSON array matter.
- **Already proven scriptable** — the `capacity` sub-skill ships `query_capacity.{sh,ps1}` and `discover_and_rank.{sh,ps1}`; preset and customize reimplement the same REST+`jq` inline instead of reusing them.
**Sketch — `query-model-capacity.{sh,ps1}`:**
- **Input:** `--model`, `--region` (optional; omit to scan all regions), `--sku` (optional).
- **Output:** a ranked table (Region / SKU / Available), or a single-region result.
> Which region the user ultimately picks when several qualify stays in prose. The script handles only the query + ranked-table production.
**Note — consolidation:** Ideally this is the same shared script already used by the `capacity` sub-skill, reused by `preset` and `customize` rather than re-inlined.
## Affected file and lines
- [`models/deploy-model/preset/references/preset-workflow.md` — single + multi-region capacity query (L161–L278)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/microsoft-foundry/models/deploy-model/preset/references/preset-workflow.md#L161-L278)
- [`models/deploy-model/preset/references/workflow.md` — condensed capacity query (L76–L109)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/microsoft-foundry/models/deploy-model/preset/references/workflow.md#L76-L109)
- [`models/deploy-model/customize/references/customize-workflow.md` — modelCapacities REST (L122–L166)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/microsoft-foundry/models/deploy-model/customize/references/customize-workflow.md#L122-L166)
- [`models/deploy-model/capacity/SKILL.md` — capacity probe (L57–L77)](https://github.com/microsoft/GitHub-Copilot-for-Azure/blob/3890cbfb65c548ce8daa96cabd1d8de63f7bbcca/plugin/skills/microsoft-foundry/models/deploy-model/capacity/SKILL.md#L57-L77)
## Next steps
1. **Evaluate the candidate** — confirm the steps are stable and parameterizable, and that the script captures everything the skill needs.
2. **Create both a bash _and_ a PowerShell version** of the script so the skill works across platforms.
3. **Run integration tests** to verify the scripts behave correctly and the skill still completes end-to-end.
## Background Information
### Why replace regular steps with scripts
Replacing a regular, well-defined series of steps with a script can:
- **Reduce token usage** — the skill no longer needs to spell out each command and parse large command output inline; the agent invokes one script and reads a compact result.
- **Improve reliability** — the logic is written and tested once, instead of being re-derived by the agent on every run.
- **Improve determinism** — the same inputs always produce the same steps and output, removing run-to-run variation.
- **Improve speed of execution** — a single script call replaces multiple round-trips of command generation, execution, and large-output parsing.
### Authoring notes for the scripts
- **Reference scripts with markdown links**, not just a bare path to the script file.
- **Include examples** in the skill showing how to run each script (sample invocation with arguments).
- **Briefly explain what each script does** where it is referenced.
- **The script output should explain what it did**, so the agent and user can understand the result without re-inspecting raw command output.
Contributor guide
Assessment
This issue has not been assessed yet.