SuperAPI AI Directory

BabyCommandAGI

BabyCommandAGI is an open-source project based on BabyAGI, aimed at exploring the potential of combining a command-line interface (CLI) with large language models (LLMs). By having the LLM converse with the CLI, it automatically executes and plans tasks, enabling scenarios such as automatic programming and environment setup. Users need to configure a Claude or OpenAI API key and run it in a Docker environment. The system is currently in an early stage and may loop execution or damage the environment; it is recommended to use it in a virtual environment and to be mindful of API costs.

Open website

About this tool

BabyCommandAGI is an experimental project designed to test what happens when a command-line interface (CLI) is combined with a large language model (LLM). The CLI is an older computer interaction interface than the graphical user interface (GUI), and many computer operations can still be performed through the CLI. This project is based on BabyAGI, uses the latest LLM API, imagines the LLM conversing with the CLI, and explores possible new use cases.

Main Capabilities

BabyCommandAGI is designed to automatically execute tasks through a continuous loop. Its workflow is as follows: pull the next task from the task list (initially a planning task); determine whether the task is a command task or a planning task; if it is a command task, execute the command, and if the execution result status code is 0 (success), continue; otherwise (failure), use the LLM to analyze the execution history and create a new task list based on the objective (OBJECTIVE); if it is a planning task, use the LLM to plan based on the planning task, execution history, and objective and create a new task list; if the user provides feedback, plan and create a new task list based on the objective, execution history, and feedback.

The project supports Claude 3.7 Sonnet (including extended thinking) and o3-mini-hight (OpenRouter). Claude 3.7 Sonnet or higher is recommended, as it has been verified with it. If using GPT-4 Turbo, it is recommended to use the older BabyCommandAGI v3.

Known useful cases include: automatic programming (automatically creating applications with only feedback, such as Reversi and Snake games); automatic environment setup (installing Flutter in a Linux container environment, creating a Flutter application, starting a web server, and making it accessible from outside the container); obtaining weather forecasts.

Usage

Installation steps:

  1. Clone the repository:git clone https://github.com/saten-private/BabyCommandAGI.git
  2. Enter the directory:cd BabyCommandAGI
  3. Create the environment variable file:cp .env.example .env
  4. Set ANTHROPIC_API_KEY(if using an OpenAI model, set OPENAI_API_KEY)
  5. (Optional) Set the objective of the task management system to the OBJECTIVE variable.

Execution (Docker):

  • Prerequisite: docker and docker-compose need to be installed. The simplest way is Docker Desktop (https://www.docker.com/products/docker-desktop/)。
  • Note: Even if you exit with Ctrl+C, it will not stop unless you run docker-compose stop or ./clean.sh.
  • Note: If the objective cannot be achieved, the agent may loop indefinitely; please be mindful of Anthropic and OpenAI API usage costs.
  • AI-generated items will be created in the workspace folder.
  • If it fails, you can run it again to resume from where it left off.
  • Changing OBJECTIVE will clear the future task list and OBJECTIVE feedback.
  • Entering "f" allows you to provide the AI with user feedback about OBJECTIVE , which allows the AI to obtain information unavailable to the CLI (such as the GUI).
  • Answering while the AI is executing a command: usually the AI cannot answer "y" or "n" to a command being executed, but entering "a" allows you to enter answer mode. (If a shell command waits for a "y" or "n" answer for more than 5 minutes, and the LLM deems it appropriate, the LLM will automatically answer "y" or "n" based on the situation at that time.)

Useful commands:

  • workspace: Reset the environment (container)../new_store.sh Also do this.
  • ./backup_workspace.sh: Back up the workspace by creating a folder named with the current time in workspace_backup. (Note: The environment (container) and BabyCommandAGI data will not be backed up.)
  • New BabyCommandAGI data (memory information) will be created. Because it switches to new data, BabyCommandAGI will not remember anything.

Logs: Logs during execution are saved under the log folder. The log file name is determined by the OBJECTIVE identifier and RESULTS_STORE_NAME . The following are saved to the executed point:

  • The task executed up to a certain point is saved under the data folder.
  • The last current directory is under the pwd folder.
  • The last environment variable dump is under the env_dump folder.

Applicable Scenarios and Limitations

Applicable scenarios: automatic programming, automatic environment setup, obtaining information (such as weather forecasts), etc.

Limitations and notes:

  • It may unintentionally damage the environment. Basically, please run it in a virtual environment (such as Docker).
  • It may fail to reach the goal and continue looping. (In such cases, API usage may increase, so please use it responsibly.)
  • This project is still in an early stage, and its direction and implementation steps are being determined. Currently, simplicity is pursued. When submitting a PR, please follow this: focus on small, modular fixes rather than large-scale refactoring; when introducing new features, provide detailed explanations corresponding to specific use cases.
  • Author's note (May 21, 2023): The author is not used to contributing to open source, has another job during the day, and may not be able to check PRs and issues frequently, but values this idea and hopes it will be useful to everyone. The author is a beginner, does not speak English, and has limited knowledge of cultures outside Japan.

Other Information

GitHub Sponsors: Project maintenance relies on sponsors. You can become a sponsor for $5 per month.

The official text of this project also includes some Twitter link examples (such as Reversi, Snake game, Flutter environment setup, obtaining weather forecasts), but they are not listed one by one here.