Перейти к содержанию
Skillpedia
Деплой и облако (DevOps)48k · #4827

hosted-agents-v2-py

Что он делает

Этот инструмент позволяет создавать собственных «агентов», которые работают в контейнерах в облаке Azure. Думайте о них как о программах, которые вы настраиваете для выполнения конкретных задач.

Когда использовать

  • ✓Когда вам нужна программа, которая работает в изолированной среде (контейнере).
  • ✓Когда вы настраиваете агента для взаимодействия с другими сервисами Azure.
  • ✓Когда вы создаете ИИ-ассистента, который может выполнять код или использовать определенные инструменты.

Ссылка на скилл

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/hosted-agents-v2-py/SKILL.md

Скопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.

Как использовать

Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.

Готовое сообщение для вставки

Используй этот скилл, чтобы помочь мне: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/hosted-agents-v2-py/SKILL.md Прочитай файл SKILL.md по этой ссылке и следуй его инструкциям в моей задаче.
Хотите, чтобы ваш ИИ сам находил такие скиллы?Установите бесплатный MCP Skillpedia: одна строка, и перед каждой задачей он ищет среди 15 000+ скиллов.Установить за 1 минуту →

Пример запроса к вашему ИИ

“Создай агента с определенным образом контейнера, 2 ядрами CPU и 4 ГБ памяти.”

5 новых скиллов в неделю. 1 минута чтения.

Как это работает

Вы используете специальный код (SDK), чтобы описать настройки агента, его потребности в ресурсах (CPU, память) и инструменты, которые он может использовать. Дальше Azure сам запускает этого агента.

Технический текст (оригинальный SKILL.md)

Оригинальный текст автора на английском, прямо с GitHub.

Compatibility and maintenance

Primary editorial path for this compatibility group. The instruction-only procedure remains local; no executable support files are bundled so existing installations continue to work offline. This is one shared procedure, not an additional capability. 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:

  1. Container Image - Build and push to Azure Container Registry (ACR)
  2. ACR Pull Permissions - Grant the project identity the registry role supported by its permission mode; current hosted-agent guidance uses Container Registry Repository Reader
  3. Capability Host - Confirm current project/region hosted-agent availability and the application's network policy; do not enable public hosting automatically
  4. 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

The protocol_versions parameter specifies which protocols your agent supports:

from azure.ai.projects.models import ProtocolVersionRecord, AgentEndpointProtocol

# RESPONSES protocol - standard agent responses

…
Частые вопросы

Что такое «hosted agent»?

Это программа, которую вы создаете и которую Azure запускает за вас в среде контейнеров, готовую выполнять задачи.

Нужно ли уметь программировать, чтобы пользоваться этим?

Да, для настройки агента нужно написать немного кода на Python, но инструмент упрощает запуск агента в Azure.

Можно ли заставить агента использовать инструменты вроде интерпретатора кода?

Да, вы можете настроить агента на использование таких инструментов, как интерпретатор кода, или других инструментов, специфичных для Azure.

Подробности

Оригинальное описание автора

Build hosted agents using Azure AI Projects SDK with HostedAgentDefinition. Use when creating container-based agents in Azure AI Foundry.

repo: sickn33/agentic-awesome-skills

Популярность

Звёзды на GitHub
48k
Место в рейтинге
#4827
Лицензия
MIT
Обновлён
15.10.2026

Полезен ли этот скилл?

0

Войдите , чтобы голосовать.

Комментарии

  • …

Другие скиллы из этого репозитория

Похожие скиллы