[LLM:Feature] Add Agentic Flow to MNN LLM Chat#4512
Conversation
wangzhaode
left a comment
There was a problem hiding this comment.
Review Summary
这个 PR 为 Android MNN LLM Chat 添加了 Agent 模式,包括 web search、Python 执行、浏览器读取等工具调用能力。代码完全在 apps/Android/MnnLlmChat/ 目录下,不影响 MNN 核心引擎。
需要关注的点
-
Chaquopy 依赖:引入了 com.chaquo.python 插件(Python on Android),会显著增加 APK 体积。确认是否只在特定 flavor 中启用,以及是否有无 Python 的降级方案。
-
安全性:python_exec 工具在设备上执行模型生成的 Python 代码,存在安全风险。建议添加沙箱限制(禁止网络访问、文件系统访问范围限制等)。
-
Agent loop 限制:确认是否有最大迭代次数限制防止无限循环(budget limits 在描述中提到了,很好)。
-
数据库迁移:新增 Agent 相关字段需要确保向后兼容(老版本数据库升级不崩溃)。
-
build.gradle 格式:从 build.gradle.kts(Kotlin DSL)变成了 build.gradle(Groovy),这是有意的重构还是冲突?请确认。
-
C++ JNI 层改动:llm_session.cpp 和 llm_mnn_jni.cpp 有少量改动,需要确认不影响现有 chat 流程。
-
文档完善 ✅:docs/ 目录下有完整的设计文档。
建议
- 等 @Juude 的 review 完成后再决定合入
- 确认格式检查失败的原因并修复
- 本 PR 不涉及引擎层改动,主要需要 Android 应用侧的测试验证
|
apps/Android/MnnLlmChat/docs/Agent.gif 这个 gif 太大了,可以找个在线裁剪平台裁剪下,然后邮件发我下,我上传到 cdn |
发你的gmail邮箱了,压缩完2.8MB |
可以直接用这个 cdn 地址: https://meta.alicdn.com/data/mnn/assets/Agent.gif |
Added design notes and an agent demo image to the README.
Updated README to improve image alignment and formatting.
已更新,把原有gif删了。 |
Description
This PR adds an optional Agent mode to MNN LLM Chat while preserving the existing normal chat flow. Agent mode can use host-provided tools for web search,built-in browser reading, Python execution, workspace files, memory, and skill updates. Normal sessions remain backward compatible and continue using the original path when Agent mode is not enabled.
Changes
ChatPresenter:system_calls.system_callsarrayspython_execrecoveryweb_searchbrowser_urlpython_execget_current_time.cxx/andapp/standard/.Notes
Testing
Module
MNN Chat
Type
Checklist
[Module:Type] Descriptionformat