refactor(core): refactor toolkit and skillBox registration#377
Merged
AlbumenJ merged 6 commits intoagentscope-ai:mainfrom Dec 29, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the toolkit and skillBox registration mechanism to improve validation handling. The key change moves validation logic from individual setter methods to the apply() method using a counter-based approach, allowing multiple tool types to be set before validation occurs at application time.
- Introduces a
toolCountcounter inToolkit.ToolRegistrationto track the number of non-null tool types set - Defers validation to the
apply()method instead of checking immediately in each setter - Simplifies SkillBox registration by delegating validation to Toolkit
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
| agentscope-core/src/main/java/io/agentscope/core/tool/Toolkit.java | Refactored validation logic from setter methods to apply() using toolCount counter; removed immediate validation checks from tool(), agentTool(), mcpClient(), and subAgent() methods |
| agentscope-core/src/main/java/io/agentscope/core/skill/SkillBox.java | Simplified apply() method to pass all tool types to toolkit registration; updated error message |
| agentscope-core/src/test/java/io/agentscope/core/tool/ToolkitTest.java | Added comprehensive tests for multiple tool type validation and empty registration scenarios |
| agentscope-core/src/test/java/io/agentscope/core/skill/SkillBoxTest.java | Removed redundant tests that are now covered by ToolkitTest since validation moved to Toolkit |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
agentscope-core/src/main/java/io/agentscope/core/skill/SkillBox.java
Outdated
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/skill/SkillBox.java
Outdated
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/tool/Toolkit.java
Outdated
Show resolved
Hide resolved
agentscope-core/src/test/java/io/agentscope/core/tool/ToolkitTest.java
Outdated
Show resolved
Hide resolved
Contributor
Author
|
CI failed reason is not related to this PR |
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
AlbumenJ
requested changes
Dec 28, 2025
agentscope-core/src/main/java/io/agentscope/core/tool/Toolkit.java
Outdated
Show resolved
Hide resolved
fc0283f to
129fd7b
Compare
AlbumenJ
approved these changes
Dec 29, 2025
JGoP-L
pushed a commit
to JGoP-L/agentscope-java
that referenced
this pull request
Dec 29, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AgentScope-Java Version
1.0.4
Description
Refactor toolkit and skillBox registration
Now, for the situation where multiple tools are registered simultaneously, an error occurs when apply().
Passing in an empty value is no longer regarded as a valid call.
Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)