← スキル一覧に戻る

ms-foundry
by pascalvanderheiden
A list of re-useable agent skills I created for my own purpose.
⭐ 0🍴 0📅 2026年1月20日
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 UserorContributoron 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:
| Method | Purpose |
|---|---|
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:
| Tool | Use Case |
|---|---|
| Code Interpreter | Execute Python code, generate charts |
| File Search | RAG over uploaded documents |
| Bing Grounding | Real-time web search |
| Azure AI Search | Enterprise knowledge bases |
| Function Calling | Custom 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:
| Script | Purpose |
|---|---|
scripts/chat_completion.py | Basic chat with model |
scripts/create_agent.py | Create and run agent |
scripts/agent_code_interpreter.py | Agent with code execution |
scripts/agent_file_search.py | Agent with document RAG |
scripts/agent_bing_grounding.py | Agent with web search |
Code Generation Guidelines
- Use AIProjectClient - Central entry point for all operations
- DefaultAzureCredential - Works locally (CLI) and in production (managed identity)
- Always cleanup - Delete agents after use to avoid resource leaks
- Check run status - Handle
run.status == "failed"cases - Use ListSortOrder - Get messages in correct order
- 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
- Agent Tools - Code Interpreter, File Search, Bing, Functions
- SDK Reference - AIProjectClient API details
- Troubleshooting - Common issues and solutions
スコア
総合スコア
60/100
リポジトリの品質指標に基づく評価
✓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
レビュー
💬
レビュー機能は近日公開予定です