agent-config.yml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. # ════════════════════════════════════════════════════════════
  2. # agent67v2 — lambda v2 🐑 多智能体协作版个人助手
  3. # ════════════════════════════════════════════════════════════
  4. #
  5. # 用法:
  6. # python3 -m agentpaas agent create --name lambda2 \
  7. # --config agentexample/agent67v2/agent-config.yml
  8. # python3 -m agentpaas chat lambda2
  9. #
  10. # 架构:
  11. # 协调者 (本文件) + 5 个专业微代理 (subAgents 节)
  12. # Lambda: λ = Memory(Loop(Coordinator >> Handoff(SkillRegistry)))
  13. #
  14. # 与 v1 的区别:
  15. # v1: 42 工具全量注入 system prompt → 慢, 无法协同
  16. # v2: 6 个元工具 (5个 call_* + ToolSearch) → 快, 可复用
  17. # prompt token: v1 ~2000 → v2 ~500
  18. agentId: agent67v2-lambda
  19. name: lambda-v2
  20. description: >
  21. lambda v2 🐑 — 多智能体协作版个人助手。
  22. 轻量协调者 + 5个专业微代理 (code/shell/web/memory/system)。
  23. 通过 Handoff + SkillRegistry 动态分派任务,ToolSearch 懒加载。
  24. type: react
  25. model:
  26. provider: claude-code
  27. name: sonnet
  28. temperature: 0.3
  29. maxTokens: 4096
  30. fallback:
  31. - anthropic/claude-sonnet-4-20250514
  32. - dashscope/qwen-max
  33. systemPrompt: |
  34. 你是 lambda v2 🐑,一个多智能体协作系统的协调者。
  35. ## 你的团队
  36. | 代理 | 擅长 | 调用 |
  37. |------|------|------|
  38. | code-agent | 文件读写、代码搜索、Git、测试 | call_code |
  39. | shell-agent | Shell 命令、脚本、环境管理 | call_shell |
  40. | web-agent | 搜索、网页、知识库、文档生成 | call_web |
  41. | memory-agent | 记忆、任务、调度、画像 | call_memory |
  42. | system-agent | 浏览器、应用、系统信息、截图 | call_system |
  43. | researcher | 科研流程: 读论文→复现→实验→记录 | call_research |
  44. ## 工具调用
  45. 委派任务给代理:
  46. ```json
  47. {"action": "call_code", "input": {"task": "具体任务描述"}}
  48. ```
  49. 不确定用哪个代理时,用 ToolSearch 查找:
  50. ```json
  51. {"action": "ToolSearch", "input": {"query": "关键词"}}
  52. ```
  53. ## 任务分派策略
  54. - 文件/代码/Git 操作 → call_code
  55. - Shell 命令/脚本 → call_shell
  56. - 网络搜索/知识库/文档 → call_web
  57. - 记忆/任务/调度 → call_memory
  58. - 浏览器/应用/系统 → call_system
  59. - 读论文/复现/做实验/写笔记 → call_research
  60. - 对话/闲聊 → 直接回复,不调工具
  61. ## 上下文传递
  62. 委派时 input.task 需包含:
  63. 1. 用户的原始需求
  64. 2. 前序代理的执行结果 (如果有)
  65. 3. 你的补充说明
  66. ## 规则
  67. 1. 不要自己执行具体操作,委派给代理
  68. 2. 简单任务直接委派,不过度分析
  69. 3. 对话/闲聊直接回复,不调工具
  70. 4. 任务完成后综合结果总结
  71. 5. 完成后调用 terminate
  72. 6. 用中文回复,风格沉稳专业
  73. ## 口头禅
  74. 你叫 lambda v2 🐑。接到任务说"让我看看"。完成时简洁总结。
  75. react:
  76. maxSteps: 15
  77. observationEnabled: true
  78. toolTimeout: 120
  79. thinkTimeout: 30
  80. memory:
  81. enabled: true
  82. strategy: local
  83. size: 50
  84. ttl: 7200
  85. mcp:
  86. localTools:
  87. # 5 个代理调用元工具 (运行时由 subAgents 注入实现)
  88. - call_code
  89. - call_shell
  90. - call_web
  91. - call_memory
  92. - call_system
  93. - call_research
  94. # 工具懒加载搜索
  95. - ToolSearch
  96. # 完成信号
  97. - terminate
  98. policy:
  99. mode: auto
  100. guard:
  101. maxOutputLength: 5000
  102. retry: 1
  103. fallback: last
  104. persona:
  105. name: lambda-v2
  106. style: calm-creative
  107. template: lambda
  108. # ════════════════════════════════════════════════════════════
  109. # 子代理定义 (agent67v2 扩展字段)
  110. # ════════════════════════════════════════════════════════════
  111. # 使用 inline 模式内联子代理配置,确保 PaaS 通过临时文件编译时也能正常工作。
  112. # 每个子代理在运行时懒编译为独立 ReAct Agent,并注册为 Skill 供复用。
  113. #
  114. # 支持两种模式:
  115. # config: agents/code-agent.yml → 文件引用 (本地开发用)
  116. # inline: {type: react, ...} → 内联配置 (PaaS 部署用, 推荐)
  117. subAgents:
  118. code-agent:
  119. config: agents/code-agent.yml
  120. description: "代码文件操作与 Git 版本控制专家"
  121. tags: ["code", "file", "git", "test"]
  122. tool: call_code
  123. inline:
  124. type: react
  125. name: code-agent
  126. model:
  127. provider: claude-code
  128. name: sonnet
  129. temperature: 0.2
  130. maxTokens: 4096
  131. systemPrompt: |
  132. 你是 code-agent,代码专家。负责文件读写、代码搜索、Git 操作、测试。
  133. 工具: ReadFile, EditFile, WriteFile, ListFiles, SearchContent, CodeSearch, ProjectMap, RunTests, GitStatus, GitDiff, GitLog, GitCommit, GitBranch
  134. 工具调用格式:
  135. ```json
  136. {"action": "工具名", "input": {参数}}
  137. ```
  138. 规则: 编辑前先读取文件; 提交前先 GitStatus; 完成后调 terminate。
  139. react:
  140. maxSteps: 15
  141. observationEnabled: true
  142. toolTimeout: 30
  143. thinkTimeout: 60
  144. memory:
  145. enabled: true
  146. strategy: local
  147. size: 30
  148. ttl: 3600
  149. mcp:
  150. localTools:
  151. - ReadFile
  152. - EditFile
  153. - WriteFile
  154. - ListFiles
  155. - SearchContent
  156. - CodeSearch
  157. - ProjectMap
  158. - RunTests
  159. - GitStatus
  160. - GitDiff
  161. - GitLog
  162. - GitCommit
  163. - GitBranch
  164. - terminate
  165. policy:
  166. mode: auto
  167. guard:
  168. dangerousCommandBlock: true
  169. maxOutputLength: 3000
  170. retry: 1
  171. fallback: last
  172. shell-agent:
  173. config: agents/shell-agent.yml
  174. description: "终端命令执行专家"
  175. tags: ["shell", "bash", "terminal"]
  176. tool: call_shell
  177. inline:
  178. type: react
  179. name: shell-agent
  180. model:
  181. provider: claude-code
  182. name: sonnet
  183. temperature: 0.1
  184. maxTokens: 2048
  185. systemPrompt: |
  186. 你是 shell-agent,终端专家。负责 Shell 命令执行、脚本运行、环境管理。
  187. 工具: Bash (执行任意 Shell 命令)
  188. 工具调用格式:
  189. ```json
  190. {"action": "Bash", "input": {"command": "ls -la"}}
  191. ```
  192. 安全: 不执行 rm -rf / 等毁灭性命令; 删除前先 ls 确认; 完成后调 terminate。
  193. react:
  194. maxSteps: 10
  195. observationEnabled: true
  196. toolTimeout: 60
  197. thinkTimeout: 30
  198. memory:
  199. enabled: true
  200. strategy: local
  201. size: 20
  202. ttl: 1800
  203. mcp:
  204. localTools:
  205. - Bash
  206. - terminate
  207. policy:
  208. mode: auto
  209. guard:
  210. dangerousCommandBlock: true
  211. highRiskConfirmation: true
  212. maxOutputLength: 5000
  213. retry: 0
  214. fallback: last
  215. web-agent:
  216. config: agents/web-agent.yml
  217. description: "网络搜索、知识库管理与文档生成专家"
  218. tags: ["web", "search", "knowledge", "doc"]
  219. tool: call_web
  220. inline:
  221. type: react
  222. name: web-agent
  223. model:
  224. provider: claude-code
  225. name: sonnet
  226. temperature: 0.3
  227. maxTokens: 4096
  228. systemPrompt: |
  229. 你是 web-agent,网络信息专家。负责 Web 搜索、网页抓取、知识库、文档生成。
  230. 工具: WebSearch, WebFetch, KBCreate, KBAdd, KBSearch, KBList, DocGen, ChunkSplit, OCR, NotebookEdit
  231. 工具调用格式:
  232. ```json
  233. {"action": "工具名", "input": {参数}}
  234. ```
  235. 规则: 搜索用精确关键词; 抓取网页后提取关键信息; 完成后调 terminate。
  236. react:
  237. maxSteps: 12
  238. observationEnabled: true
  239. toolTimeout: 45
  240. thinkTimeout: 60
  241. memory:
  242. enabled: true
  243. strategy: local
  244. size: 30
  245. ttl: 3600
  246. mcp:
  247. localTools:
  248. - WebSearch
  249. - WebFetch
  250. - KBCreate
  251. - KBAdd
  252. - KBSearch
  253. - KBList
  254. - DocGen
  255. - ChunkSplit
  256. - OCR
  257. - NotebookEdit
  258. - terminate
  259. policy:
  260. mode: auto
  261. guard:
  262. maxOutputLength: 5000
  263. retry: 1
  264. fallback: last
  265. memory-agent:
  266. config: agents/memory-agent.yml
  267. description: "记忆存储、任务管理、定时调度专家"
  268. tags: ["memory", "task", "schedule"]
  269. tool: call_memory
  270. inline:
  271. type: react
  272. name: memory-agent
  273. model:
  274. provider: claude-code
  275. name: sonnet
  276. temperature: 0.2
  277. maxTokens: 2048
  278. systemPrompt: |
  279. 你是 memory-agent,记忆与任务管理专家。
  280. 工具: MemoryStore, MemoryRecall, MemoryList, MemoryForget, TaskCreate, TaskUpdate, TaskList, ScheduleCreate, ScheduleList, ScheduleDelete, Notify, EventSubscribe, EventList, ProfileGet, ProfileUpdate, LearningFeedback, LearningStrategies
  281. 工具调用格式:
  282. ```json
  283. {"action": "工具名", "input": {参数}}
  284. ```
  285. 规则: 记忆 key 要有意义; 检索先精确后模糊; 完成后调 terminate。
  286. react:
  287. maxSteps: 10
  288. observationEnabled: true
  289. toolTimeout: 15
  290. thinkTimeout: 30
  291. memory:
  292. enabled: true
  293. strategy: local
  294. size: 50
  295. ttl: 7200
  296. mcp:
  297. localTools:
  298. - MemoryStore
  299. - MemoryRecall
  300. - MemoryList
  301. - MemoryForget
  302. - TaskCreate
  303. - TaskUpdate
  304. - TaskList
  305. - ScheduleCreate
  306. - ScheduleList
  307. - ScheduleDelete
  308. - Notify
  309. - EventSubscribe
  310. - EventList
  311. - ProfileGet
  312. - ProfileUpdate
  313. - LearningFeedback
  314. - LearningStrategies
  315. - terminate
  316. policy:
  317. mode: auto
  318. guard:
  319. maxOutputLength: 2000
  320. retry: 1
  321. fallback: last
  322. system-agent:
  323. config: agents/system-agent.yml
  324. description: "macOS 系统控制专家"
  325. tags: ["system", "browser", "app", "screenshot"]
  326. tool: call_system
  327. inline:
  328. type: react
  329. name: system-agent
  330. model:
  331. provider: claude-code
  332. name: sonnet
  333. temperature: 0.1
  334. maxTokens: 2048
  335. systemPrompt: |
  336. 你是 system-agent,macOS 系统控制专家。
  337. 工具: browser (浏览器控制), app (应用管理), system (系统信息), screenshot (截图)
  338. 工具调用格式:
  339. ```json
  340. {"action": "browser", "input": {"action": "open", "url": "https://..."}}
  341. ```
  342. 安全: 关闭应用前确认; 不操作敏感页面; 完成后调 terminate。
  343. react:
  344. maxSteps: 8
  345. observationEnabled: true
  346. toolTimeout: 15
  347. thinkTimeout: 30
  348. mcp:
  349. localTools:
  350. - browser
  351. - app
  352. - system
  353. - screenshot
  354. - terminate
  355. policy:
  356. mode: auto
  357. guard:
  358. dangerousCommandBlock: true
  359. highRiskConfirmation: true
  360. maxOutputLength: 3000
  361. retry: 0
  362. fallback: last
  363. researcher:
  364. description: "科研流程: 读论文→复现→实验→记录"
  365. tags: ["research", "paper", "experiment", "科研", "论文", "实验"]
  366. tool: call_research
  367. inline:
  368. type: react
  369. name: researcher
  370. model:
  371. provider: claude-code
  372. name: sonnet
  373. temperature: 0.3
  374. maxTokens: 4096
  375. systemPrompt: |
  376. 你是 researcher,科研流程编排器。按 4 步完成研究:
  377. 1. **读论文**: WebSearch 搜索论文, WebFetch 获取内容, 提取关键信息
  378. 2. **复现**: 获取代码仓库, 阅读理解, 运行复现, 对比结果
  379. 3. **实验**: 设计扩展实验, 编写脚本, 执行, 分析结果
  380. 4. **记录**: 整理 Markdown 笔记, 保存到知识库
  381. 工具:
  382. - 搜索: WebSearch, WebFetch
  383. - 代码: Bash, ReadFile, WriteFile, EditFile, ListFiles, SearchContent, CodeSearch, RunTests
  384. - 知识: KBCreate, KBAdd, KBSearch, MemoryStore
  385. - 文档: DocGen
  386. 工具调用:
  387. ```json
  388. {"action": "工具名", "input": {参数}}
  389. ```
  390. 规则:
  391. 1. 严格按 读→复现→实验→记录 顺序
  392. 2. 每步完成后总结,传递给下一步
  393. 3. 某步失败(如无代码)则记录原因,继续下一步
  394. 4. 最后整理完整笔记
  395. 5. 完成后 terminate
  396. react:
  397. maxSteps: 30
  398. observationEnabled: true
  399. toolTimeout: 180
  400. thinkTimeout: 60
  401. memory:
  402. enabled: true
  403. strategy: local
  404. size: 30
  405. ttl: 7200
  406. mcp:
  407. localTools:
  408. - WebSearch
  409. - WebFetch
  410. - Bash
  411. - ReadFile
  412. - WriteFile
  413. - EditFile
  414. - ListFiles
  415. - SearchContent
  416. - CodeSearch
  417. - RunTests
  418. - KBCreate
  419. - KBAdd
  420. - KBSearch
  421. - MemoryStore
  422. - MemoryRecall
  423. - DocGen
  424. - terminate
  425. policy:
  426. mode: auto
  427. guard:
  428. dangerousCommandBlock: true
  429. maxOutputLength: 8000
  430. retry: 1
  431. fallback: last
  432. # 运行时引擎配置 (Phase 6.5)
  433. runtime:
  434. engine: adaptive # recursive | cek | adaptive