Foundry-Agent-Sync
Foundry-Agent-Sync是一款code方向的AI技能,核心价值是Create and synchronize prompt-based AI agents directly within Azure AI Foundry via REST API, from a local JSON manifest,可用于解决开发者在code领域的实际问题,帮助用户提升效率、自动化重复任务或优化工作流。
Create and synchronize prompt-based AI agents directly within Azure AI Foundry via REST API, from a local JSON manifest. Unlike scaffolding skills that only generate local code, this skill registers a
mkdir -p ./skills/foundry-agent-sync && curl -sfL https://raw.githubusercontent.com/github/awesome-copilot/main/skills/foundry-agent-sync/SKILL.md -o ./skills/foundry-agent-sync/SKILL.md Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).
Skill Content
# Foundry Agent Sync
Overview
Create and synchronize prompt-based AI agents directly within Azure AI Foundry via the Agent Service REST API. This skill registers agents in the Foundry service itself — making them immediately available for invocation, evaluation, and management through the Foundry portal or API. Each agent is created or updated idempotently via a named POST call, using definitions from a local JSON manifest file.
> **Key distinction:** This skill creates agents inside AI Foundry (server-side). It does not scaffold local agent code or container images — for that, use the `microsoft-foundry` skill's `create` sub-skill.
Prerequisites
The user must have:
1. An Azure AI Foundry project with a deployed model (e.g. `gpt-5-4`)
2. Azure CLI (`az`) authenticated with access to the Foundry project
3. The **Azure AI User** role (or higher) on the Foundry project resource
Collect these values before proceeding:
| Value | How to get it |
|---|---|
| **Foundry project endpoint** | Azure Portal → AI Foundry project → Overview → Endpoint, or `az resource show` |
| **Subscription ID** | `az account show --query id -o tsv` |
| **Model deployment name** | The model name deployed in the Foundry project (e.g. `gpt-5-4`) |
Manifest Format
The manifest is a JSON array where each entry defines one agent. Look for it at common paths: `infra/foundry-agents.json`, `foundry-agents.json`, or `.foundry/agents.json`. If none exists, scaffold one.
[
{
"useCaseId": "alert-triage",
"description": "Short description of what this agent does.",
"baseInstruction": "You are an assistant that... <system prompt for the agent>"
}
]Field Reference
| Field | Required | Description |
|---|---|---|
| `useCaseId` | Yes | Kebab-case identifier; used to build the agent name (`{prefix}-{useCaseId}`) |
| `description` | Yes | Human-readable description stored as agent metadata |
| `baseInstruction` | Yes | System prompt / base instructions for the agent |
Sync Script
PowerShell (interactive / CI)
Create or locate the sync script. The canonical path is `infra/scripts/sync-foundry-agents.ps1` but adapt to the repo layout.
param(
[Parameter(Mandatory)]
[string]$SubscriptionId,
[Parameter(Mandatory)]
[string]$ProjectEndpoint,
[string]$ManifestPath = (Join-Path $PSScriptRoot '..\foundry-agents.json'),
[string]$ModelName = 'gpt-5-4',
[string]$AgentNamePrefix = 'myproject',
[string]$ApiVersion = '2025-11-15-preview'
)
$ErrorActionPreference = 'Stop'
# Optional: append a common instruction suffix to every agent
$commonSuffix = ''
az account set --subscription $SubscriptionId | Out-Null
$accessToken = az account get-access-token --resource https://ai.azure.com/ --query accessToken -o tsv
if (-not $accessToken) { throw 'Failed to acquire Foundry access token.' }
$definitions = Get-Content -Raw -Path $ManifestPath | ConvertFrom-Json
$headers = @{ Authorization = "Bearer $accessToken" }
$results = @()
foreach ($def in $definitions) {
$agentName = "$AgentNamePrefix-$($def.useCaseId)"
$instructions = if ($commonSuffix) { "$($def.baseInstruction)`n`n$commonSuffix" } else { $def.baseInstruction }
$body = @{
definition = @{ kind = 'prompt'; model = $ModelName; instructions = $instructions }
description = $def.description
metadata = @{ useCaseId = $def.useCaseId; managedBy = 'foundry-agent-sync' }
} | ConvertTo-Json -Depth 8
$uri = "$($ProjectEndpoint.TrimEnd('/'))/agents/$agentName`?api-version=$ApiVersion"
$resp = Invoke-RestMethod -Method Post -Uri $uri -Headers $headers -ContentType 'application/json' -Body $body
$version = $resp.version ?? $resp.latest_version ?? $resp.id ?? 'unknown'
Write-Host "Synced $agentName ($version)"
$results += [pscustomobject]@{ name = $agentName; version = $version }
}
$results | Format-Table -AutoSizeBash (Bicep deployment script / CI)
For automated deployment via `Microsoft.Resources/deploymentScr
🎯 Best For
- Developers scaffolding new projects
- Prototype builders
- Claude users
- GitHub Copilot users
- Software engineers
💡 Use Cases
- Bootstrapping React components
- Creating API route handlers
- Code quality improvement
- Best practice enforcement
📖 How to Use This Skill
- 1
Install the Skill
Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.
- 2
Load into Your AI Assistant
Open Claude or GitHub Copilot and reference the skill. Paste the SKILL.md content or use the system prompt tab.
- 3
Apply Foundry-Agent-Sync to Your Work
Open your project in the AI assistant and ask it to apply the skill. Start with a small module to verify the output quality.
- 4
Review and Refine
Review AI suggestions before committing. Run tests, check for regressions, and iterate on the skill output.
❓ Frequently Asked Questions
Can I customize the generated output?
Yes — modify the skill's prompt instructions to match your project conventions and coding style.
Is Foundry-Agent-Sync compatible with Cursor and VS Code?
Yes — this skill works with any AI coding assistant including Cursor, VS Code with Copilot, and JetBrains IDEs.
Do I need specific dependencies for Foundry-Agent-Sync?
Check the install command and Works With section. Most code skills only require the AI assistant and your codebase.
How do I install Foundry-Agent-Sync?
Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/foundry-agent-sync/SKILL.md, ready to use.
Can I customize this skill for my team?
Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.
⚠️ Common Mistakes to Avoid
Using generated code without understanding
Understand what generated code does before shipping it to production.
Skipping validation
Always test AI-generated code changes, even for simple refactors.
Missing dependency updates
Check if the skill requires updated dependencies or new packages.