Agent AutoBuild - Automatically Building Multi-agent Systems
TL;DR: Introducing AutoBuild, building multi-agent system automatically, fast, and easily for complex tasks with minimal user prompt required, powered by a new designed class AgentBuilder. AgentBuilder also supports open-source LLMs by leveraging vLLM and FastChat. Checkout example notebooks and source code for reference:
Introduction
In this blog, we introduce AutoBuild, a pipeline that can automatically build multi-agent systems for complex tasks. Specifically, we design a new class called AgentBuilder, which will complete the generation of participant expert agents and the construction of group chat automatically after the user provides descriptions of a building task and an execution task.
AgentBuilder supports open-source models on Hugging Face powered by vLLM and FastChat. Once the user chooses to use open-source LLM, AgentBuilder will set up an endpoint server automatically without any user participation.
Installation
- AutoGen:
- (Optional: if you want to use open-source LLMs) vLLM and FastChat
Basic Example
In this section, we provide a step-by-step example of how to use AgentBuilder to build a multi-agent system for a specific task.
Step 1: prepare configurations
First, we need to prepare the Agent configurations. Specifically, a config path containing the model name and API key, and a default config for each agent, are required.
Step 2: create an AgentBuilder instance
Then, we create an AgentBuilder instance with the config path and default config. You can also specific the builder model and agent model, which are the LLMs used for building and agent respectively.
Step 3: specify the building task
Specify a building task with a general description. Building task will help the build manager (a LLM) decide what agents should be built. Note that your building task should have a general description of the task. Adding some specific examples is better.
Step 4: build group chat agents
Use build()
to let the build manager (with a builder_model
as backbone) complete the group chat agents generation.
If you think coding is necessary for your task, you can use coding=True
to add a user proxy (a local code interpreter) into the agent list as:
If coding
is not specified, AgentBuilder will determine on its own whether the user proxy should be added or not according to the task.
The generated agent_list
is a list of AssistantAgent
instances.
If coding
is true, a user proxy (a UserProxyAssistant
instance) will be added as the first element to the agent_list
.
agent_configs
is a list of agent configurations including agent name, backbone LLM model, and system message.
For example
Step 5: execute the task
Let agents generated in build()
complete the task collaboratively in a group chat.
Step 6 (Optional): clear all agents and prepare for the next task
You can clear all agents generated in this task by the following code if your task is completed or if the next task is largely different from the current task.
If the agent’s backbone is an open-source LLM, this process will also shut down the endpoint server. More details are in the next section.
If necessary, you can use recycle_endpoint=False
to retain the previous open-source LLM’s endpoint server.
Save and Load
You can save all necessary information of the built group chat agents by
Configurations will be saved in JSON format with the following content:
You can provide a specific filename, otherwise, AgentBuilder will save config to the current path with the generated filename save_config_TASK_MD5.json
.
You can load the saved config and skip the building process. AgentBuilder will create agents with those information without prompting the build manager.
Use OpenAI Assistant
Assistants API allows you to build AI assistants within your own applications.
An Assistant has instructions and can leverage models, tools, and knowledge to respond to user queries.
AutoBuild also supports the assistant API by adding use_oai_assistant=True
to build()
.
(Experimental) Use Open-source LLM
AutoBuild supports open-source LLM by vLLM and FastChat. Check the supported model list here. After satisfying the requirements, you can add an open-source LLM’s huggingface repository to the config file,
and specify it when initializing AgentBuilder. AgentBuilder will automatically set up an endpoint server for open-source LLM. Make sure you have sufficient GPUs resources.
Future work/Roadmap
- Let the builder select the best agents from a given library/database to solve the task.
Summary
We propose AutoBuild with a new class AgentBuilder
.
AutoBuild can help user solve their complex task with an automatically built multi-agent system.
AutoBuild supports open-source LLMs and GPTs API, giving users more flexibility to choose their favorite models.
More advanced features are coming soon.