Skip to content

feat: add silent subagent handoff mode#8192

Open
Ayleovelle wants to merge 1 commit into
AstrBotDevs:masterfrom
Ayleovelle:feat/8181-silent-subagent-handoff
Open

feat: add silent subagent handoff mode#8192
Ayleovelle wants to merge 1 commit into
AstrBotDevs:masterfrom
Ayleovelle:feat/8181-silent-subagent-handoff

Conversation

@Ayleovelle
Copy link
Copy Markdown

@Ayleovelle Ayleovelle commented May 14, 2026

Fixes #8181.

This PR adds a silent SubAgent handoff mode so the main agent can delegate private intermediate work to a SubAgent, consume the SubAgent result, and still answer the user without exposing the internal handoff tool call/result.

Modifications / 改动点

  • Add mode: normal | silent support to SubAgent handoff tools and allow each SubAgent to define a default_handoff_mode.

  • Hide silent SubAgent handoff tool_call / tool_call_result events from user-facing responses while preserving the tool result in the main agent context.

  • Prevent silent SubAgents from directly calling send_message_to_user, and keep silent handoff messages out of persisted checkpoints.

  • Add runtime logs that distinguish 子代理静默调用=开启 and 子代理静默调用=未开启, including whether the mode came from default config or an explicit tool argument.

  • Expose the WebUI toggle as 子代理静默调用, with updated zh-CN / en-US / ru-RU translations and config API compatibility.

  • Add regression tests for silent/default handoff behavior, checkpoint persistence filtering, logging, and SubAgent config loading.

  • This is NOT a breaking change. / 这不是一个破坏性变更。

Screenshots or Test Results / 运行截图或测试结果

Dark mode WebUI screenshot was captured locally at data/temp/subagent-silent-toggle-dark.png, showing the 子代理静默调用 toggle enabled.

Local deployment verification:

  • Started backend at http://localhost:6185 and dashboard at http://localhost:3000.
  • Configured an OpenAI-compatible provider, fetched the model list, selected gpt-5.5, and passed provider health check.
  • WebChat E2E verification: a silent SubAgent returned the expected final token while SSE exposed no visible tool_call / tool_call_result events.
  • Runtime logs now show the difference between silent and normal handoff modes, for example 子代理静默调用=开启 vs 子代理静默调用=未开启.

Checks:

.\.venv\Scripts\ruff.exe check astrbot/core/agent/handoff.py astrbot/core/agent/message.py astrbot/core/agent/runners/tool_loop_agent_runner.py astrbot/core/astr_agent_tool_exec.py astrbot/core/subagent_orchestrator.py astrbot/dashboard/routes/subagent.py tests/test_conversation_checkpoint.py tests/test_tool_loop_agent_runner.py tests/unit/test_astr_agent_tool_exec.py tests/unit/test_subagent_orchestrator.py
All checks passed!

.\.venv\Scripts\python.exe -m pytest tests/test_tool_loop_agent_runner.py tests/unit/test_astr_agent_tool_exec.py tests/test_conversation_checkpoint.py tests/unit/test_subagent_orchestrator.py -q
67 passed

corepack pnpm run typecheck
vue-tsc --noEmit passed

Checklist / 检查清单

  • If there are new features added in the PR, I have discussed it with the authors through issues/emails, etc. / 如果 PR 中有新加入的功能,已经通过 Issue / 邮件等方式和作者讨论过。
  • My changes have been well-tested, and "Verification Steps" and "Screenshots" have been provided above. / 我的更改经过了良好的测试,并已在上方提供了“验证步骤”和“运行截图”。
  • I have ensured that no new dependencies are introduced, OR if new dependencies are introduced, they have been added to the appropriate locations in requirements.txt and pyproject.toml. / 我确保没有引入新依赖库,或者引入了新依赖库的同时将其添加到 requirements.txtpyproject.toml 文件相应位置。
  • My changes do not introduce malicious code. / 我的更改没有引入恶意代码。

@dosubot dosubot Bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label May 14, 2026
Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @Ayleovelle, your pull request is larger than the review limit of 150000 diff characters

@dosubot dosubot Bot added area:core The bug / feature is about astrbot's core, backend area:provider The bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner. area:webui The bug / feature is about webui(dashboard) of astrbot. labels May 14, 2026
@Ayleovelle
Copy link
Copy Markdown
Author

Ayleovelle commented May 14, 2026

subagent-silent-toggle-dark

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a 'silent' handoff mode for subagents, enabling private task execution where tool calls and raw results are hidden from the end user. Key changes include updating the HandoffTool schema, implementing message filtering during serialization to exclude private tool interactions, and enhancing the FunctionToolExecutor to handle silent mode resolution and toolset restriction. Additionally, the subagent orchestrator and dashboard UI were updated to support this configuration, supported by new unit and integration tests. I have no feedback to provide.

@Ayleovelle Ayleovelle force-pushed the feat/8181-silent-subagent-handoff branch from f2a2813 to 8a3a262 Compare May 14, 2026 21:00
@dosubot dosubot Bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XXL This PR changes 1000+ lines, ignoring generated files. labels May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core The bug / feature is about astrbot's core, backend area:provider The bug / feature is about AI Provider, Models, LLM Agent, LLM Agent Runner. area:webui The bug / feature is about webui(dashboard) of astrbot. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]【功能建议】SubAgent 支持“静默调用”模式,让子代理结果返回主代理而非直接回复用户

1 participant