shell tool allows agents to execute shell commands in the workspace directory with comprehensive security controls.
Overview
The Shell tool provides:- Command execution with 60-second timeout
- Output size limits (1MB max)
- Environment variable filtering
- Security policy validation
- Syscall anomaly detection (optional)
- Cross-platform support (Linux, macOS, Windows)
Parameters
The shell command to execute. Validated against security policy.
Example
Response
Combined stdout and stderr from the command execution
Command exit code (0 for success)
Security
The shell tool enforces multiple security layers:Command Validation
Command Validation
Commands are validated against:
- Blocked command patterns (rm -rf /, dd, mkfs, etc.)
- Dangerous flag combinations
- Path traversal attempts
- Network access restrictions (when configured)
Environment Variables
Environment Variables
Only safe environment variables are passed:
- PATH, HOME, TERM, LANG, USER, SHELL
- Windows: USERPROFILE, SYSTEMROOT, TEMP
- Custom additions via
shell_env_passthroughconfig - Never passes API keys or credentials
Execution Limits
Execution Limits
- Timeout: 60 seconds hard limit
- Output: 1MB maximum (truncated if exceeded)
- Working Directory: Scoped to workspace
- Syscall Monitoring: Optional anomaly detection
Configuration
Configure shell tool behavior inconfig.toml:
Source Code
Implementation:src/tools/shell.rs