Skip to content

gary149/shellagent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shell Command Agent

Caution

DO NOT RUN THIS APPLICATION! This tool automatically executes ANY shell command with your user permissions without confirmation. It can cause irreversible system damage. Use only in isolated test environments.

A Python-based tool that uses smolagents to execute shell commands based on natural language prompts.

Quick Start

This application uses LiteLLM to support various local LLM providers. For privacy and security, never use cloud-based LLMs as they could expose sensitive system information.

  1. Set up your preferred local LLM provider (LM Studio, Ollama, etc.)
  2. Install dependencies:
    pip install -r requirements.txt
  3. Run the application with your chosen model:
    python app.py "list files in current directory" --model provider/model-name

LM Studio Example

One way to run this tool is with LM Studio's local models:

  1. Download and install LM Studio
  2. Download the recommended Qwen2.5-Coder-14B-Instruct-GGUF model
  3. Start LM Studio's local inference server (default: http://localhost:1234/v1)
  4. Run commands using the lm_studio provider:
    python app.py "your prompt" --model lm_studio/qwen2.5-coder-14b-instruct

Note: The LM Studio API base URL is automatically set to http://localhost:1234/v1 but can be overridden:

export LM_STUDIO_API_BASE="http://localhost:1234/v1"

Usage Examples

Command Line Interface

# Organize Python files in a project directory
python app.py "create a 'python_files' directory and move all .py files into it, then show me the contents of both directories" --path ~/projects/my-python-project --model lm_studio/qwen2.5-coder-14b-instruct

# Find and analyze large files in Downloads
python app.py "find files larger than 100MB in the current directory, show their sizes in human readable format, and create a report.txt with this information" --path ~/Downloads --model lm_studio/qwen2.5-coder-14b-instruct

# Organize files by extension in Documents
python app.py "create separate directories for different file types (like images, documents, etc), move files into appropriate directories based on their extensions, then show the new structure" --path ~/Documents --model lm_studio/qwen2.5-coder-14b-instruct

Environment Variables

Project Structure

  • app.py: Command-line interface
  • shell_command_agent.py: Core agent implementation
  • example_usage.py: Example usage of the Python API

Dependencies

Contributing

Feel free to open issues or submit pull requests for improvements or bug fixes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages