forked from chenchen/pingtai_agent
1.3 KiB
1.3 KiB
Agent 模板
基于 Pydantic AI 的轻量级 Agent 模板。
快速开始
1. 复制模板
cp -r _template your_agent_name
cd your_agent_name
# 全局替换 "your_agent" 为你的 agent 名称
2. 修改核心文件
src/server/mcp_server.py- 添加你的 MCP 工具src/server/api_server.py- 添加你的 API 端点(可选)
3. 本地测试
python run_api_server.py
4. 构建镜像
docker build -t your-agent:latest .
5. 注册到 Agent Manager
在 k8s_manager.py 中添加:
# TEMPLATE_PORTS
"your_agent": 8000,
# image_map
"your_agent": "agnettaiji.azurecr.io/ai-agents/your-agent:latest",
在 app.py 的 valid_templates 中添加 "your_agent"。
项目结构
your_agent/
├── Dockerfile
├── requirements.txt
├── run_api_server.py # 启动脚本
└── src/
├── __init__.py
└── server/
├── __init__.py
├── api_server.py # FastAPI + MCP HTTP
└── mcp_server.py # MCP 工具定义
环境变量
| 变量 | 必需 | 说明 |
|---|---|---|
| LITELLM_GATEWAY_URL | 是 | LiteLLM Gateway URL |
| LITELLM_MODEL | 否 | 模型名称,默认 taiji/gpt-4o-mini |
| API_PORT | 否 | 端口,默认 8000 |