Skip to main content

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:

  1. Directory Restriction: All commands execute within SHELL_ALLOWED_DIRECTORY
  2. Forbidden Commands: Dangerous commands are blocked by default
  3. Path Traversal Protection: Blocks ../ and similar patterns
  4. No Shell Expansion: Commands execute without dangerous shell interpretation
  5. Timeout Protection: Commands auto-terminate after timeout

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elizaos_plugin_shell-2.0.0a4.tar.gz (45.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

elizaos_plugin_shell-2.0.0a4-py3-none-any.whl (42.7 kB view details)

Uploaded Python 3

File details

Details for the file elizaos_plugin_shell-2.0.0a4.tar.gz.

File metadata

  • Download URL: elizaos_plugin_shell-2.0.0a4.tar.gz
  • Upload date:
  • Size: 45.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.2

File hashes

Hashes for elizaos_plugin_shell-2.0.0a4.tar.gz
Algorithm Hash digest
SHA256 550feeafadf289aa9f27a77564995b83b39119b5f1bbc97d1d6f0bc6f89e515e
MD5 56aa97933c381d4cdf8e93a54de82240
BLAKE2b-256 20282776a61c21bde84796800908a758040225a62ec42492d1571c262198c14a

See more details on using hashes here.

File details

Details for the file elizaos_plugin_shell-2.0.0a4-py3-none-any.whl.

File metadata

File hashes

Hashes for elizaos_plugin_shell-2.0.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 0b756d9a72031d7a03c0b325808327f66dccd6bec80060db0fc30112996d3945
MD5 60b17b0d3d5ab06778fafa1d7b2cc529
BLAKE2b-256 35abf01e8efebf81da29e96edd6c0aa0e516e6b427c26bbf78fadd2c10c36cb5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page