Skip to main content

A tool plugin for LLM to enable executing shell commands on the user's system.

Project description

llm-tools-execute-shell

License

A tool plugin for LLM that allows you to execute arbitrary shell commands suggested by the LLM.

This tool can be dangerous, and for this reason, this tool prompts for confirmation before running each command. Review all commands carefully before authorizing.

Installation

Install this plugin in the same environment as LLM.

First, clone the repository:

git clone https://github.com/jthometz/llm-tools-execute-shell.git

Then, install the local plugin using llm install -e:

llm install -e path/to/llm-tools-execute-shell

Usage

To run a single prompt:

 llm -T execute_shell "What's the current date and time?" --td

**************************************************************************
* WARNING: The LLM is requesting to execute the following shell command. *
* REVIEW IT CAREFULLY. Executing unintended commands can be dangerous    *
* and may end in disaster, like wiping your entire disk. Do not run any  *
* command if you do not know exactly what it does.                       *
**************************************************************************

'date'

Are you sure you want to run the above command? (y/n): y

Tool call: execute_shell({'command': 'date'})
  Mon Jun  9 07:23:59 AM JST 2025

The current date and time is Mon Jun 9 07:23:59 AM JST 2025.

To run in chat mode:

$ llm chat -T execute_shell --td
...
> How many words are in foo.txt?
...
'cat foo.txt | wc -w'
Are you sure you want to run the above command? (y/n): y
Tool call: execute_shell({'command': 'cat foo.txt | wc -w'})
  35

There are 35 words in `foo.txt`.

> How many lines?
...
'cat foo.txt | wc -l'
Are you sure you want to run the above command? (y/n): y
Tool call: execute_shell({'command': 'cat foo.txt | wc -l'})
  6

There are 6 lines in `foo.txt`.
>

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd llm-tools-execute-shell
python -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

python -m pip install -e '.[test]'

To run the tests:

python -m pytest

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

llm_tools_execute_shell-0.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

llm_tools_execute_shell-0.1.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file llm_tools_execute_shell-0.1.0.tar.gz.

File metadata

  • Download URL: llm_tools_execute_shell-0.1.0.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for llm_tools_execute_shell-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1e644a4a4c349a3500cec1301bc4a64819466197ccf0e9f8853ae47b555800ab
MD5 b7c51150213df65fa8970613b207f505
BLAKE2b-256 3db78ff989cf3d6e24b47fc020ea59b8ca128393fc1f91b24d2a2dd3fd9dd5cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_tools_execute_shell-0.1.0.tar.gz:

Publisher: publish.yml on jthometz/llm-tools-execute-shell

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file llm_tools_execute_shell-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_tools_execute_shell-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 366646f31572081b98c240170a835ab76ff852b6044e997bddeaf0d7e651626a
MD5 13798dcb0521aa3f4bad4d032d763530
BLAKE2b-256 4bb8821122a7ee9232de4cd0c8563451f1dfb6585e831796f5f0e29e8cee607b

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_tools_execute_shell-0.1.0-py3-none-any.whl:

Publisher: publish.yml on jthometz/llm-tools-execute-shell

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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