Skip to content

[Bug] 子代理内置工具不完整 #9354

Description

@tokenicrat

What happened / 发生了什么

我使用「子代理编排」功能创建了 subagent,使用选择「默认使用全部函数工具」的人格。但是,在实际测试中,我发现只有计算机操作相关(即 astrbot_execute_shell 等)以及插件、MCP 提供的工具可用,其他(包括 web_search_tavily 等)不可用。

可能原因

源代码 astrbot/core/astr_agent_tool_exec:267-281 似乎是这个 bug 的源头。遍历的 tool_mgr.git_full_tool_set() 是插件、MCP 提供的工具(不包含内置工具),runtime_computer_tools.values() 是可用的计算机操作工具,确实没有引入其他内置工具。

主 agent 按类别引入所有内置工具(astrbot/core/astr_main_agent.py_apply_*_tools 函数),不存在这个问题。

我不清楚这是不是预期行为,但是完全无法配置。

一些问题

如果以上分析正确,我愿意 PR,但是有一些问题:

  • 主 agent 按类别引入内置工具的设计,似乎没考虑与 subagent 共用,要把 _apply_*_tools 在 subagent 这边抄一遍吗
  • git_full_tool_set() 函数名极具迷惑性,一眼看上去像所有启用的工具(无论内置与否)

感谢耐心阅读!

Reproduce / 如何复现?

  1. 启用「子代理编排」功能,并添加一个 subagent,选择启用了所有工具的人格
  2. 启用一个内置工具,例如 Tavily 搜索
  3. 询问可用工具,例如 你有哪些工具可用?另外,用 transfer_to_<subagent_name> 工具问一下 <subagent_name>,它有哪些工具可用。
  4. 对比两个回答,发现子代理缺少 tavily_web_search 等工具

AstrBot version, deployment method (e.g., Windows Docker Desktop deployment), provider used, and messaging platform used. / AstrBot 版本、部署方式(如 Windows Docker Desktop 部署)、使用的提供商、使用的消息平台适配器

  • AstrBot 4.26.7
  • Linux Docker 或 uv 方式部署
  • OpenRouter deepseek/deepseek-v4-pro
  • QQ 官方接口

OS

Linux

Logs / 报错日志

不适用

Are you willing to submit a PR? / 你愿意提交 PR 吗?

  • Yes!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:coreThe bug / feature is about astrbot's core, backendbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions