Files
mkdocs/docs/Obsidian笔记体系/Projects/saars开发/aiapply/ADB 工具和 Android 日志获取 Agent 已创建.md
2026-01-25 09:11:59 +08:00

95 lines
2.1 KiB
Markdown
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
##
### 完成内容
1. 创建了 adb_log 工具
- 支持三种命令类型:
- logcat获取 Android 设备日志
- devices列出连接的设备
- shell执行 shell 命令(受限,只允许安全命令)
- 支持日志过滤:
- 按标签过滤 ActivityManager、SystemServer
- 按级别过滤V/D/I/W/E/F/S
- 可限制返回行数默认 100 行)
- 超时控制(默认 10 秒,最大 60 秒)
1. 注册了 ADB 工具
- 已注册到工具注册表
- 可在 LLM 节点中启用工具调用时使用
1. 创建了 Android 日志获取助手 Agent
- Agent ID: b68e96d2-da66-4402-86a5-9fae6b5ac092
- Agent 名称: Android日志获取助手
- 工作流 ID: 4df28591-7d47-403e-b7dc-9fc298b79527
### 工作流说明
工作流包含以下节点:
1. 开始节点:接收用户输入
2. 意图识别节点:分析用户请求,提取 ADB 命令参数
3. JSON 解析节点:解析意图识别的结果
4. LLM 工具调用节点使用 adb_log 工具执行 ADB 命令
5. 结束节点:返回结果
### 使用示例
# 测试Agent
python3 test_workflow_tool.py -a "Android日志获取助手" -i '{"query": "获取最近的错误日志"}'
# 其他示例
python3 test_workflow_tool.py -a "Android日志获取助手" -i '{"query": "列出所有连接的设备"}'
python3 test_workflow_tool.py -a "Android日志获取助手" -i '{"query": "获取ActivityManager的日志"}'
### 注意事项
1. ADB 环境要求
- 需要安装 Android SDK Platform Tools
- 需要将 adb 命令添加到 PATH
- 需要连接 Android 设备或启动模拟器
1. 安全限制:
- shell 命令只允许执行安全命令getprop、dumpsys、pm、am、settings
- 不允许执行危险命令 rm、reboot 
1. 性能优化:
- 默认限制返回 100 行日志,避免输出过长
- 支持超时控制,避免长时间等待
### 下一步
1. 在前端 Agent 管理页面查看创建的 Agent
2. 测试 Agent 功能
3. 根据需要调整工作流配置
Agent 已创建,可以使用 ADB 命令获取 Android 设备日志。