Repository navigation
Core Subagents
athenavi edited this page Oct 9, 2026
·
1 revision
权威来源:子 Agent 设计(Profile 化 + L0/L1/L2 三级消息模型)。 本页只给「它是什么、代码在哪、边界在哪」。
主 Agent 把一段任务委派出去,由子 Agent 独立跑,再把结果带回。 难点不在"能起一个子进程",而在边界:子 Agent 能看到什么上下文、能改什么、结果怎么合并、 失败/取消怎么收尾、以及账本怎么记。
python-engine/app/agent/
subagent_runner.py 1258 行 —— 子 Agent 的执行器
multi_agent.py 515 行 —— 多 Agent 编排
collaboration.py 575 行 —— 协作
python-engine/app/subagent/
scheduler.py 调度(并发天花板)
store.py 账本持久化
registry.py · registry_targets.py 注册与目标解析
affinity.py 亲和/归属
receipts.py 回执
inherit.py 上下文继承(**边界就在这个文件**)
remote.py 远端子 Agent
网关侧
internal/api/subagent_cancel.go 等 取消与终态
前端
frontend-vue/src/api/subagent.ts 前端调用面
- 五元组边界由测试钉住:子 Agent 能看/能改的范围是断言过的,不是约定俗成。
-
继承是显式的:
inherit.py决定带过去多少上下文 —— 默认不是"全带"。 -
终态必须明确:取消 / 超时 / 失败都要落到账本(
store.py),不能只靠日志。
- 子 Agent(本页):一个主 Agent 委派出的执行单元,有账本、有边界。
- 多智能体编排(高级用法):多个 Agent 之间的协作拓扑。
两者共用 multi_agent.py / collaboration.py,但边界不同:前者是"委派",后者是"协作"。
本页由仓库内 docs/wiki/ 同步生成(scripts/sync_github_wiki.py)。请不要直接编辑本 wiki —— 改动会下次同步时被覆盖;请改仓库里的对应文件。
Advanced
Contributing
Core
Getting Started
Learn
Production
Reference