AutoGen — Build Powerful AI Agents with ChatGPT/GPT-4

Explore AutoGen, a Microsoft library that lets you create LLM applications with agents. These agents can communicate and help you solve complex tasks.

Venelin Valkov


Photo by julien Tromeur on Unsplash

We’ll begin with an introduction to AutoGen and its benefits. Then, we’ll kick off with a basic example of building a single agent for analyzing stock price trends. Afterward, we’ll delve into a more advanced demonstration, using four agents to construct a cryptocurrency indicator, drawing insights from historical prices and news.

In this part, we will be using Jupyter Notebook to run the code. If you prefer to follow along, you can find the notebook on GitHub: GitHub Repository

What Makes AutoGen Cool?

  • Flexible Chats: AutoGen can make agents talk to each other to solve problems. This is much more powerful than just one LLM doing everything.
  • Customization: You can create agents to do specific tasks. You can choose which LLM to use, how people can join the conversation, and even bring in tools to help.
  • Human Input: AutoGen lets humans join the conversation, too. They can give their ideas and feedback to help the agents.

AutoGen is like having a bunch of smart friends who work together to get things done, and it’s made with help from top-notch researchers.


You can install AutoGen with pip:

pip install -Uqqq pip --progress-bar off
pip install -qqq pyautogen==0.1.10 --progress-bar off

Let’s add the required libraries:

import json
from getpass import getpass

import autogen
import pandas as pd
import requests
from autogen import AssistantAgent, UserProxyAgent
from IPython.display import Image

Next, you need to enter your API key for OpenAI (get yours from…