feat(skill): refactor code execution API with builder pattern#646
Conversation
- Replace enableCodeExecution() with fluent builder API - Support selective tool enabling and ShellCommandTool customization - Add cross-platform tests (Unix/Mac + Windows) - Update documentation with new API examples BREAKING CHANGE: enableCodeExecution() methods removed, use codeExecution().enable() instead
Summary of ChangesHello @fang-tech, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the code execution capabilities within the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a significant improvement by refactoring the code execution API to use a fluent builder pattern. This change enhances flexibility, allowing for selective tool enabling and custom configurations, which is a great step forward. The code is well-structured, and the accompanying tests are thorough, covering various new scenarios including cross-platform behavior. The documentation has also been updated to reflect these changes. I've identified a potential security inconsistency regarding the sandboxing behavior of the configured tools and a couple of minor areas for improvement in code comments and documentation for better clarity and maintainability.
agentscope-core/src/main/java/io/agentscope/core/skill/SkillBox.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR refactors the code execution API from simple method calls to a fluent builder pattern, providing more flexibility for configuring code execution capabilities.
Changes:
- Replaced
enableCodeExecution()methods with a fluent builder API accessible viacodeExecution() - Added three new getter methods to
ShellCommandTool(getApprovalCallback(),getCommandValidator(),getBaseDir()) to support cloning with workDir override - Introduced comprehensive cross-platform tests for base directory enforcement and getter methods
- Updated documentation with new API examples in both English and Chinese
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| agentscope-core/src/main/java/io/agentscope/core/skill/SkillBox.java | Replaced enableCodeExecution methods with CodeExecutionBuilder nested class implementing fluent builder pattern with selective tool enabling |
| agentscope-core/src/main/java/io/agentscope/core/tool/coding/ShellCommandTool.java | Added three getter methods to enable tool configuration inspection and cloning |
| agentscope-core/src/test/java/io/agentscope/core/skill/SkillBoxTest.java | Updated all tests to use new builder API and added comprehensive tests for builder features including replacement, selective enabling, and custom tool cloning |
| agentscope-core/src/test/java/io/agentscope/core/tool/coding/ShellCommandToolTest.java | Added new test suites for getter methods and cross-platform base directory enforcement |
| docs/zh/task/agent-skill.md | Added Feature 2 section documenting code execution capabilities with builder pattern examples |
| docs/en/task/agent-skill.md | Added Feature 2 section documenting code execution capabilities with builder pattern examples |
💡 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/skill/SkillBox.java
Outdated
Show resolved
Hide resolved
agentscope-core/src/test/java/io/agentscope/core/skill/SkillBoxTest.java
Outdated
Show resolved
Hide resolved
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…cope-ai#646) ## AgentScope-Java Version 1.0.7 ## Description - Replace enableCodeExecution() with fluent builder API - Support selective tool enabling and ShellCommandTool customization - Add cross-platform tests (Unix/Mac + Windows) - Update documentation with new API examples **BREAKING CHANGE**: enableCodeExecution() methods removed, use codeExecution().enable() instead ## Checklist Please check the following items before code is ready to be reviewed. - [x] Code has been formatted with `mvn spotless:apply` - [x] All tests are passing (`mvn test`) - [x] Javadoc comments are complete and follow project conventions - [x] Related documentation has been updated (e.g. links, examples, etc.) - [x] Code is ready for review
AgentScope-Java Version
1.0.7
Description
BREAKING CHANGE: enableCodeExecution() methods removed, use codeExecution().enable() instead
Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)