Autogen - AI Agents Framework

Microsoft is now part of the competition for Large Language Model (LLM) application structures with its open-source Python library called AutoGen. In Microsoft's words, AutoGen serves as "a system designed to make easier the management, enhancement, and automation of LLM processes." The basic idea behind AutoGen involves making "agents," which are code modules driven by LLMs like GPT-4. These agents communicate with one another using natural language messages to accomplish a variety of tasks.

Autogen; Source: Multiplatform AI News

Agents can be personalized and enhanced with prompt engineering methods and additional tools. These improvements let them fetch information or run code effectively. Using the AutoGen platform, developers have the ability to create a system of agents focusing on various tasks while working together in harmony.

What are LLM Agents?

Language models of the vanilla type do many things wonderfully, like translating and answering questions. But their understanding and ability have limits. It is similar to a builder lacking tools while constructing a home. Nevertheless, it has been noticed that LLMs have the ability to think and operate when provided with essential instruments. The majority of the LLMs possess restricted understanding of the world, but it is possible to enhance them with data from special sources through prompting.

We can achieve this via two methods. Retrieval, augmented generation, and LLM agents. In RAG, we provide models with data through specially designed pipelines. But when it comes to agents, the LLM will utilize a tool that is available based on its own reasoning process. For instance, GPT-4 using a Serper tool can search the internet and give answers in line with that, or it can check and evaluate stock performance if it has the availability of the Yahoo Finance tool. Thus, this joining of LLMs, tools, and a setup for thinking and taking action is what we call an AI agent.

Platforms and tools for constructing LLM agents have swiftly increased. One of these tools is Autogen. So, let us start with an overview of Autogen and how to use it to create LLM agents.

What is Autogen?

Autogen is a tool that Microsoft has made open-source for creating multi-agent applications of solid strength. The design was done from the very start, considering communication between multiple agents. This allows us to construct LLM applications where several agents communicate with each other to seek answers to the given challenges. These agents have great adaptability, which indicates we can direct them to accomplish particular tasks. It also fits well with the Langchain tooling environment, which implies we use available Langchain tools to enhance our agents.

Autogen; Source: X.com

To complete tasks, Autogen provides various types of Agents, such as

Assistant Agent: This agent is in charge of performing tasks such as coding, reviewing, etc.

User Proxy Agent: These agents, as the name signifies, operate for the users in their place. They carry out a duty to include humans in interaction with agent systems by steering discussions.

Agent That Can Be Taught: This agent is set up to be taught very well. We have the capability of giving this agent clear information that does not exist in LLMs.

The Key Features of Autogen

Autogen present an advanced agent abstraction. This grants developers the ability to shape the activities and skills of separate agents. Utilizing this function, the representation and handling of agents become more straightforward, making the development procedure less complex.

Features of Autogen; Source: Morioh

Communication Guidelines: Autogen can assist different communication methods, allowing representatives to share details and organize their tasks well. This smooth teamwork makes sure of effective choices among representatives inside the system.

Modeling Environment: Developers can use Autogen to create the environment where agents work. This function lets agents sense and respond to their own surroundings, hence improving decision-making and action outcomes.

Learning and Change: The Autogen structure includes machine learning methods that allow agents to get knowledge from data and adjust their actions over time. This characteristic enables the agents to keep enhancing their efficiency and make smart choices depending on changing situations.

Decision-Choosing: Autogen gives frameworks for making decisions. These allow agents to make choices that are informed by their goals, the information they have, and things in the environment. This makes sure that agents use their efficiency very well to get the best results within the system of multi-agents.

Scalability and Performance: Autogen has been created to manage large-scale systems with multiple agents in a high-performing manner. Its structure ensures effective execution, giving developers the opportunity to build systems that can house many agents without sacrificing speed or trustworthiness.

Integration and Working Together: Autogen offers a smooth combination of present AI structures, libraries, and implements. This harmony simplifies the task for developers to include Autogen in their ongoing operations and tasks.

Use Cases of Autogen Multi-Agent Framework

Management of Smart City: Autogen can be utilized for the creation of a complex multi-agent system to manage different facets of an intelligent city. These agents have the ability to oversee and regulate traffic, energy use, waste management, among other activities. This results in a more effective and sustainable urban setting.

Supply Chain Betterment: The Autogen structure helps in the creation of a system with many agents that makes supply chain procedures better. Agents can work together to manage stock, track shipments and distribute goods, leading to enhanced effectiveness and lessened expenses within the supply chain.

Autonomous robots and drones: Autogen can be used for creating multi-agent systems that manage self-governing robots and drones. These agents can work jointly to carry out intricate tasks like discovery, monitoring, and delivering which allows the execution of superior automation solutions in different business sectors.

Internet Help Service: Autogen has the capability to drive a system with multiple agents for internet customer help. Agents can proficiently manage inquiries from customers, supply tailor-made suggestions and independently solve general problems, boosting the total experience of customers.

Why is AutoGen Important?

AutoGen is dealing with the demand for effective and versatile communication between multiple agents using AI. The importance it carries can be observed from its potential to:

  • Orchestrate, automate, and optimize complex LLM workflows more efficiently.
  • Maximise the performance of LLM models while addressing their limitations.
  • Easily create next-generation LLM applications based on multi-agent conversations. 

Getting Started with AutoGen

Getting Started with Autogen; Source: Level up coding

To get started with AutoGen, you need to follow a few steps:

Install AutoGen: To install the AutoGen library, run the pip install py-autogen command.

Establish API Endpoint: Organize the API endpoint for AutoGen by importing the autogen library and arranging the LLM configuration.

Description of Agents: Describe the agents and their positions within the AutoGen framework, stating their abnnilities and ways they interact.

Execute Tasks: Use the defined agents to execute tasks and observe the collaborative output.

Modify and Repeat: Alter the function of agents to suit your needs; keep iterating and refining the process till you obtain maximum results.

Scenario 1: Auto-Generated Agent Chat Teaching

In this sample, we will discover how AutoGen supports teaching of AI actors via normal talks. We are going to make agents that learn fresh abilities and create repeatable instructions for upcoming duties. This sample shows how adaptable and multi-talented AutoGen is in enhancing the abilities of AI systems.

Setting Up AutoGen

You should perform the steps detailed in Example 1 for establishing AutoGen and organizing the essential API endpoint. You need to bring in the AutoGen library and form an LLM config following your needs.

Teaching AI new skills

Use AutoGen for teaching AI agents fresh skills by way of agent communications. Set the required skills and direct the agents during talks to gain needed knowledge. Use present APIs or libraries to get information, do tasks and make results according to what the user asks. Talk with AI agents back and forth for making better their understanding and increasing how well they work.

Creating a Reusable Recipe

After you finish the task successfully, make a repeat-use recipe which captures all steps and their related coding logic. Build Python functions for doing similar tasks in future times, making sure there is clear division between coding and non-coding procedures. By making properly recorded and broad functions, the recipe can be used again in an efficient manner for similar work without initiating from the beginning.

Scenario 2: Automated Task Solving with Code Generation

In this sample, we will study how AutoGen makes automatic task solving possible through code generation. We are going to explain the steps for establishing AutoGen, creating agents, performing code execution and troubleshooting the final result. Now, we will discuss how to display the generated results effectively.

Setting Up AutoGen

Firstly, you should install the Py-AutoGen library by applying the pip install py-autogen commands. After you have installed it, bring in the AutoGen library and arrange an API endpoint for reaching your preferred models. Set up the LLM configuration according to your liking, such as by choosing mode, adjusting temperature, and so on.

Defining Agents

You must identify the essential agents for your work, like the helper agent and the user representative agent. The helper agent uses LLM-based skills to create code and give advice, whereas the user representative agent acts on behalf of the user and can autonomously run code. Please describe how the agents interact with each other and when they should ask for input from the user or continue to function automatically.

Executing Code and Debugging

Apply the specified agents to run code and see the result. During this execution, there can be several interactions between agents where user proxy agent operates the code giving back responses. If problems or faults appear, the helping agent can find mistake in code and propose betterments. Working together to correct mistakes guarantees more precise outcomes and superior quality of code.

Displaying the Output

When the code runs successfully, it creates an output that we can show in a good format. Here, Python's matplotlib library is useful for making a bar Chart to present the necessary details. The agent of user proxy runs the code for making chart. The file that is created can be kept and shown for analysis in future.

Conclusion

AutoGen is an innovative project from Microsoft that changes how we make and handle self-ruling agents. With its adaptable structure, talkative agents, and teamwork abilities, AutoGen enables users to get better-quality outcomes, automate dialogues and carry out difficult tasks with ease. Using the strength of systems with many agents, AutoGen creates countless opportunities for applications driven by AI.