Skip to content

feat(harness): allow disabling general-purpose subagent - #2354

Open
logicwu0 wants to merge 1 commit into
agentscope-ai:mainfrom
logicwu0:fix/2340-disable-general-purpose-subagent
Open

feat(harness): allow disabling general-purpose subagent#2354
logicwu0 wants to merge 1 commit into
agentscope-ai:mainfrom
logicwu0:fix/2340-disable-general-purpose-subagent

Conversation

@logicwu0

Copy link
Copy Markdown
Contributor

AgentScope-Java Version

2.0.1-SNAPSHOT

Description

HarnessAgent always registers the built-in general-purpose subagent when subagent support is enabled. This can interfere with explicitly declared subagents by allowing the built-in agent to handle tasks intended for them.

This change adds disableGeneralPurposeSubagent() to disable only the built-in entry while keeping programmatic, workspace-defined, and custom subagents available. Both static and dynamic subagent registration paths honor the new option.

Fixes #2340

Checklist

  • Code has been formatted with mvn spotless:apply
  • All relevant tests are passing
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated
  • Code is ready for review

@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@oss-maintainer oss-maintainer left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review: PR #2354 — feat(harness): allow disabling general-purpose subagent

Verdict: Approved ✅

Adds a disableGeneralPurposeSubagent() builder method that allows users to opt out of the built-in general-purpose subagent while keeping declared and custom subagents available.

Changes:

  • New boolean flag disableGeneralPurposeSubagent in the Builder
  • Conditional registration in buildSubagentEntries() and buildStaticSubagentEntries() — the general-purpose entry is skipped when the flag is set
  • Test coverage verifies the flag works correctly

Useful for users who want to restrict subagent capabilities to only explicitly declared ones, reducing the attack surface and resource usage.

All CI checks pass.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: HarnessAgent注入的子agent是自行build出来的HarnessAgent,会默认注入自带的general-purpose

2 participants