Token导航 LogoToken导航TokenDH.com
Foundry Agents MCP Scenarios logo
AI代理stdio官方级别未说明来源级核验

Foundry Agents MCP Scenarios

MCP Server

基于Azure AI Foundry CB Agent框架构建的示例代理,用于快速部署和运行AI代理服务。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
AI代理Python云部署

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

djetchev

提供方

djetchev

最后核验

2026/5/17 20:20

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python -m venv .venv

详细介绍

铸造代理mcp场景

基于Azure AI Foundry CB Agent框架构建的示例代理。

存储库结构

examples/
  foundry-cbagent-hello/               # Minimal "Hello, World!" agent
    main.py                            # Agent implementation (HelloWorldAgent)
    requirements.txt                   # Python dependencies
    Dockerfile                         # Container image for deployment
    azure.yaml                         # azd deployment manifest
    infra/                             # Bicep infrastructure-as-code
      main.bicep                       #   Orchestrator (RG + modules)
      main.parameters.json             #   Maps azd env vars → Bicep params
      modules/
        hub-dependencies.bicep         #   Storage Account + Key Vault
        hub.bicep                      #   AI Foundry Hub + AI Services connection
        project.bicep                  #   AI Foundry Project
        container-registry.bicep       #   Azure Container Registry
        container-app.bicep            #   Container App Environment + Container App

先决条件

快速启动--在本地运行

cd examples/foundry-cbagent-hello
python -m venv .venv
source .venv/bin/activate   # On Windows: .venv\Scripts\activate
pip install -r requirements.txt
python main.py

代理服务器在端口上启动 8088. 用以下方法进行测试:

curl -X POST http://localhost:8088/runs \
  -H "Content-Type: application/json" \
  -d '{"input": "hello"}'

预期响应:

{
  "id": "hello-world",
  "output": [
    {
      "status": "completed",
      "content": [{ "text": "Hello, World!", "type": "output_text" }],
      "type": "message",
      "role": "assistant"
    }
  ],
  "object": "response"
}

部署到Azure

建筑

azd provision 创建a 新资源组 使用以下资源。 您现有的AI服务资源仍保留在其原始资源组中 通过集线器连接引用:

rg-  (new, managed by azd)
├── Storage Account              ← required by Hub
├── Key Vault                    ← required by Hub
├── AI Foundry Hub               ← connects to your existing AI Services
│   └── AI Services Connection   (AAD auth, cross-RG reference)
├── AI Foundry Project           ← child of Hub
├── Container Registry (ACR)     ← stores agent Docker images
├── User-Assigned Managed Identity ← AcrPull on the registry
├── Container App Environment    ← hosting environment
└── Container App                ← runs the agent container (port 8088)

部署步骤

三个步骤:提供基础设施,构建映像,然后 更新容器应用程序。整个流程大约需要5分钟。

1.登录并配置环境

cd examples/foundry-cbagent-hello

azd auth login
azd init -e             # e.g. cbagent-hello-dev

azd env set AZURE_SUBSCRIPTION_ID ""
azd env set AZURE_LOCATION        "westus2"

# Resource ID of your existing AI Services account
azd env set AI_SERVICES_RESOURCE_ID \
  "/subscriptions//resourceGroups//providers/Microsoft.CognitiveServices/accounts/"

# Endpoint of the same AI Services account
azd env set AI_SERVICES_ENDPOINT "https://.cognitiveservices.azure.com/"

2.提供基础设施(~3-4分钟)

azd provision

这将创建资源组、集线器、项目、ACR、容器应用程序 环境、托管身份、角色分配和容器应用程序 单ARM部署。

3.构建并推送代理映像(约30秒)

使用ACR Build在云中构建Docker镜像(不需要本地Docker):

az acr build \
  --registry  \
  --image agent:latest \
  ./examples/foundry-cbagent-hello
ACR名称打印为 azd provision 输出 (AZURE_CONTAINER_REGISTRY_NAME).您还可以通过以下方式检索它 azd env get-value AZURE_CONTAINER_REGISTRY_NAME.

推送图像后,更新容器应用程序:

azd deploy

验证

FQDN=$(azd env get-value AGENT_FQDN)

# Health check
curl https://$FQDN/liveness        # → HTTP 200

# Run the agent
curl -X POST https://$FQDN/runs \
  -H "Content-Type: application/json" \
  -d '{"input": "hello"}'

更新代理

代码更改后,重建并重新部署:

az acr build --registry  --image agent:latest ./examples/foundry-cbagent-hello
azd deploy

拆除

要删除所有已配置的资源,请执行以下操作:

azd down

这将删除 rg- 资源组及其内部的所有内容。 您的原始AI服务资源是 影响。

目录标签

目录标签

AI代理Python云部署本地部署AzureAI开发框架

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

session

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiosession部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP