foundry-agent-sync

tarafından github

Azure AI Foundry içinde REST API aracılığıyla, yerel bir JSON manifestosundan doğrudan prompt tabanlı AI ajanları oluşturun ve senkronize edin. Yalnızca iskele becerilerinden farklı olarak…

npx skills add https://github.com/github/awesome-copilot --skill foundry-agent-sync

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:

ValueHow to get it
Foundry project endpointAzure Portal → AI Foundry project → Overview → Endpoint, or az resource show
Subscription IDaz account show --query id -o tsv
Model deployment nameThe 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

FieldRequiredDescription
useCaseIdYesKebab-case identifier; used to build the agent name ({prefix}-{useCaseId})
descriptionYesHuman-readable description stored as agent metadata
baseInstructionYesSystem 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 -AutoSize

Bash (Bicep deployment script / CI)

For automated deployment via Microsoft.Resources/deploymentScripts, use a bash script that:

  1. Authenticates with a managed identity: az login --identity --username "$CLIENT_ID"
  2. Acquires a Foundry token: az account get-access-token --resource https://ai.azure.com/
  3. Iterates definitions from the FOUNDRY_AGENT_DEFINITIONS environment variable (JSON string)
  4. POSTs each agent to {endpoint}/agents/{name}?api-version=2025-11-15-preview

Bicep Integration (optional)

To run the sync automatically during infrastructure deployment:

  1. Load the manifest at compile time:

    var agentDefinitions = loadJsonContent('foundry-agents.json')
    
  2. Create a User-Assigned Managed Identity with the Azure AI User role on the Foundry project.

  3. Create a Microsoft.Resources/deploymentScripts resource (kind AzureCLI) that:

    • Uses the managed identity
    • Loads the bash sync script via loadTextContent
    • Passes the project endpoint, definitions, and model as environment variables

Gate behind a deployFoundryAgents parameter so teams can opt in/out.

Workflow

Step 1 — Locate or scaffold the manifest

Search the repo for foundry-agents.json. If it doesn't exist, ask the user what agents they need and create the manifest.

Step 2 — Locate or scaffold the sync script

Search for sync-foundry-agents.ps1 or foundry-agent-sync.sh. If missing, create the PowerShell script using the template above, adapting:

  • $AgentNamePrefix to match the project name
  • $ModelName to the user's deployed model
  • $ManifestPath to the actual manifest location

Step 3 — Collect parameters

Ask the user for:

  • Foundry project endpoint
  • Subscription ID
  • Model deployment name (default: gpt-5-4)
  • Agent name prefix (default: repo name in kebab-case)

Step 4 — Run the sync

Execute the PowerShell script with the collected parameters:

.\infra\scripts\sync-foundry-agents.ps1 `
  -SubscriptionId '<sub-id>' `
  -ProjectEndpoint '<endpoint>' `
  -ModelName '<model>' `
  -AgentNamePrefix '<prefix>'

Step 5 — Verify

Confirm synced agents by listing them:

$token = az account get-access-token --resource https://ai.azure.com/ --query accessToken -o tsv
$endpoint = '<project-endpoint>'
Invoke-RestMethod -Uri "$endpoint/agents?api-version=2025-11-15-preview" `
  -Headers @{ Authorization = "Bearer $token" }

REST API Reference

OperationMethodURL
Create/update agentPOST{projectEndpoint}/agents/{agentName}?api-version=2025-11-15-preview
List agentsGET{projectEndpoint}/agents?api-version=2025-11-15-preview
Get agentGET{projectEndpoint}/agents/{agentName}?api-version=2025-11-15-preview
Delete agentDELETE{projectEndpoint}/agents/{agentName}?api-version=2025-11-15-preview

Create/Update Payload

{
  "definition": {
    "kind": "prompt",
    "model": "<deployed-model-name>",
    "instructions": "<system prompt>"
  },
  "description": "<agent description>",
  "metadata": {
    "useCaseId": "<use-case-id>",
    "managedBy": "foundry-agent-sync"
  }
}

Troubleshooting

SymptomCauseFix
401 UnauthorizedToken expired or wrong audienceRe-run az account get-access-token --resource https://ai.azure.com/
403 ForbiddenMissing Azure AI User roleAssign the role on the Foundry project scope
404 Not FoundWrong project endpointVerify endpoint includes /api/projects/{projectName}
Model not foundModel not deployed in projectDeploy the model in AI Foundry portal first
Empty definitionsManifest path wrongCheck -ManifestPath points to the JSON file

github tarafından daha fazla skill

console-rendering
github
Go'da struct etiketi tabanlı konsol renderlama sistemini kullanma talimatları
official
acquire-codebase-knowledge
github
Bu beceriyi, kullanıcı açıkça mevcut bir kod tabanını haritalamayı, belgelemeyi veya bu kod tabanına dahil olmayı istediğinde kullanın. "Bu kod tabanını haritala", "belgele…" gibi ifadeler için tetikleyin.
official
acreadiness-assess
github
Run the AgentRC readiness assessment on the current repository and produce a static HTML dashboard at reports/index.html. Wraps `npx github:microsoft/agentrc…
official
acreadiness-generate-instructions
github
AgentRC talimatları komutu aracılığıyla özelleştirilmiş AI ajan talimat dosyaları oluşturur. .github/copilot-instructions.md dosyasını üretir (varsayılan, VS'de Copilot için önerilir…
official
acreadiness-policy
github
Kullanıcının bir AgentRC politikası seçmesine, yazmasına veya uygulamasına yardımcı olun. Politikalar, ilgisiz kontrolleri devre dışı bırakarak, etki/seviyeyi geçersiz kılarak, ayarlayarak…
official
add-educational-comments
github
We need to translate the given English text into Turkish, preserving the name "add-educational-comments" if it appears. The text is a description of an agent skill. We must not add any extra commentary, labels, or formatting. The translation should be accurate and natural in Turkish. The text: "Add educational comments to code files to transform them into effective learning resources. Adapts explanation depth and tone to three configurable knowledge levels: beginner, intermediate, and advanced Automatically requests a file if none is provided, with numbered list matching for quick selection Expands files by up to 125% using educational comments only (hard limit: 400 new lines; 300 for files over 1,000 lines) Preserves file encoding, indentation style, syntax correctness, and..." It seems cut off at the end. The original might have more, but we only have this. We'll translate what's given. Note: The name "add-educational-comments" does not appear in the text, so we don't include it. Translation: "Kod dosyalarına
official
adobe-illustrator-scripting
github
ExtendScript (JavaScript/JSX) kullanarak Adobe Illustrator otomasyon betiklerini yazın, hata ayıklayın ve optimize edin. Oluştururken veya değiştirirken kullanın…
official
agent-governance
github
Yapay zeka aracı erişimi ve davranışını kontrol etmek için bildirimsel politikalar, niyet sınıflandırması ve denetim izleri. Birleştirilebilir yönetişim politikaları, izin verilen/engellenen araçları, içerik filtrelerini, hız sınırlarını ve onay gereksinimlerini tanımlar — kod değil yapılandırma olarak saklanır. Anlamsal niyet sınıflandırması, araç yürütülmeden önce desen tabanlı sinyaller kullanarak tehlikeli istemleri (veri sızdırma, ayrıcalık yükseltme, istem enjeksiyonu) tespit eder. Araç düzeyinde yönetişim dekoratörü, politikaları işlevde u
official