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

PyPI Changelog Tests 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:

llm install llm-tools-execute-shell

Usage

To run a single prompt:

llm --tool execute_shell "What's the current date and time?" --tools-debug

To run in chat mode:

$ llm chat --tool execute_shell --tools-debug
...
> My req.py script is broken. Can you run it and fix the error?
...
LLM wants to run command: 'python req.py'

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

Tool call: execute_shell({'command': 'python req.py'})
  Traceback (most recent call last):
    File "/tmp/foo/req.py", line 1, in <module>
      import requests
  ModuleNotFoundError: No module named 'requests'

LLM wants to run command: 'pip install requests'

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

Tool call: execute_shell({'command': 'pip install requests'})
...
LLM wants to run command: 'python req.py'

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

Tool call: execute_shell({'command': 'python req.py'})
  {'origin': 'success'}

It looks like the `req.py` script was failing because the `requests` module was not installed. I've installed it for you, and now the script runs successfully.

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.1.tar.gz (7.8 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.1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: llm_tools_execute_shell-0.1.1.tar.gz
  • Upload date:
  • Size: 7.8 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.1.tar.gz
Algorithm Hash digest
SHA256 4bd775726e18ffb977b84f7d238e07f8e1b2e1be906810d25810139c573d585c
MD5 032321d998462a3f937c0abfda97f16f
BLAKE2b-256 8d5f9be10aa3610f9353ce16f90dd542ae8b67fd6622bf40a2550ba5d3cae9bf

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_tools_execute_shell-0.1.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for llm_tools_execute_shell-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4263f655cb89eaaa4ef3910b48884f2138fb81a23d0a5879c811c65f1214b17d
MD5 1e8bdd8bbe51a8980fa0a74e925fac1d
BLAKE2b-256 7c692e130ae240843287fd80a9bff3fcc82a8c638dd0a5cf6092ee85412601e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for llm_tools_execute_shell-0.1.1-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