AutoGPT is an open source app that uses ChatGPT and several other plugin based modules to carry out every step needed to achieve a goal. AutoGPT is capable of interacting with 3rd party software and services both external such as the web and APIs and internal like spreadsheet apps.
- AutoGPT vs ChatGPT
- Installing Locally
- AutoGPT Prompt Engineering
- Create AutoGPT Plugins
- AutoGPT Use Cases
- Conclusion
AutoGPT vs ChatGPT
AutoGPT is a Python application developed by Significant Gravitas that is built on OpenAI’s GPT framework. It’s features include:
- 🌐 Internet access for searches and information gathering
- 💾 Long-term and short-term memory management
- 🧠 GPT-4 instances for text generation
- 🔗 Access to popular websites and platforms
- 🗃️ File storage and summarization with GPT-3.5
- 🔌 Extensibility with Plugins
This tool is the first widely used app to incorporate autonomous AI agents which we looked at previously:
AutoGPT differs from ChatGPT in that it acts as a higher level manager which runs multiple tasks (including ChatGPT API requests) to collect information, analyse data and complete sub-tasks.
The human prompter will define a goal and AutoGPT will run, sometimes for hours, working towards that goal.
While running it can function autonomously without the need for human agents, it will create the prompts to use itself or ask ChatGPT to create the prompts for it.
Autonomous AI agents can make decisions and take actions based on a set of rules and predefined goals. While ChatGPT can generate a response or series of responses based on your prompts, AutoGPT can self-prompt and tackle multiple steps required to complete a goal without the need for human intervention.
- ChatGPT runs in a web client at: https://chat.openai.com/
- While AutoGPT requires users to download the python scripts and run it locally: https://github.com/Significant-Gravitas/Auto-GPT
AutoGPT also requires a paid OpenAI account so you can use the GPT APIs.
Installing Locally
There is a web client you can use to get a feel for how this works here: https://agentgpt.reworkd.ai/ but for the best experience you’ll need to install AutoGPT locally on your device.
You’ll need Python installed from here:
Then download the latest stable repo at: https://github.com/Significant-Gravitas/Auto-GPT/releases/latest
You’ll need an API key from OpenAI which you can get from here: https://platform.openai.com/account/api-keys
Open up .env.template file in a text editor and enter your OpenAI API key, save the file as .env in the same directory.
Open up a terminal (command prompt) and install dependancies
pip install -r requirements.txt
Then run .\run.bat
from windows or ./run.sh
from linux/mac
Now let’s move on to prompt engineering, specifically for AutoGPT.
Note that documents outputted by the model will end up in the directory /auto_gpt_workspace/
AutoGPT Prompt Engineering
AutoGPT is built on ChatGPT so understanding the mechanics of prompt engineering for that model will go a long way. Check out this tutorial on advanced ChatGPT prompt engineering.
With AutoGPT we break down the prompt into a persona which defines your AI’s role and a series of goals. If we look at this code it seems to be combining the name, role and goals into the prompts it is generating for ChatGPT.
Note that both your AI’s role and when setting goals you need to input the data from the command line so it needs to be a single line of text. You can preformat this in a text editor and then copy and paste it in to the command prompt or hard code it into the config file at: /config/ai_config.py around line 34.
Describe Your AI’s Role
This setting describes what you want the model to do and how you want it to achieve it’s goals. The AI Role can include
- Primary goals and definitions of success
- Constraints and restrictions
- The formatting of output documents
The example provided “an AI designed to autonomously develop and run businesses with the sole goal of increasing your net worth” is quite vague and I believe you could improve this with something like:
an AI designed to develop and run profitable businesses. Your primary goal is to increase your net worth. You should not participate in the following industries (x,y,z). All documents saved should be written in British English.
This provides more details and specifics which we know ChatGPT’s API thrives on.
Setting Goals
You can set up to a maximum of 5 goals.
Goals should be as specific as possible and provide as much detail on what you are looking for as you can.
Here are the examples from the source code:
1. Engage in effective problem-solving, prioritization, planning, and supporting execution to address your marketing needs as your virtual Chief Marketing Officer.
2. Provide specific, actionable, and concise advice to help you make informed decisions without the use of platitudes or overly wordy explanations.
3. Identify and prioritize quick wins and cost-effective campaigns that maximize results with minimal time and budget investment.
4. Proactively take the lead in guiding you and offering suggestions when faced with unclear information or uncertainty to ensure your marketing strategy remains on track.
Again these are quite vague and I’m not entirely sure what the author is expecting which doesn’t give AutoGPT much of a chance. A better series of goals would be something along the lines of:
1. Analyse last years marketing plan at https://example.com/brand and explore new marketing opportunities for 2023
2. Explore the potential of influencer marketing in creating new lead opportunities
3. Carry out competitive research to find out what industry peers in the industry sector are doing and review similar marketing plans for ideas and inspiration
4. Create a new marketing plan for 2023 based on your research, to incorporate the best opportunities for growth
In the example above we create a 4 goal system which is clearly defining what we want AutoGPT to do at each step of the way.
Create AutoGPT Plugins
Plugins are written in Python and there is a template and some examples to get you started.
Fork the template at: https://github.com/Significant-Gravitas/Auto-GPT-Plugin-Template
Then edit the file in /src/auto_gpt_plugin_template/init.py
This will be your entry point when creating the plugin.
The plugins work via series of hook functions which are called at certain stages of execution:
- can_handle_on_response(self) -> bool:
- on_response(self, response: str, *args, **kwargs) -> str:
- can_handle_post_prompt(self) -> bool:
- post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
- can_handle_on_planning(self) -> bool:
- on_planning(self, prompt: PromptGenerator, messages: List[Message]) -> Optional[str]:
- can_handle_post_planning(self) -> bool:
- post_planning(self, response: str) -> str:
- can_handle_pre_instruction(self) -> bool:
- pre_instruction(self, messages: List[Message]) -> List[Message]:
- can_handle_on_instruction(self) -> bool:
- on_instruction(self, messages: List[Message]) -> Optional[str]:
- can_handle_post_instruction(self) -> bool:
- post_instruction(self, response: str) -> str:
- can_handle_pre_command(self) -> bool:
- pre_command(self, command_name: str, arguments: Dict[str, Any]) -> Tuple[str, Dict[str, Any]]:
- can_handle_post_command(self) -> bool:
- post_command(self, command_name: str, response: str) -> str:
- can_handle_chat_completion(self, messages: Dict[Any, Any], model: str, temperature: float, max_tokens: int) -> bool:
- handle_chat_completion(self, messages: List[Message], model: str, temperature: float, max_tokens: int) -> str:
- can_handle_user_input(self, user_input: str) -> bool:
- user_input(self, user_input: str) -> str:
- can_handle_report(self) -> bool:
- report(self, message: str) -> None:
There is an example Twitter client with write capabilities and a Email client example which works with Gmail.
If we look at the email example it loads additional commands into the post_prompt hook
def post_prompt(self, prompt: PromptGenerator) -> PromptGenerator:
if self.load_commands:
from .email_plugin.email_plugin import (
read_emails,
send_email,
send_email_with_attachment,
)
prompt.add_command(
"Read Emails",
"read_emails",
{
"imap_folder": "<imap_folder>",
"imap_search_command": "<imap_search_criteria_command>",
},
read_emails,
)
prompt.add_command(
"Send Email",
"send_email",
{"to": "<to>", "subject": "<subject>", "body": "<body>"},
send_email,
)
prompt.add_command(
"Send Email",
"send_email_with_attachment",
{
"to": "<to>",
"subject": "<subject>",
"body": "<body>",
"attachment": "<path_to_file>",
},
send_email_with_attachment,
)
return prompt
Plugins offer expanded capabilities and increase the utility of AutoGPT making it more capable of extending beyond a scaled up language processor. The ability to create your own plugins means that you can integrate 3rd party applications with ease and potentially use AutoGPT in new ways beyond what the standard source code is capable of.
AutoGPT Use Cases
AutoGPT is an expansion of ChatGPT, it is not getting close to Skynet or going to make you rich trading Bitcoin. It is still ideally suited to language processing task such as:
- Content creation AutoGPT can be used to generate content for blogs, articles, and social media posts. This list is an edited version of what AutoGPT came up with. Where AutoGPT is particularly suited is on high volume content. You could potentially give it a chapter list and leave it running overnight to complete an entire novel.
- Chatbots & Auto-responders AutoGPT can be used to provide better automated responses to customer inquiries, support queries etc. It’s ability to search the internet at point of query makes it potentially more suited to roles that require real time data.
- Personal assistant AutoGPT can be used as a personal assistant that can help users with tasks. As the library of plugins expands this will become more and more useful for integrating into existing applications.
- Analysis & Research AutoGPT excels at analyzing large volumes of text data, such as customer feedback or social media posts, to identify trends and insights. You could potentially ask it to consume mountains of content and provide executive summaries on the summaries of summaries.
Conclusion
AutoGPT is a early stage project which has captured the interest of a wide audience, perhaps before it was ready. At time of writing the results are unpredictable and execution often gets stuck inside logic loops.
AutoGPT is useful over ChatGPT where you want to scale up a task to create or analyse large amounts of content beyond the OpenAI token limits.
It provides a preview of where this technology is heading over the next 5 years. The idea of giving an AI robot a task and telling it to do everything for you is compelling, like having a free army of machine learning employees. However in it’s current state AutoGPT is still a language based model most well suited for language based tasks.
The fact it is open source and expandable is very exciting and it currently has over 250 open pull requests on Github. I look forward to seeing how this evolves and how far the ML community can go to building AutoGPT to it’s full potential.