Skip to content

Commit ce66b4d

Browse files
committed
feat: support inspection assistant
1 parent bd28a01 commit ce66b4d

26 files changed

+1509
-4
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# AgentKit configuration
2+
agentkit.yaml
3+
agentkit*.yaml
4+
5+
# Python cache
6+
__pycache__/
7+
*.py[cod]
8+
*$py.class
9+
10+
# Virtual environments
11+
.venv/
12+
venv/
13+
ENV/
14+
env/
15+
16+
# IDE
17+
.vscode/
18+
.idea/
19+
.windsurf/
20+
21+
# Git
22+
.git/
23+
.gitignore
24+
25+
# Docker
26+
Dockerfile*
27+
.dockerignore
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
veadk-python==0.2.27
22
agentkit-sdk-python==0.1.15
33
tos>=2.8.7
4-
google-adk==1.18.0
4+
google-adk==1.18.0
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
veadk-python[extensions]==0.2.29
12
veadk-python==0.2.29
23
agentkit-sdk-python==0.1.15
34
google-adk==1.18.0
45
urllib3<2.0.0
5-
volcengine-python-sdk>=4.0.31
6+
volcengine-python-sdk>=4.0.31

02-use-cases/customer_support/__init__.py

Whitespace-only changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
veadk-python==0.2.27
22
google-adk==1.18.0
33
agentkit-sdk-python==0.1.15
4-
mem0ai==0.1.118
4+
mem0ai==0.1.118
Lines changed: 187 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# 智能门店巡检系统
2+
3+
基于AgentKit的智能门店巡检助手,专门用于门店质量检测:招牌LED发光状态检测、洗手池整洁检测、货架陈列检测、工服穿着检测。系统能够自动识别异常情况并触发告警,实现门店运营的标准化管理。
4+
5+
## 项目概述
6+
7+
本项目构建了一个AI驱动的门店质量检测解决方案,通过计算机视觉和人工智能技术,实现对门店各项设施状态的自动化巡检。系统能够智能识别招牌LED发光状态、洗手池整洁度、货架陈列规范等关键指标,并在发现异常时及时上报告警,帮助门店管理者快速响应和处理问题。
8+
9+
## 核心功能
10+
11+
### 🔍 智能图像处理与分析
12+
13+
- **精准目标检测**:自动识别门店招牌区域,智能框选完整招牌范围
14+
- **智能图像剪裁**:自动提取招牌主体,去除无关背景干扰
15+
- **文字智能识别**:准确检测招牌中的中英文文字
16+
- **多模态图像理解**:通过视觉大模型深度理解图像内容,识别LED发光异常、货架/洗手池整洁度等问题
17+
18+
### 🚨 异常检测与智能告警
19+
20+
- **自动告警上报**:发现异常时自动触发告警机制,可无缝接入企业内部告警系统
21+
- **多渠道消息推送**:异常告警自动触发飞书机器人推送,确保信息及时传达
22+
23+
### 🤖 多智能体协同架构
24+
25+
- **Multi-Agent架构**:采用多智能体协同工作模式,自主判断最优任务执行流程
26+
- **专业分工协作**:图像处理、异常分析、告警通知各司其职,提升检测效率
27+
- **端到端自动化**:从图像采集到告警通知的全流程自动化处理
28+
29+
### 🛠️ MCP工具高效集成
30+
31+
- **外部系统无缝对接**:通过AgentKit Gateway,便捷地将外部工具集成为MCP Tool,扩展Agent能力边界
32+
- **身份凭据安全托管**:通过Identity服务安全托管出站凭据,保护敏感密钥信息
33+
34+
## 技术架构
35+
36+
### 核心智能体组件
37+
38+
#### 1. 根智能体 (Root Agent)
39+
40+
- **核心职责**:统筹协调整个质检流程,智能判断最优任务执行路径
41+
- **使用模型**:deepseek-v3-1-terminus
42+
43+
#### 2. 图像处理智能体 (Image Process Agent)
44+
45+
- **核心职责**:负责图像预处理、目标检测和智能剪裁
46+
- **使用模型**:doubao-seed-1-6-vision-250815 / deepseek-v3-1-terminus
47+
- **集成工具**
48+
- `signboard_detection_tool`:招牌区域检测
49+
- `crop_image_by_bbox`:按边界框精准剪裁
50+
- `signboard_char_detection_tool`:招牌文字检测标注
51+
52+
#### 3. 图像分析智能体 (Image Analysis Agent)
53+
54+
- **核心职责**:专业分析LED发光状态和异常识别
55+
- **使用模型**:doubao-seed-1-6-vision-250815 / deepseek-v3-1-terminus
56+
- **集成工具**
57+
- `led_status_analysis_tool`:LED发光状态分析
58+
59+
#### 4. 洗手池检测智能体 (Sink Debris Detector)
60+
61+
- **核心职责**:洗手池整洁度智能检测
62+
- **使用模型**:doubao-seed-1-6-vision-250815
63+
- **集成工具**
64+
- `warn_tools`:告警信息上报系统
65+
- `warn_tools_lark`:飞书机器人告警推送
66+
67+
#### 5. 货架陈列检测智能体 (Shelf Display Checker)
68+
69+
- **核心职责**:货架陈列规范性智能检测
70+
- **使用模型**:doubao-seed-1-6-vision-250815
71+
- **集成工具**
72+
- `warn_tools`:告警信息上报系统
73+
- `warn_tools_lark`:飞书机器人告警推送
74+
75+
## 快速开始
76+
77+
### 环境要求
78+
79+
- Python 3.12 或更高版本
80+
81+
### 1. 安装核心依赖
82+
83+
```bash
84+
# 安装AgentKit SDK
85+
pip install agentkit-sdk-python
86+
87+
# 安装VEADK
88+
pip install -U veadk-python
89+
```
90+
91+
### 2. 部署告警服务(可替换为内部告警系统)
92+
93+
我们提供了模拟告警服务,用于演示如何接入企业内部告警系统。请按照以下流程将告警服务部署到VeFaaS平台。
94+
95+
#### 2.1 安装VeCLI工具
96+
97+
```bash
98+
npm install -g @volcengine/vecli@latest
99+
```
100+
101+
#### 2.2 配置VeCLI连接VeFaaS
102+
103+
请参考官方文档进行配置:[VeCLI配置VeFaaS](https://www.volcengine.com/docs/83927/1826777)
104+
105+
#### 2.3 部署告警服务
106+
107+
```bash
108+
# 进入告警服务目录
109+
cd mcp_tools/warn_service
110+
vecli
111+
```
112+
113+
![告警服务部署](assets/warn_service.png)
114+
115+
#### 2.4 在AgentKit平台创建MCP服务
116+
117+
![创建MCP服务1](assets/create_mcp_0.png)
118+
![创建MCP服务2](assets/create_mcp.png)
119+
120+
### 3. 开发和部署Agent到火山引擎AgentKit
121+
122+
#### 3.1 开发智能体
123+
124+
1. **初始化项目**
125+
126+
```bash
127+
agentkit init
128+
```
129+
130+
执行完成后,目录下会生成三个核心文件:
131+
132+
- `agentkit.yaml` - Agent配置文件
133+
- `requirements.txt` - Python依赖包列表
134+
- `simple_agent.py` - Agent主程序文件
135+
136+
![项目初始化](assets/agent_init.png)
137+
138+
2. **环境配置**
139+
140+
```bash
141+
agentkit config
142+
143+
# 配置时需要设置的环境变量
144+
LARK_EMAIL=XXX # 飞书告警消息接收人邮箱地址
145+
LARK_APP_ID=XXX # 飞书告警机器人应用ID
146+
VOLCENGINE_ACCESS_KEY=XXX # 火山引擎控制台访问密钥
147+
VOLCENGINE_SECRET_KEY=XXX # 火山引擎控制台秘密密钥
148+
```
149+
150+
![配置界面](assets/agent_config.jpeg)
151+
152+
3. **创建出站凭据**
153+
154+
在AgentKit平台创建两个出站凭据:
155+
156+
- `LARK_APP_ID`:飞书应用身份凭据
157+
- 告警系统访问鉴权API密钥
158+
159+
![创建身份凭据](assets/create_identity.jpeg)
160+
161+
修改 `mcp_tools/warn.py` 文件,将 `auth_config``auth_config_lark` 的凭据名称分别修改为对应创建的凭据名称
162+
![身份凭据配置](assets/identity.png)
163+
164+
4. **部署Agent**
165+
166+
```bash
167+
export VOLCENGINE_ACCESS_KEY=xxxxx
168+
export VOLCENGINE_SECRET_KEY=xxxxx
169+
agentkit launch
170+
```
171+
172+
5. **功能验证**
173+
174+
部署完成后,可以通过以下命令测试Agent的招牌质检功能:
175+
176+
```bash
177+
agentkit invoke '{"prompt": "招牌质检,图片url: https://agentkit-demo.tos-cn-beijing.volces.com/volc_coffe.jpeg"}'
178+
```
179+
180+
## 最佳实践
181+
182+
- **图像质量要求**:确保上传的门店图像清晰、光线充足,以获得最佳的检测效果
183+
- **监控与维护**:建立完善的监控机制,确保系统稳定运行
184+
185+
## 技术支持
186+
187+
如需技术支持或有任何疑问,请参考AgentKit官方文档或联系火山引擎技术支持团队。

02-use-cases/inspection_assistant/__init__.py

Whitespace-only changes.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import logging
16+
import os
17+
import sys
18+
from pathlib import Path
19+
20+
from agentkit.apps import AgentkitAgentServerApp
21+
from veadk import Runner
22+
from veadk.agent_builder import AgentBuilder
23+
from veadk.memory.short_term_memory import ShortTermMemory
24+
25+
# 建议通过logging.basicConfig设置全局logger,默认Log级别为INFO
26+
logging.basicConfig(level=logging.INFO)
27+
logger = logging.getLogger(__name__)
28+
29+
# current path
30+
sys.path.append(str(Path(__file__).resolve().parent))
31+
# parent path
32+
sys.path.append(str(Path(__file__).resolve().parent.parent))
33+
34+
# 1. Define root_agent with veadk.AgentBuilder (support veadk web)
35+
yaml_path = "agent.yaml"
36+
if not os.path.isfile(yaml_path):
37+
yaml_path = "inspection-assistant/agent.yaml"
38+
app_name="inspection_assistant"
39+
agent_builder = AgentBuilder()
40+
agent = agent_builder.build(path=yaml_path)
41+
runner = Runner(
42+
agent=agent,
43+
app_name=app_name
44+
)
45+
# support veadk web
46+
root_agent = agent
47+
48+
# 2. Build Agent as Server App (support agentkit)
49+
short_term_memory = ShortTermMemory(backend="local")
50+
agent_server_app = AgentkitAgentServerApp(
51+
agent=root_agent,
52+
short_term_memory=short_term_memory
53+
)
54+
55+
if __name__ == "__main__":
56+
agent_server_app.run(host="0.0.0.0", port=8000)

0 commit comments

Comments
 (0)