Skip to content

fix(harness): activate skill-bound tool groups on skill load - #2662

Open
StevenZhang2002 wants to merge 3 commits into
agentscope-ai:mainfrom
StevenZhang2002:fix/2653-tool-disclosure
Open

fix(harness): activate skill-bound tool groups on skill load#2662
StevenZhang2002 wants to merge 3 commits into
agentscope-ai:mainfrom
StevenZhang2002:fix/2653-tool-disclosure

Conversation

@StevenZhang2002

@StevenZhang2002 StevenZhang2002 commented Aug 11, 2026

Copy link
Copy Markdown

AgentScope-Java Version

2.0.3-SNAPSHOT

Description

SkillLoadTool now activates SkillToolGroups bound via activateOnSkill whenever a skill resource loads successfully, matching the core SkillToolFactory semantics so HarnessAgent exposes the tools on demand. SkillRuntime injects the agent toolkit into the load tool and binds it to the call-scoped RuntimeContext.

Background

Issue #2653: HarnessAgent (Skill + ToolGroup: on-demand tool disclosure) not work. When a skill declares tool groups via activateOnSkill, loading the skill through HarnessAgent's SkillLoadTool only returned the resource text but never activated the bound SkillToolGroups, so the model could not see or call those tools. The core skill access tool (SkillToolFactory.activateSkill, used by ReActAgent) already performed this activation — the harness implementation was missing it.

Changes made

  • SkillLoadTool: after a skill resource loads successfully (SKILL.md / in-memory / lazy), resolves the agent toolkit and activates every inactive SkillToolGroup bound via activateOnSkill (new toolkitFor / activateSkillTools helpers). Activation failures are logged as warnings and never block resource delivery.
  • SkillRuntime: keeps an AtomicReference<Toolkit> refreshed in prepareToolkit, and binds the live toolkit into the call-scoped RuntimeContext in install, so the load tool can reach the actual agent toolkit.
  • SkillLoadToolToolGroupActivationTest (new): verifies that loading a skill activates the associated skill-bound tool group, and that its tools become visible afterwards.

How to test

mvn test -pl agentscope-harness -Dtest=SkillLoadToolToolGroupActivationTest

Fixes #2653

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has been formatted with mvn spotless:apply
  • All tests are passing (mvn test)
  • Javadoc comments are complete and follow project conventions
  • Related documentation has been updated (e.g. links, examples, etc.)
  • Code is ready for review

SkillLoadTool now activates SkillToolGroups bound via activateOnSkill
whenever a skill resource loads successfully, matching the core
SkillToolFactory semantics so HarnessAgent exposes the tools on demand.
SkillRuntime injects the agent toolkit into the load tool and binds it
to the call-scoped RuntimeContext.

Fixes agentscope-ai#2653
Fix the duplicated 'either,' typo in the Apache-2.0 license header of
SkillLoadToolToolGroupActivationTest so the license check passes.
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 88.09524% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...ope/harness/agent/skill/runtime/SkillLoadTool.java 86.84% 2 Missing and 3 partials ⚠️

📢 Thoughts on this report? Let us know!

Add tests for SkillLoadTool covering the shared toolkit fallback
when no toolkit is present in the RuntimeContext, defensive success
when no toolkit is reachable, and resilience when tool group
activation throws.

Fixes agentscope-ai#2653
@AgentScopeJavaBot AgentScopeJavaBot added bug Something isn't working area/harness agentscope-harness (test/runtime support) labels Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/harness agentscope-harness (test/runtime support) bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

HarnessAgent (Skill + ToolGroup: on-demand tool disclosure) not work

2 participants