Skip to content

[Feature]: Opt-in tool groups for HarnessAgent built-in tools (progressive disclosure of built-ins) #3296

Open

Description

@xuchaoguo1983

Feature request: register HarnessAgent built-in tools in (opt-in) META tool groups

Context. HarnessAgent registers about 20+ built-in tools ungrouped: workspace files, subagents and async tasks, session search, web, memory, skills. They are therefore always part of the tool list. Business tools can already be grouped and disclosed on demand with createToolGroup(..., false) + enableMetaTool(true), but the built-in set stays a fixed baseline on every request.

Why it matters. On a real product agent (2.0.3, served through a qwen "flash"-class model), we measured the effect of the number of visible tools. We replayed the same request, varying only the tool list:

  • ≤30 visible tools: 6/6 correct tool arguments. The model copies ids from the previous tool result.
  • 31–32 visible tools: 2/6–3/6 correct. The model fabricates ids. This happens even when the extra tool is unrelated.
  • In a full evaluation (16 scenarios × 3), grouping only the business tools (27–33 visible tools) barely moved the score (30 → 33 / 48). Reducing the visible set to 10–16 tools gave 41 / 48, with about 40% smaller requests.

Stronger models are far less sensitive, so the effect is mainly on lighter models. Still, the built-in baseline alone is close to the point where lighter models degrade.

Current options are ToolsConfig.deny and the disable*() builder switches. Both remove capabilities entirely. Moving built-ins into groups after build() works, but depends on internals: the toolkit copy made at build, the delegate toolkit and the tool names.

Proposal. Add an opt-in builder option that registers built-in tool families as META-scoped, inactive groups, with descriptions, for example workspace_files, subagents, session_history and web. The model then activates them with reset_equipped_tools when needed. Memory and skill tools could stay ungrouped. The default behaviour stays unchanged.

Related: #2439 (active groups are shared across concurrent sessions). A per-call fix there would be a prerequisite for relying on groups in multi-session servers. Also related: #2784 (prompt-cache-stable progressive disclosure).

Activity

  1. oss-maintainer commented on Sep 26, 2026

    @oss-maintainer
    Collaborator

    Issue Evaluation

    Category: enhancement (area/harness) | Status: Evaluated — feasible, high feasibility; one prerequisite is already resolved | Severity: medium (model-visible tool surface / lighter-model accuracy)

    Verified claim-by-claim against main @ 6a056809a (engine-assisted read of agentscope-harness + agentscope-core):

    Claim Result Evidence
    HarnessAgent registers ~20+ built-ins ungrouped, always in the tool list CONFIRMED 22 default schemas on a standard build: files 6 (FilesystemTool.java:110-287), subagents/tasks 6 (DynamicSubagentsMiddleware.java:97-141, AgentSpawnTool.java:287-702, TaskTool.java:53-182), async wait 1 (WaitAsyncResultsTool.java:97-140), memory 3 + session search/history 3 (HarnessAgent.java:2701-2706, SessionSearchTool.java:52-176), web 2 (HarnessAgent.java:2738-2745, WebTools.java:63-130), skill loader 1 (SkillRuntime.java:87-107)
    Ungrouped built-ins cannot be hidden by the grouping mechanism CONFIRMED registration uses registerTool(...) with no group (HarnessAgent.java:2657-2658,2671-2672,2690-2697,2701-2706,2727-2745); ungrouped tools are always active and always in schemas (ToolGroupManager.java:315-368, ToolSchemaProvider.java:39-44,92-105)
    Business tools can already be grouped on demand CONFIRMED exact APIs: Toolkit.createToolGroup(String, String, boolean) (scope defaults to META) and Toolkit.addToolToGroup(String, String) (Toolkit.java:681-777); opt-in via HarnessAgent.Builder.enableMetaTool(boolean) (HarnessAgent.java:1677-1679) wired during build in ReActAgent.java:5598-5607
    Activation tool is named reset_equipped_tools CONFIRMED MetaToolFactory.java:47-100,135-175; parameter to_activate is the final META set — omitted META groups are deactivated, EXTERNAL-scoped groups are preserved
    Current alternatives remove capability entirely CONFIRMED ToolsConfig.deny beats allow and removes the registration (ToolsConfig.java:31-39, ToolFilter.java:55-80,86-122); family switches disableFilesystemTools / disableShellTool / disableWebTools / disableMemoryTools / disableSubagents (HarnessAgent.java:2074-2090,2117-2131,2230-2305). Note disableDynamicSubagents() selects the static subagent set, it does not remove subagent tools (HarnessAgent.java:2645-2677)
    Grouping built-ins after build() depends on build-time internals CONFIRMED Harness copies the builder toolkit (HarnessAgent.java:2369-2372) and ReActAgent.Builder copies again (ReActAgent.java:5598-5607); post-build changes must target HarnessAgent.getToolkit() (HarnessAgent.java:949-950) — which is exactly why the grouping belongs in the builder rather than in user code
    #2439 (groups shared across concurrent sessions) is a prerequisite NO LONGER BLOCKING group state now resolves per session from AgentState.toolContext; ReActAgentToolkitConcurrencyTest.java:229-304 ("concurrent sessions resolve tools from their own activated groups") covers the cross-talk case. The legacy shared-flag APIs (Toolkit.java:785,857,870, marked "Legacy single-session API") must not be used for runtime activation — worth stating in the new option's Javadoc
    #2784 (prompt-cache-stable disclosure) is related CONFIRMED schemas are rebuilt per call from the session's active groups (ReActAgent.java:2452-2455), so changing the active set churns the tools prefix; #2784 is still OPEN and this feature increases how often that prefix changes

    Assessment. The request is well-targeted: the core already has every primitive needed (createToolGroup + ToolGroupScope.META + enableMetaTool + per-session ToolContextState), so the missing piece is genuinely a harness-side builder option that assigns the built-in families to inactive META groups, not new framework machinery. Default behaviour must stay the current 22-schema ungrouped baseline.

    Suggested shape and constraints:

    1. Opt-in on HarnessAgent.Builder (e.g. groupBuiltinTools(...) / a family enum), evaluated before inner.build() so the two toolkit copies carry the group membership instead of relying on post-build mutation.
    2. Keep memory + skill tools ungrouped as proposed — load_skill_through_path and memory_search/memory_write are the tools the model needs on nearly every turn, so demoting them costs an extra reset_equipped_tools round-trip per task for little schema saving.
    3. reset_equipped_tools itself must be registered ungrouped; if it were grouped the model could never regain a family.
    4. Respect existing precedence: ToolsConfig.deny and disable*() must be applied before grouping, so a disabled family does not show up as an empty group in the meta-tool enum (MetaToolFactory.java:83 enumerates getMetaGroupNames(); an empty group would be a dead option the model can waste turns on).
    5. Document the prompt-cache interaction with [Feature] 支持缓存稳定的渐进式工具披露,避免 ToolGroup 变化导致 Prompt Cache 前缀整体失配 #2784 explicitly, since per-request reset_equipped_tools churn is the mechanism that busts the tools prefix.

    Scope is small and localized: HarnessAgent.java registration sites listed above, the builder options block, a family→tool-name table, and harness build/tool-surface tests (assert default = 22 ungrouped schemas; opt-in = family groups inactive with the meta tool able to activate them). No change needed in Toolkit/MetaToolFactory.

    No automated PR this tick: this is a public-API design decision on the most-used builder in the harness (family naming, granularity, and whether it is a single switch or per-family opt-out), and the maintainer's preference between those shapes determines the diff. Confirm the family set (workspace_files, subagents, session_history, web) and the option naming, then reply /approve and a PR can be generated against that shape.


    Automated evaluation by github-manager-bot

  2. added
    enhancement
    area/harness
    on Sep 26, 2026
  3. oss-maintainer commented on Sep 29, 2026

    @oss-maintainer
    Collaborator

    Status: 72 h feedback window expired — no automated PR will be generated, the proposal window here is closed

    The evaluation above (5843100499, posted 2026-09-26T04:17:55Z) reached its 72-hour limit at 2026-09-29T04:17:55Z. The thread contains no reply at all, so there is no community-chosen shape for us to build a spec against, and per our workflow PR generation is skipped for this proposal window. No competing PR will be filed from this proposal window.

    What the window was waiting on, restated so this thread is self-contained: the evaluation confirmed the request end to end against main — HarnessAgent registers 22 built-in tool schemas with no group, ungrouped tools are always active and always in the schema list, and Toolkit.createToolGroup plus ToolGroupScope.META, enableMetaTool and reset_equipped_tools already supply every primitive the feature needs. The two open items were maintainer-owned naming choices, not unknowns: the family set (workspace_files, subagents, session_history, web) and the builder option's name and granularity (one switch, or per-family opt-out). Those two answers are the whole gap between this evaluation and a diff.

    Two constraints recorded there are worth keeping for whoever picks this up, independent of who writes the patch: grouping has to be decided before the inner build, because both HarnessAgent and ReActAgent.Builder copy the toolkit and post-build mutation is exactly what the per-session tool state is designed to avoid; and reset_equipped_tools itself must stay ungrouped, since grouping the activation tool would leave the model no way to regain a family. The prompt-cache consequence recorded in the evaluation also stands: changing the active set per request churns the tools prefix, which is why this feature interacts with the still-open #2784.

    Standing this window down is a timing call, not a verdict on the report or on the feature. The fix path stays open to anyone: no open PR in the repository references this issue, so nothing is blocked, and a community PR in this seam is still the fastest route. If a maintainer wants a first-party patch instead, one reply here settling the family set and the option name is enough to get a spec and a PR generated against current main. The window closing only means the bot stops waiting. No action is needed from anyone.

    Automated by github-manager-bot

  4. ZYZ666-RGB commented on Sep 29, 2026

    @ZYZ666-RGB
    Contributor

    Hi, I'd like to contribute this feature. I can keep the current tool visibility as the default and add an opt-in HarnessAgent builder option with tests for inactive groups and activation. Before implementing the public API, could a maintainer confirm the desired tool families and option name, and assign the issue if this is available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/harnessenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions