feat(tool): add shell command build-in tool#270
Merged
AlbumenJ merged 22 commits intoagentscope-ai:mainfrom Dec 25, 2025
Merged
feat(tool): add shell command build-in tool#270AlbumenJ merged 22 commits intoagentscope-ai:mainfrom
AlbumenJ merged 22 commits intoagentscope-ai:mainfrom
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
AlbumenJ
requested changes
Dec 22, 2025
agentscope-core/src/main/java/io/agentscope/core/tool/coding/ShellCommandTool.java
Show resolved
Hide resolved
b0e2775 to
d84e521
Compare
d84e521 to
fa2aaa7
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new built-in Shell Command Tool that enables agents to execute shell commands with comprehensive security features and cross-platform support. The implementation includes command whitelisting, user approval callbacks, timeout management, and platform-specific validators for Windows and Unix-like systems.
Key changes:
- Added
ShellCommandToolwith security validation, timeout control, and cross-platform command execution - Implemented platform-specific validators (
UnixCommandValidatorandWindowsCommandValidator) to handle OS-specific command separators and patterns - Added comprehensive test coverage with 1,284 lines of tests covering various scenarios including timeouts, security validation, and edge cases
- Updated documentation in both English and Chinese with detailed usage examples, security warnings, and feature descriptions
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 17 comments.
Show a summary per file
| File | Description |
|---|---|
docs/zh/task/tool.md |
Added comprehensive Chinese documentation for the Shell Command Tool, including usage examples, security features, and configuration options |
docs/en/task/tool.md |
Added English documentation for the Shell Command Tool with security notices and usage examples |
agentscope-core/src/main/java/io/agentscope/core/tool/coding/ShellCommandTool.java |
Core implementation of the shell command execution tool with security validation, timeout handling, and cross-platform support |
agentscope-core/src/main/java/io/agentscope/core/tool/coding/CommandValidator.java |
Interface defining the contract for command validation with ValidationResult inner class |
agentscope-core/src/main/java/io/agentscope/core/tool/coding/UnixCommandValidator.java |
Unix/Linux/macOS-specific command validator implementing whitelist checking and multiple command detection |
agentscope-core/src/main/java/io/agentscope/core/tool/coding/WindowsCommandValidator.java |
Windows-specific command validator with Windows path and extension handling (.exe, .bat, .cmd) |
agentscope-core/src/test/java/io/agentscope/core/tool/coding/ShellCommandToolTest.java |
Comprehensive test suite with 1,284 lines covering command execution, security validation, timeouts, and cross-platform scenarios |
agentscope-core/src/test/java/io/agentscope/core/tool/coding/WindowsCommandValidatorTest.java |
Detailed tests for Windows command validator covering executable extraction, extension handling, and validation logic |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
agentscope-core/src/main/java/io/agentscope/core/tool/coding/ShellCommandTool.java
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/tool/coding/CommandValidator.java
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/tool/coding/WindowsCommandValidator.java
Outdated
Show resolved
Hide resolved
agentscope-core/src/test/java/io/agentscope/core/tool/coding/ShellCommandToolTest.java
Outdated
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/tool/coding/ShellCommandTool.java
Outdated
Show resolved
Hide resolved
agentscope-core/src/main/java/io/agentscope/core/tool/coding/ShellCommandTool.java
Show resolved
Hide resolved
AlbumenJ
approved these changes
Dec 25, 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-SNAPSHOT
Description
relate to #92, This is the built-in tool that enables the complete functionality of the skill and allows the execution of resources.
Checklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test)