-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: 增强版的SubAgent功能 #7108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
feat: 增强版的SubAgent功能 #7108
Changes from all commits
Commits
Show all changes
83 commits
Select commit
Hold shift + click to select a range
44d2364
feat: enhanced subagent
elecvoid243 01b78d7
Merge branch 'master' of https://github.com/elecvoid243/AstrBot
elecvoid243 c70d0a5
no message
elecvoid243 f195754
no message
elecvoid243 3b005da
no message
elecvoid243 2b67fd3
no message
elecvoid243 9d38048
formatting
elecvoid243 378a6e6
no message
elecvoid243 2d33670
no message
elecvoid243 5e45821
test
elecvoid243 ad34dce
no message
elecvoid243 2389f27
Merge branch 'master' into master
elecvoid243 549ff85
no message
elecvoid243 38a6b2e
Merge branch 'master' of https://github.com/elecvoid243/AstrBot
elecvoid243 58d5141
Merge branch 'AstrBotDevs:master' into master
elecvoid243 a9cf8d3
添加Reset工具
elecvoid243 923a58e
Merge branch 'AstrBotDevs:master' into master
elecvoid243 bf88368
结构化的共享上下文;更新subagent后台任务逻辑
elecvoid243 97cfedf
Merge branch 'AstrBotDevs:master' into master
elecvoid243 9f7e208
主动等待机制;Prompt优化
elecvoid243 163ce55
Merge branch 'master' of https://github.com/elecvoid243/AstrBot
elecvoid243 ee0a85e
Merge branch 'AstrBotDevs:master' into master
elecvoid243 fb39593
Merge branch 'AstrBotDevs:master' into master
elecvoid243 06cb7ea
subagent运行状态监控
elecvoid243 a579ac3
Merge branch 'master' into master
elecvoid243 3f02d54
rollback local.py
elecvoid243 03deaac
Merge branch 'AstrBotDevs:master' into master
elecvoid243 d3cee00
merge
elecvoid243 47b61ec
Merge branch 'AstrBotDevs:master' into master
elecvoid243 7dbfb6e
后台subagent任务:若主agent已结束,回退到原始唤醒机制
elecvoid243 6a6d030
移除logger;prompt简化
elecvoid243 cea5611
subagent历史带工具调用信息
elecvoid243 a9dd635
Merge branch 'master' into master
elecvoid243 1222aae
formatting
elecvoid243 25200f2
no message
elecvoid243 603072c
no message
elecvoid243 2e2a60b
Merge branch 'AstrBotDevs:master' into master
elecvoid243 65bb50c
no message
elecvoid243 7d567b6
Merge branch 'AstrBotDevs:master' into master
elecvoid243 4366d37
Merge branch 'master' of https://github.com/elecvoid243/AstrBot
elecvoid243 7490ea3
添加subagent超时保护(总时长)
elecvoid243 cd912b3
Merge branch 'AstrBotDevs:master' into master
elecvoid243 f4fabc2
Merge branch 'master' of https://github.com/elecvoid243/AstrBot
elecvoid243 7ef86e4
formatting
elecvoid243 09da25c
Merge branch 'master' into master
elecvoid243 00465ee
更新dashborad
elecvoid243 ee3d6fe
fix dashboard
elecvoid243 0999ba1
formatting
elecvoid243 8705d81
bug fix
elecvoid243 17134ef
Merge branch 'AstrBotDevs:master' into master
elecvoid243 f26fbf4
Merge branch 'AstrBotDevs:master' into master
elecvoid243 a064451
bug fix
elecvoid243 e3ace42
resolve conficts
elecvoid243 ffa3cbc
Merge branch 'AstrBotDevs:master' into master
elecvoid243 095603c
合并subagent与enhanced subagent实现
elecvoid243 c098de9
Merge branch 'AstrBotDevs:master' into master
elecvoid243 0d6567a
format
elecvoid243 2f93e9e
format
elecvoid243 b70439b
Merge branch 'master' of https://github.com/elecvoid243/AstrBot
elecvoid243 ceba3ae
no message
elecvoid243 f0b3872
历史上下文功能变为可配置的
elecvoid243 49be025
Merge branch 'AstrBotDevs:master' into master
elecvoid243 885e1e0
bug fix
elecvoid243 40ce239
Merge branch 'AstrBotDevs:master' into master
elecvoid243 b7c3a88
Merge branch 'master' of https://github.com/elecvoid243/AstrBot
elecvoid243 b2a8593
为配置项更新dashboard
elecvoid243 c73a542
Merge branch 'AstrBotDevs:master' into master
elecvoid243 e0e8da9
Merge branch 'master' of https://github.com/elecvoid243/AstrBot
elecvoid243 116ec55
啥时候改的这个文件?还原
elecvoid243 820a9dd
no message
elecvoid243 1cd37f1
优化dashboard
elecvoid243 822de54
no message
elecvoid243 734e3a3
no message
elecvoid243 238ee93
no message
elecvoid243 12d761e
no message
elecvoid243 239d576
分离manager和tools
elecvoid243 5a11f81
ruff
elecvoid243 e2f8f5e
Merge branch 'AstrBotDevs:master' into master
elecvoid243 a0aa3d8
Merge branch 'AstrBotDevs:master' into master
elecvoid243 4f02492
优化router prompt; 更多dashboard配置
elecvoid243 d5fb9f9
共享上下文放到system_reminder防止缓存不命中
elecvoid243 56e0192
Merge branch 'AstrBotDevs:master' into master
elecvoid243 97d19cc
移除变化的router prompt
elecvoid243 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
issue (complexity): Consider encapsulating tool resolution, dynamic tool protocol handling, and abort reasons into focused helpers/enums so the runner’s main control flow stays linear and simpler.
You can reduce the added complexity without changing behavior by isolating the cross‑cutting concerns (tool resolution/protocol and abort reasons) behind small helpers/objects, so the runner stays linear.
1. Centralize tool resolution into a single helper
Right now the tool resolution path is:
_resolve_dynamic_subagent_tool)skills_likevs normal)req.func_tool.get_tool(...)This is duplicated/overlapping and makes the main execution branch harder to follow. You can hide this behind a single
_get_func_tool(...)that encodes the resolution strategy in one place.Before (simplified):
After (main path stays simple):
Helper implementation (localized complexity):
This keeps the behavior the same but removes branching from the core loop and makes the lookup strategy explicit and testable.
2. Isolate the “dynamic tool protocol” into a separate helper
_maybe_register_dynamic_tool_from_resultis currently:run_context.context.event.unified_msg_originself.req.func_toolYou can make this easier to reason about and reuse by pushing protocol parsing into a separate static/helper, so the runner just orchestrates.
Before (runner does everything):
After (runner calls into a dedicated protocol adapter):
Protocol helper (can live in
SubAgentManageror a small module):This keeps the protocol semantics exactly as-is, but the runner becomes a thin client of
DynamicToolProtocol, and you can unit test that class independently of the runner.3. Make abort reasons explicit instead of a boolean flag
_finalize_aborted_stepcurrently uses amanual_stop: boolto distinguish “user stop” vs “main agent stopped SubAgent”. That’s a hidden “reason enum” encoded as a boolean, and every caller has to remember which value to pass.You can make this more self‑documenting by introducing a tiny
Enumand a local helper, without changing logging/messages.Before:
After (more explicit, same behavior):
Existing callers that passed
manual_stop=True/Falsebecome more self‑describing:This keeps all functionality intact but removes the “boolean protocol” and makes stop logic easier to reason about and test.