Back to list
pascalvanderheiden

ms-foundry

by pascalvanderheiden

A list of re-useable agent skills I created for my own purpose.

0🍴 0📅 Jan 20, 2026

SKILL.md


name: ms-foundry description: Build GenAI applications with Microsoft Foundry (Azure AI Foundry). Use when creating chat completions, agents, file search, code interpreter, Bing grounding, or AI model deployments using the Foundry SDK (azure-ai-projects). Covers AIProjectClient, agent service, threads, runs, messages, tools, and OpenAI-compatible endpoints.

Microsoft Foundry Skill

Build production GenAI applications using Microsoft Foundry SDK (Python).

Prerequisites

  • Python 3.10+
  • Azure account with Foundry resource
  • Azure CLI authenticated (az login)
  • Role: Azure AI User or Contributor on Foundry project

Installation

pip install azure-ai-projects azure-identity openai

Environment Variables

# Foundry project endpoint (from portal Overview > Libraries > Foundry)
export PROJECT_ENDPOINT="https://<resource-name>.services.ai.azure.com/api/projects/<project-name>"

# Model deployment name (from Models + Endpoints in portal)
export MODEL_DEPLOYMENT_NAME="gpt-4o"

Quick Start: Chat Completion

from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential

project = AIProjectClient(
    endpoint="https://<resource-name>.ai.azure.com/api/projects/<project-name>",
    credential=DefaultAzureCredential(),
)

# Get OpenAI client from project
models = project.get_openai_client(api_version="2024-10-21")

response = models.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "system", "content": "You are a helpful assistant"},
        {"role": "user", "content": "Explain quantum computing in simple terms"},
    ],
)

print(response.choices[0].message.content)

Quick Start: Create Agent

from azure.ai.projects import AIProjectClient
from azure.identity import DefaultAzureCredential
from azure.ai.agents.models import ListSortOrder

project = AIProjectClient(
    endpoint="https://<resource-name>.ai.azure.com/api/projects/<project-name>",
    credential=DefaultAzureCredential(),
)

# Create agent
agent = project.agents.create_agent(
    model="gpt-4o",
    name="my-agent",
    instructions="You are a helpful writing assistant"
)

# Create thread and message
thread = project.agents.threads.create()
project.agents.messages.create(
    thread_id=thread.id,
    role="user",
    content="Write me a poem about flowers"
)

# Run agent
run = project.agents.runs.create_and_process(
    thread_id=thread.id,
    agent_id=agent.id
)

# Get response
messages = project.agents.messages.list(
    thread_id=thread.id,
    order=ListSortOrder.ASCENDING
)
for message in messages:
    if message.run_id == run.id and message.text_messages:
        print(f"{message.role}: {message.text_messages[-1].text.value}")

# Cleanup
project.agents.delete_agent(agent.id)

Core Concepts

AIProjectClient

Central client for all Foundry operations:

MethodPurpose
get_openai_client()OpenAI-compatible chat completions
agents.create_agent()Create managed agent
agents.threads.create()Create conversation thread
agents.messages.create()Add message to thread
agents.runs.create_and_process()Execute agent on thread

Agent Tools

Extend agents with built-in tools. See references/agent-tools.md for details:

ToolUse Case
Code InterpreterExecute Python code, generate charts
File SearchRAG over uploaded documents
Bing GroundingReal-time web search
Azure AI SearchEnterprise knowledge bases
Function CallingCustom business logic

Threads, Runs, Messages

Agent conversation model:

Thread (conversation container)
├── Message (user input)
├── Run (agent execution)
│   └── Run Steps (tool calls, responses)
└── Message (agent response)

Example Scripts

Execute without loading into context when possible:

ScriptPurpose
scripts/chat_completion.pyBasic chat with model
scripts/create_agent.pyCreate and run agent
scripts/agent_code_interpreter.pyAgent with code execution
scripts/agent_file_search.pyAgent with document RAG
scripts/agent_bing_grounding.pyAgent with web search

Code Generation Guidelines

  1. Use AIProjectClient - Central entry point for all operations
  2. DefaultAzureCredential - Works locally (CLI) and in production (managed identity)
  3. Always cleanup - Delete agents after use to avoid resource leaks
  4. Check run status - Handle run.status == "failed" cases
  5. Use ListSortOrder - Get messages in correct order
  6. Project endpoint format - https://<resource>.services.ai.azure.com/api/projects/<project>

Project Structure

my-foundry-app/
├── src/
│   ├── __init__.py
│   ├── main.py           # Entry point
│   ├── client.py         # AIProjectClient setup
│   └── agents/
│       ├── __init__.py
│       └── assistant.py  # Agent definitions
├── requirements.txt
├── .env.example
└── azure.yaml            # Azure deployment config

Reference Documentation

Score

Total Score

60/100

Based on repository quality metrics

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

+10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

Reviews

💬

Reviews coming soon