All skills
microsoft avatar

/microsoft-foundry

@04110d9
by microsoftmicrosoft/skills3.1k stars
351

Build, deploy, evaluate, optimize, fine-tune, and manage Microsoft Foundry agents, models, and resources end to end. USE FOR: foundry, azd ai agent, azd provision/deploy, hosted agent scaffold/develop/run/deploy/troubleshoot, prompt agent create, create agent, update agent, add tool to agent, invoke agent, agent.yaml, agent insights, pull agent insights, evaluate agent, batch eval, continuous eval, continuous monitoring, agent CI/CD, optimize prompt, improve prompt, prompt optimizer, optimize agent instructions, Agent Optimizer scaffold, dataset curation from traces, deploy model, model fine-tuning (SFT/DPO/RFT), Foundry project, RBAC, role assignment, permissions, quota, capacity, region, deployment failure, AI Services, create Foundry resource, knowledge index, customize deployment, onboard, availability, training-data, grader, distillation, large file upload. DO NOT USE FOR: Azure Functions, App Service, general Azure deploy (use azure-deploy), general Azure prep (use azure-prepare).

Use this Skill: https://skilld.dev/gh/microsoft/skills/microsoft-foundry

This session only. Nothing lands on disk.

foundry-agentagent-optimizerreferencespython-patterns.md

≈1k tokens on demand. Your agent reads this file only when SKILL.md points to it.

Python Agent Optimizer in Foundry Patterns

Use the Azure SDK optimization package and a local baseline folder. The baseline is file-based; call load_config() without code-level fallback parameters.

Install and Import

Add azure-ai-agentserver-optimization to requirements.txt or the project dependency file:

azure-ai-agentserver-optimization

Import from the SDK namespace:

from azure.ai.agentserver.optimization import load_config

Baseline Folder

Create .agent_configs/baseline/ in the agent's service source directory (beside the entry point):

<agent-root>/
  main.py
  .agent_configs/
    baseline/
      metadata.yaml
      instructions.md
      tools.json
      skills/<skill-name>/SKILL.md

Example metadata.yaml:

model: <existing-chat-model-deployment-name>
temperature: 0.7
instruction_file: instructions.md
skill_dir: skills
tool_file: tools.json

instructions.md contains the selected baseline system/developer instructions. Include only skill folders relevant to the optimization goal.

Choose a model value that already exists as a model deployment in the target Foundry project. Do not assume gpt-4o is available.

Tools File

Use OpenAI function-calling tool objects under top-level tools. Currently, only function tool definition optimization is supported:

{
  "tools": [
    {
      "type": "function",
      "function": {
        "name": "lookup_policy",
        "description": "Look up the company travel policy.",
        "parameters": {
          "type": "object",
          "properties": {
            "dept": {
              "type": "string",
              "description": "Department name"
            }
          }
        }
      }
    }
  ]
}

Runtime Wiring

Call load_config() with no defaults:

config = load_config()
instructions = config.compose_instructions()
model = config.model

For Microsoft Agent Framework:

client = FoundryChatClient(
    project_endpoint=project_endpoint,
    model=config.model,
    credential=credential,
)

agent = Agent(
    client=client,
    instructions=config.compose_instructions(),
    tools=tools,
)

Patch optimized function tool definitions through the public helper. It updates matching function docs, descriptions, and parameter descriptions:

config.apply_tool_descriptions(tools)

Load skills on demand when the runtime has a safe skill/tool mechanism:

from pathlib import Path
from azure.ai.agentserver.optimization import load_skills_from_dir

skills = load_skills_from_dir(Path(config.skills_dir)) if config.skills_dir else []

Target Selection

Use evaluator and dataset goals to decide what belongs in the baseline:

Signal Prefer
relevance, task_adherence primary instructions and model
intent_resolution router/orchestrator instructions
builtin.tool_call_accuracy tool-calling instructions and OpenAI function tool definitions
safety/groundedness safety, retrieval, citation, or answer-synthesis instructions

For multi-agent apps, scaffold the target role's instructions and related skills/tools. Do not merge unrelated role prompts into one baseline.

Runtime Config

The SDK reads optimization context from supported runtime sources. Keep .agent_configs/baseline/ present so default load_config() startup has a local baseline. Use load_config(config_dir="my_configs") only for non-default local config directories, and load_config(required=False) only when the app can intentionally run without optimization config.

Verification Checklist

  • Dependency file includes azure-ai-agentserver-optimization
  • from azure.ai.agentserver.optimization import load_config succeeds
  • .agent_configs/baseline/metadata.yaml exists and points to existing files
  • load_config() is called without defaults unless using an intentional config_dir or required=False
  • Changed Python files compile and preserve the hosting adapter/protocol
  • User is asked to review before deployment

Source: SKILL.md on GitHub

2 warnings3d4 checks · Risk SAFE
  • Gen Agent Trust Hub3d

    This skill provides a comprehensive environment for managing the end-to-end lifecycle of AI agents, models, and infrastructure on Microsoft Foundry. It includes sub-skills for deployment, evaluation, fine-tuning, and troubleshooting. The skill utilizes dynamic code execution and shell command wrappers, which are used within the context of local development and cloud orchestration. All external resources and dependencies originate from trusted organizations and well-known services.

  • Socket3d

    2 alerts: gptSecurity, gptAnomaly

  • Snyk3d

    Risk: LOW · No issues

  • Runlayer7mo

    36/36 files flagged

Signed by skilld at 04110d9. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 19 hours ago.

Activeupdated last week
metadata
{
  "author": "Microsoft",
  "version": "1.2.26"
}

README badge

README badge for microsoft/skills/microsoft-foundry