Create a flexible command loop / modular architecture
muellerberndt opened this issue · 0 comments
Instead of only writing and executing code once, create a loop that allows the agent to execute multiple commands (as received by GPT) that map to Python functions. To do this, we should create a standard interface (it's probably best to use a JSON format as Auto-GPT - investigate this). The loop should work as follows:
- The agent prompts GPT for the next command;
- GPT responded with the desired command and the command arguments;
- Agent executes the command and sends the command output, along with a query for the next command, to GPT (repeat in a loop).
The JSON request could look as follows (example - feel free to improve on this):
{"command": {
"name:" "write_and_execute",
"args": [
"code": "(escaped_code)",
"filename": "agent.py"
}}
Note that this is similar to how Auto-GPT and babyAGI work, however, we have to keep the code as compact as possible and in a single file to allow for easy self-replication.
For this ticket, implement only a single command named WRITE_EXEC(code)
or similar that writes code to a file, forks a new process, and executes the updated code (exactly like it is currently done).