Skip to main content

A task runner powered by OpenAI and Docker.

Project description

botsh

PyPI version

botsh is a task runner powered by OpenAI and Docker.

Invoke botsh by providing a task as a command line argument.

botsh will create a bare Ubuntu Docker container associated with the current directory, or create one if one does not exist. botsh will then attach the OpenAI API to a shell running in the container to attempt to complete the given task.

The AI is explicitly told that it is allowed to install software, and will typically install programs as needed to complete its task. Installed software remains confined to the container.

Setup

Install with:

pip install botsh

botsh expects an OpenAI API key to be provided as the OPENAI_API_KEY environment variable.

botsh also requires Docker to be running on the system.

Examples

# botsh "convert cat.jpg into a png file"

# botsh "use a remote service to find my public ip and base64 encode it"

# botsh "run pylint on the codebase in src/"

Observations

These observations relate to the default model, text-davinci-003. Using GPT-4 may improve things.

  • It works best if you explicitly specify the files/paths you want to work with (use relative references). It is not good at figuring out what you mean.
  • It often gets stuck in loops if it can't complete a task rather than giving up, despite the prompt telling it not to.

Container re-use

When botsh is invoked, the current working directory is mounted into the container and can be modified by programs the agent runs. The filesystem outside of the current working directory is sealed off from the container.

Each directory that you run botsh in will get its own container, which is reused for future invocations of botsh in that container.

You can pass --wipe to discard the existing container and start a new one before running your task. You can also pass --rm to remove a container at the end of your task.

Containers are also removed if you purge containers in Docker with docker container prune

Usage

usage: botsh [-h] [--max-rounds MAX_ROUNDS] [--model MODEL] [--image IMAGE] [--shell-command SHELL_COMMAND] [--save-transcript] [--wipe] prompt

Task runner powered by OpenAI and Docker. Invoke botsh by providing a task as a command line argument. botsh will create a bare Ubuntu Docker container associated with the current directory, or create one if one does not exist. botsh will then attach the OpenAI API to a shell running in the container to attempt to complete the given task.

positional arguments:
  prompt                Prompt to execute.

options:
  -h, --help            show this help message and exit
  --max-rounds MAX_ROUNDS
  --model MODEL         OpenAI text completion model to use.
  --image IMAGE         Docker image to use.The current hard-coded prompt works for Debian-derived distributions.
  --shell-command SHELL_COMMAND
                        Shell to invoke within the container.
  --save-transcript     Save transcript to file
  --wipe                Start with a fresh container even if one exists for this directory.

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

botsh-0.1.3.tar.gz (37.2 kB view details)

Uploaded Source

File details

Details for the file botsh-0.1.3.tar.gz.

File metadata

  • Download URL: botsh-0.1.3.tar.gz
  • Upload date:
  • Size: 37.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for botsh-0.1.3.tar.gz
Algorithm Hash digest
SHA256 be025f064913baac96254d3352f374038bd3b0ebfc7a58bb6d7f416b4be578e4
MD5 0c4e9e2a1f059df984dc53e05bb1f473
BLAKE2b-256 e23dba2240b239dc7a33116f2537acaaa1944a77b195474fcc325efa7996ba5f

See more details on using hashes here.

Provenance

Supported by

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