How to build your own AutoGPT agent with Forge and test it with Benchmark
An introduction AutoGPT and autonomous AI agents
AutoGPT is a groundbreaking AI agent leveraging OpenAI's GPT-4 or GPT-3.5 APIs to autonomously tackle tasks through natural language interaction. Unlike traditional systems, it initiates tasks without constant human guidance, adapting its strategies based on evolving information. It adeptly handles databases, files, web searches, and more, even featuring text-to-speech capabilities. Notably, AutoGPT excels in coding tasks, with potential for self-improvement. From research to coding and creative writing, it outperforms ChatGPT, executing tasks with precision. Its repository includes
Forge, which allows you to easily build your own conversational AI agent powered by AutoGPT, and Benchmark, a tool to test the agent's performance. This tutorial will walk you through the basics of getting started with both through the command line tools provided by the AutoGPT team. Ready to unleash the full potential of autonomous AI agents? Let's dive in!
And also very important is the Quickstart Guide to get started in no time.
Before starting, make sure your development environment meets these requirements:
- Using the User Interface
- Testing performance with Benchmark
To get started, you first need to clone the AutoGPT repository:
git clone https://github.com/Significant-Gravitas/Auto-GPT
Run the setup command, which will make sure that you have Python, Poetry, Flutter and Google Chrome installed in your system:
Setup initiated ... Installation has been completed.
After installation is complete, you can terminate the setup script with CTRL + C.
See if poetry was installed correctly.
If you get an error, you might need to add Poetry to your PATH:
- Open the .bashrc file in your home directory (for example, /home/your-user-name/.bashrc) in a text editor.
- Add export PATH="$PATH:$HOME/.local/bin" at the end of the file.
- Save the .bashrc file.
- Restart your terminal.
After that, choose a name for your agents and run the following command:
./run agent create your_agent_name
This command will use Forge to create a new agent.
You can list all available agents with the command:
./run agent list
Now, open the folder where your new agent was created:
I created an agent named scraper:
Copy the example environment into a new .env file:
cp .env.example .env
Open the .env file and add your OpenAI API Key. Your environment should look something like this:
Finally, install the project dependencies:
And activate the virtual environment with:
Make sure your virtual environment is always active before running an agent.
That's it! Inside your agent's folder, you can now run it with:
./run agent start your_agent_name
This command runs the server on http://0.0.0.0:8000 and watches for changes.
Using the User Interface
Access the frontend at http://localhost:8000/ and log in using a Google or GitHub account. You can then send tasks to your agent through the interface.
Each time you save changes, the app auto-refreshes so you can test in real-time.
As you dig into the code, the app will become a custom creation all your own. Build the AI assistant you've always dreamed of!
Creating Tasks with AutoGPT Forge UI
Within the AutoGPT Forge UI, the "New Task" button is your gateway to creating tasks for your AI agent.
- Click on the "New Task" button located at the top of the Task List section.
- In the Task Interface, input the details of the task you want your agent to perform.
- Click the "Send" button to transmit the task to your agent.
Feel free to continue the interaction by typing additional messages and sending them as needed.
Leveraging Continuous Mode
One remarkable feature we have here is what we call "Continuous Mode". This nifty little function lets your agent perform tasks on a loop.
But, here's the kicker - when you decide to hit that second button in the task input box, be ready for a warning message to pop up. It's there to remind you that you might be stepping into a never-ending loop, especially if you haven't clearly defined your task conditions.
So, if you're not entirely sure about how your agent will behave or what the task requires, my advice is to take it one step at a time. Just keep pressing that "Send" button and typing "y" until your task is in the bag.
Benchmarking: Gauging Your Agent’s Proficiency
Alright, let's talk benchmarking - the backbone of agent development. It's like your agent's report card, a way to size up its skills and potential.
See that trophy icon on the left side of your screen in the AutoGPT Forge UI? Click it and you're diving headfirst into the benchmarking world.
You'll find a tree structure on that screen, loaded with all sorts of challenges for your agent. You can pick and choose from different challenge categories to create your own test suite. Keep an eye on the real-time progress as your agent tackles these challenges. Results come in as passed, failed, or in-progress - it's not just a score, it's a push, a challenge, a motivator to get your agent to reach its limits and keep evolving.
Submitting Your Agent’s Prowess to the Leaderboard
Now, when you're satisfied with your test suite results, look for the "Submit to Leaderboard" button. Click it when it's live and you'll get a submission form. You need to fill in a few key details:
- Team Name: Your team's name, easy enough.
- Github Repo URL: Share the web link to your forked repository.
- Commit SHA: For some traceability, go to the root of your repository and run 'git rev-parse HEAD.' That'll give you a unique git hash. Copy and paste it where it belongs.
Once that's all set, hit "Submit." Your scores will be on the leaderboard, letting you see how your agent stacks up against others in the AutoGPT community. That's how you make a mark, people. Now, go out there and conquer those challenges!
When you're done, make sure to remember to stop the agent running with the following command:
./run agents stop
You can also exit your Poetry virtual environment with:
These are the basics of AutoGPT. Be aware that this is a project in constant development, so things can evolve quickly. If you want to dive deeper, you can check AutoGPT's Github page and AutoGPT's discord.
With this tutorial, you now have the basics to start building your own AI agent powered by AutoGPT! The possibilities are endless.
Curious to see what other people are building with this amazing tool? Checkout Lablab's directory with applications of AutoGPT