elizaOS Shell Plugin - Shell command execution with directory restrictions and history tracking
Project description
elizaOS Shell Plugin (Python)
A secure shell command execution plugin for elizaOS that allows agents to run terminal commands within a restricted directory with command history tracking.
Installation
pip install elizaos-plugin-shell
Features
- Cross-platform support: Works on Linux, macOS, and Windows
- Directory restriction: Commands are restricted to a specified directory for safety
- Command filtering: Configurable list of forbidden commands
- Timeout protection: Automatic termination of long-running commands
- Command history: Tracks command execution history per conversation
- File operation tracking: Monitors file creation, modification, and deletion
- Type safe: Full type annotations with Pydantic models
Configuration
Set the following environment variables:
# Set the allowed directory (commands can only run here)
SHELL_ALLOWED_DIRECTORY=/path/to/safe/directory
# Optional: Set custom timeout in milliseconds (default: 30000)
SHELL_TIMEOUT=60000
# Optional: Add additional forbidden commands (comma-separated)
SHELL_FORBIDDEN_COMMANDS=rm,mv,cp,chmod,chown,shutdown,reboot
Usage
from elizaos_plugin_shell import ShellService, ShellConfig
# Load configuration
config = ShellConfig.from_env()
# Create service
service = ShellService(config)
# Execute a command
result = await service.execute_command("ls -la", conversation_id="conv-123")
if result.success:
print(f"Output: {result.stdout}")
else:
print(f"Error: {result.stderr}")
# Get command history
history = service.get_command_history("conv-123", limit=10)
# Clear history
service.clear_command_history("conv-123")
Security
The plugin enforces several security measures:
- Directory Restriction: All commands execute within
SHELL_ALLOWED_DIRECTORY - Forbidden Commands: Dangerous commands are blocked by default
- Path Traversal Protection: Blocks
../and similar patterns - No Shell Expansion: Commands execute without dangerous shell interpretation
- Timeout Protection: Commands auto-terminate after timeout
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file elizaos_plugin_shell-2.0.0a5.tar.gz.
File metadata
- Download URL: elizaos_plugin_shell-2.0.0a5.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a95a3fafd22cfa409b3783784e8c4cebe83558baff007609b42bce2dc033b43d
|
|
| MD5 |
90de39723b0fffcbcab7fe62158cea6c
|
|
| BLAKE2b-256 |
3c1828d0c5c9d58e979826944e3273cb9a0f8f6ad74193065b0a522cf92ae92c
|
File details
Details for the file elizaos_plugin_shell-2.0.0a5-py3-none-any.whl.
File metadata
- Download URL: elizaos_plugin_shell-2.0.0a5-py3-none-any.whl
- Upload date:
- Size: 16.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bd062903b2c63d416e80f3c2d11b6130d40e6e949894d3743a38ca6d7a0965e
|
|
| MD5 |
f23f7b76416a909e9886d385dde736a3
|
|
| BLAKE2b-256 |
d5de31dacf99fcfe950a7d6d05a3458df4208a5bd27723de6f3f53240e8380e4
|