agents-v2-py
できること
このツールを使うと、コンテナ内で動作するAIの「エージェント」を、特定のPythonコードを使って作成できます。エージェントの内部動作をより細かく制御したい方に向いています。
使う場面
- ✓エージェントのコードがコンテナ内で準備できているとき。
- ✓エージェントに使うCPUやメモリなどのリソースを設定したいとき。
- ✓AIエージェントの異なるバージョンを管理したいとき。
スキルのリンク
https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/agents-v2-py/SKILL.mdコピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。
使い方
いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。
貼り付け用メッセージ
Claude Code、Codex、Cursorの場合:プロジェクトのフォルダで実行するとスキルがインストールされます。
SKILL.mdをダウンロードして、エージェントのスキル用フォルダに入れてください。
AIへの頼み方の例
“コンテナイメージを使って、ホスティングされたAIエージェントを作成するにはどうすればいいですか?”
毎週5つの新しいスキル。1分で読めます。
仕組み
'azure-ai-projects'ライブラリを使ったPythonコードでエージェントを定義します。コンテナイメージ、リソース(CPU/メモリ)、エージェントの実行に必要な環境変数を指定します。
技術的な内容(元のSKILL.md)
作者による元のテキスト(英語)をGitHubからそのまま表示しています。
Compatibility and maintenance
Compatibility alias of hosted-agents-v2-py; use that ID for new references when no existing contract requires this one. The instruction-only procedure remains local; no executable support files are bundled so existing installations
continue to work offline. This compatibility guide documents the hosted-agent procedure, not an additional capability; older copies may use retired preview names.
Preserve the callable ID when an existing manifest or client configuration uses it.
Modified in AAS on 2026-09-05; original metadata and license notices are retained.
Azure AI Hosted Agents (Python)
Build container-based hosted agents using HostedAgentDefinition from the Azure AI Projects SDK.
Installation
pip install 'azure-ai-projects==2.3.0' azure-identity
These are SDK 2.3.0 instruction fragments aligned with the current Microsoft hosted-agent guide. Validate the installed schema and service support before provisioning; documentation inspection is not a cloud integration test.
Environment Variables
export AZURE_AI_PROJECT_ENDPOINT="https://<resource>.services.ai.azure.com/api/projects/<project>"
Prerequisites
Before creating hosted agents:
- Container Image - Build and push to Azure Container Registry (ACR)
- ACR Pull Permissions - Grant the project identity the registry role supported by its permission mode; current hosted-agent guidance uses Container Registry Repository Reader
- Capability Host - Confirm current project/region hosted-agent availability and the application's network policy; do not enable public hosting automatically
- SDK Version - Ensure
azure-ai-projects==2.3.0
Authentication
Use the approved Azure credential flow for the intended tenant/subscription; this sketch uses DefaultAzureCredential:
from azure.identity import DefaultAzureCredential
from azure.ai.projects import AIProjectClient
import os
credential = DefaultAzureCredential()
client = AIProjectClient(
endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
credential=credential
)
Core Workflow
1. Imports
import os
from azure.identity import DefaultAzureCredential
from azure.ai.projects import AIProjectClient
from azure.ai.projects.models import (
HostedAgentDefinition,
ContainerConfiguration,
ProtocolVersionRecord,
AgentEndpointProtocol,
)
2. Create Hosted Agent
client = AIProjectClient(
endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
credential=DefaultAzureCredential()
)
agent = client.agents.create_version(
agent_name="my-hosted-agent",
definition=HostedAgentDefinition(
protocol_versions=[
ProtocolVersionRecord(protocol=AgentEndpointProtocol.RESPONSES, version="2.0.0")
],
cpu="1",
memory="2Gi",
container_configuration=ContainerConfiguration(image=os.environ["REVIEWED_CONTAINER_IMAGE"]),
environment_variables={
"AZURE_AI_PROJECT_ENDPOINT": os.environ["AZURE_AI_PROJECT_ENDPOINT"],
"MODEL_NAME": os.environ["MODEL_DEPLOYMENT_NAME"]
}
)
)
print(f"Created agent: {agent.name} (version: {agent.version})")
3. List Agent Versions
versions = client.agents.list_versions(agent_name="my-hosted-agent")
for version in versions:
print(f"Version: {version.version}") # Inspect supported status fields via get_version
Inspect the exact returned model for supported fields; a created version is not proof a running container is healthy. Close synchronous client/credential resources through their supported context managers or close() methods.
4. Delete Agent Version
client.agents.delete_version(
agent_name="my-hosted-agent",
agent_version=agent.version
)
HostedAgentDefinition Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
protocol_versions |
list[ProtocolVersionRecord] |
Yes | Protocol versions the agent supports |
container_configuration |
ContainerConfiguration |
Yes for an image deployment | Reviewed registry image reference |
cpu |
str |
No | CPU allocation (e.g., "1", "2") |
memory |
str |
No | Memory allocation (e.g., "2Gi", "4Gi") |
environment_variables |
dict[str, str] |
No | Environment variables for the container |
Protocol Versions
…
よくある質問
「ホステッドエージェント」とは何ですか?
クラウド上で、指示を受け取る準備が整った隔離された環境(コンテナ)の中で動作するAIプログラムのことです。
このツールを使うにはPythonの知識が必要ですか?
はい。エージェントを設定するために、Pythonコードを書いて実行する作業が必要になります。
「コンテナ」とは何ですか?
プログラムの実行に必要なものすべてをまとめたパッケージのようなものだと考えてください。どこでも同じように動作するようになっています。
詳細
作者による元の説明
Build container-based Foundry Agents with Azure AI Projects SDK (HostedAgentDefinition). Use when creating hosted agents with custom container images in Azure AI Foundry.
人気
- GitHubのスター
- 48k
- ランキング
- #3691
- ライセンス
- MIT
- 更新日
- 2026/10/15
コメント
- …
このリポジトリの他のスキル
00-andruia-consultant
48kエージェントがAIプロジェクトの立ち上げや改善を支援します。コードを分析し、ツールを提案し、スペイン語で行動計画を作成します。
007
48kエージェントがセキュリティ監査と脅威モデリングを行えるようにします。攻撃や脆弱性からプロジェクトを守るのに役立ちます。
10-andruia-skill-smith
48kエージェントがAIツールの作成や改善を支援します。ツールの動作を定義し、ドキュメントを書き、構造を検証します。
20-andruia-niche-intelligence
48kエージェントが特定の業界に関する要約を作成できるようにします。信頼できる情報源を使って、プロジェクトの背景、ルール、利用パターン、リスクを把握するのに役立ちます。
似ているスキル
add-model-provider
394k安全なセットアップコマンドで新しいAIモデルプロバイダーをOpenClawに接続し、APIキーを平文で残さず、ライブテストを行うようエージェントを支援します。
acp-router
394kClaude CodeやCursorなどのコーディングアシスタントに、OpenClaw経由でタスクを渡し、その作業がそのツール内で行われるようエージェントを支援します。
browser-automation
394kログイン、タブ、応答しなくなったページからの復旧を含め、Webページを段階的に操作するようエージェントに教えます。