Skip to content

[Bug]:Shared tool becomes unavailable in previous skills when registered to multiple skills in SkillBox #671

@liaorongshang

Description

@liaorongshang

Describe the bug
When registering the same tool instance (e.g., odpsQueryTool) to multiple skills within the same SkillBox, only the last skill registered can successfully access and use the tool. The previous skills that were supposed to have the same tool lose access to it, or the tool becomes unavailable during execution for those skills.

To Reproduce
Steps to reproduce the behavior:

Create a SkillBox and a tool instance (e.g., odpsQueryTool).
Iterate through a list of skills and register the same tool instance to multiple skills using the following code pattern:

SkillBox skillBox = new SkillBox();
if (CollectionUtils.isNotEmpty(skills)) {
    for (AgentSkill skill : skills) {
        if (skill.getName().equalsIgnoreCase("competitor-search") || 
            skill.getName().equalsIgnoreCase("customer-feedback-search")) {
            // Registering the same odpsQueryTool to different skills
            skillBox.registration()
                    .skill(skill)
                    .toolkit(toolkit)
                    .tool(odpsQueryTool)
                    .apply();
        }
    }
}

Execute the first skill ("competitor-search") that requires the tool.
Observe that the tool is missing or fails to be invoked for the first skill, while the second skill ("customer-feedback-search") works fine.
Expected behavior
A single tool instance should be allowed to be registered across multiple skills. When an agent invokes any of the registered skills, the shared tool should be available and functional regardless of the order of registration.

Expected: LLM identifies the tool call but the framework fails to locate the tool implementation for the first skill.

Environment (please complete the following information):

AgentScope-Java Version: [1.0.7]
Java Version: [17]
OS: [MacOS]
Additional context
It seems like the toolkit().tool().apply() chain might be overwriting the tool's context or mapping within the SkillBox, or perhaps the tool instance maintains a state that only points to its last registered parent skill.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions