2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

VScode Dev Containers上のAuto-GTPで非推奨オプション(EXECUTE_LOCAL_COMMANDS)による環境構築を試行(でもダメだった)

Posted at

概要

Auto-GTPで非推奨とされ、デフォルト無効になっているオプションEXECUTE_LOCAL_COMMANDSを有効化することで、「システムを作成する方法・コードの作成」だけでなく、「システムそのものの環境構築」まで出来ないか?と思ったので。
なので、Auto-gptでAgentGPTの導入を試行してみます。

しかし、どんなローカルコマンドが実行されるか影響不明なので、VScodeのDev Containersを使い、コンテナ上でAuto-gptを実行します。

環境構築

Docker・Dev Containersのセットアップ

  • こちらを参考に実施します。

Auto-gptをホストOSにGit Clone

  • ホストOS上で以下コマンドを実行し、Auto-gptを展開します。
git clone -b stable https://github.com/Significant-Gravitas/Auto-GPT.git

Dev Containersでコンテナ起動

  • VScodeで「ファイル」->「フォルダーを開く」を選択し、ホストOS上のクローンしたリポジトリの場所を開きます。
  • ポップアップの「Reopen in Container」を選択します。
    • ポップアップ出なかった場合、左下の「><」アイコンをクリックし、コマンドパレットから選択出来ます。
  • \Auto-GPT\.devcontainer\devcontainer.jsonの設定に従い、コンテナが起動します。
  • VSCodeのターミナルを見ると、クローンしたリポジトリがコンテナ上で起動出来ているようです。
vscode ➜ /workspaces/Auto-GPT (stable-0.2.2) $ ls
AutoGpt.json         Dockerfile          autogpt              docs              run.bat             tests
BULLETIN.md          LICENSE             azure.yaml.template  logs              run.sh              tests.py
CODE_OF_CONDUCT.md   README.md           benchmark            main.py           run_continuous.bat
CONTRIBUTING.md      ai_settings.yaml    data_ingestion.py    pyproject.toml    run_continuous.sh
CURRENT_BULLETIN.md  auto_gpt_workspace  docker-compose.yml   requirements.txt  scripts
  • ./run.shを実行することでAuto-gptを実行可能になりました。
    • run.batrun.shが提供されるようになってからpip install -r requirements.txtはスクリプトに内包されるようになっているため、不要です。

.envの修正(非推奨オプションの有効化)

  • .envから以下を変更し、ローカルでのコマンド実行を有効に変更します。
# EXECUTE_LOCAL_COMMANDS - Allow local command execution (Example: False)
EXECUTE_LOCAL_COMMANDS=true

実行

  • オプションを--continuous --continuous-limit 250で実行します。

パスがないエラー

AgentGPTのリポジトリのクローンを試みています。
ですが、パスがAuto-gptのWorkspace外だったのでエラー発生。

 THOUGHTS:  I think the first step should be to install AgentGPT in this container. I can use the 'clone_repository' command to clone the repository from the given URL and then install the agent using the instructions provided in the repository. Once the agent is installed, I can start it using the 'start_agent' command.
REASONING:  Installing AgentGPT is the first step in completing the task. Cloning the repository and following the instructions provided in the repository will ensure that the agent is installed correctly. Starting the agent using the 'start_agent' command will allow me to use it to complete the task.
PLAN: 
-  Clone the repository using the 'clone_repository' command
-  Follow the instructions provided in the repository to install the agent
-  Start the agent using the 'start_agent' command
CRITICISM:  I need to ensure that I follow the instructions provided in the repository carefully to ensure that the agent is installed correctly. I also need to make sure that I save any important information to files to avoid losing it due to my short-term memory limitations.
NEXT ACTION:  COMMAND = clone_repository ARGUMENTS = {'repository_url': 'https://github.com/AgentGPT/AgentGPT.git', 'clone_path': '/agentgpt'}
SYSTEM:  Command clone_repository returned: Error: Attempted to access path '/agentgpt' outside of workspace '/workspaces/Auto-GPT/auto_gpt_workspace'.

ディレクトリ作成を試行するもエラー

その後、Workspace内にフォルダを作成するべくかんばりますが、そもそもディレクトリ操作を行うコマンドがありません。

PLAN: 
-  Use the 'pwd' command to check the current working directory
-  Use the 'cd' command to change to a different directory if necessary
CRITICISM:  I need to ensure that I am in the correct location to clone the repository and that I have the necessary permissions to access the directory and its contents. I also need to make sure that I save any important information to files to avoid losing it due to my short-term memory limitations.
NEXT ACTION:  COMMAND = pwd ARGUMENTS = {}
SYSTEM:  Command pwd returned: Unknown command 'pwd'. Please refer to the 'COMMANDS' list for available commands and only respond in the specified JSON format.
 THOUGHTS:  I need to clone the repository to a directory within the workspace. I can use the 'ls' command to check the contents of the current directory and the 'mkdir' command to create a new directory within the workspace. Once the directory is created, I can use the 'cd' command to change to the new directory and then use the 'clone_repository' command to clone the repository.
REASONING:  Cloning the repository to a directory within the workspace will allow me to access the files and follow the instructions provided in the repository. Creating a new directory within the workspace will ensure that I have the necessary permissions to access the directory and its contents.

まとめ

  • Dev Containers を利用するより、ゲストOS用意してやったほうがよさそう。
    • devcontainer.jsonfeatures:を修正すれば動きはするものの、全然自動化になっていないので。
2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?