How to Build a Powerful Multi-Agent AI Research System

Learn how to build a powerful multi-agent AI research system that can autonomously conduct detailed research on any topic, optimize for quality, and update findings in Airtable - a step-by-step tutorial.

July 14, 2024

party-gif

Unlock the power of AI-driven research with this innovative multi-agent system. Discover how to build a team of specialized AI assistants that collaborate seamlessly to deliver high-quality, fact-based research on any topic. Streamline your research process and unlock new possibilities for your business or personal projects.

Building an AI Research Team: A Powerful Multi-Agent Approach

The key steps in building this multi-agent research system are:

  1. Create Three Different GPT Assistants:

    • Director: Reads and updates the Airtable database, breaks down research tasks, and delegates to the Research Manager and Researchers.
    • Research Manager: Generates research plans, reviews, and ensures quality assurance for the research delivered by the Researchers.
    • Researcher: The agent that actually browses the internet, gathers information, and produces the research results.
  2. Use Anthropic's Autogon Framework:

    • Autogon simplifies the use of the OpenAI Assistant API by providing a straightforward way to orchestrate the collaboration between the different agents.
  3. Implement Necessary Functions:

    • Google Search
    • Website Scraping and Summarization
    • Airtable Records Retrieval and Update
  4. Connect the Agents Together:

    • Create a group chat with the User Proxy Agent, Researcher, Research Manager, and Director.
    • Trigger messages to the group to initiate the research process.

The result is a powerful, autonomous research system that can handle complex research tasks by leveraging the specialized capabilities of multiple agents working together. This approach represents a paradigm shift in how we think about AGI, moving away from the idea of a single, all-powerful AI towards a collaborative system of specialized agents.

Evolving the Research Agent: From Linear to Goal-Oriented

In the past, my research agent was a simple linear language model chain that followed a very straightforward process. It could take a research topic, trigger a Google search, and let a large language model choose the most relevant links and script the websites. The agent would then generate a report based on the collected information. While this approach worked, it was limited to very basic and obvious research tasks.

Two months later, the research agent evolved into an AI agent - a combination of a large language model, memory, and tools. This agent could reason to break down a big goal into subtasks and had access to various tools like the Google Search API to complete those tasks. It also had long-term memory to remember its previous actions. The fundamental difference was that the AI agent was more goal-oriented, allowing it to take multiple actions to complete a research task, even with fairly ambiguous goals.

This second version of the research agent was a significant improvement, delivering higher-quality research results and providing a list of reference links. However, it still had some issues. The quality of the results was not always consistent, and the agent struggled with complex or constrained actions that the OpenAI model was not designed to handle, such as finding specific contact information.

The next breakthrough came with the emergence of multi-agent systems like M-GPT and ChatDef. These systems aimed to improve task performance by introducing not only one but multiple agents working together. The recent Frameworks like Autogon made the creation of these collaborative systems even easier, allowing for the flexible creation of various hierarchies and structures to orchestrate the cooperation between different agents.

With the release of the OpenAI Assistant API and GPT-3, the cost of building useful agents has significantly dropped. This prompted me to create an AI Researcher 3.0, where the original researcher agent still performs the research, but a research manager agent is introduced to critique the results and ensure quality control. Additionally, a research director agent can be added to break down large research goals into subtasks and delegate them to the research manager and researchers, while also handling tasks like reading from and writing to an Airtable database.

This multi-agent system represents a paradigm shift in how we think about AGI. Instead of a single AI that can do all things, the focus is on creating specialized agents that can collaborate towards a shared goal. This approach addresses the technical challenges of training a single, all-powerful AGI system.

The key to training these highly specialized agents lies in two common methods: fine-tuning and knowledge-base retrieval-augmented generation (RAG). Fine-tuning is useful when you want to improve the model's skills in performing specific tasks, while RAG is better suited for providing large language models with accurate and up-to-date data.

To make the fine-tuning process more accessible, platforms like Gradio have emerged, simplifying the fine-tuning of high-performance open-source models like LLaMA and Hermit. Gradio removes the need for dedicated infrastructure and computing units, allowing developers and enterprises to fine-tune models with just a few lines of code and a pay-as-you-go pricing model.

By leveraging these advancements, the AI Researcher 3.0 system can now deliver more consistent and autonomous research results, with the various agents collaborating to ensure quality and efficiency.

Overcoming Limitations: Introducing Specialized Agents and Collaboration

The initial versions of the AI researcher had limitations, such as a linear flow and inconsistent quality. To address these issues, the author explored the use of AI agents - a combination of large language models, memory, and tools. This allowed for more goal-oriented research, where the agent could break down a task into subtasks and utilize various tools to complete the research.

The introduction of multi-agent systems, such as M8GT and ChatDef, further improved the task performance by having multiple agents collaborate. The recent frameworks like Anthropic's Autogen made the creation of these collaborative systems even easier, allowing for the development of flexible hierarchies and structures to orchestrate the cooperation between different agents.

The author then decided to create an AI Researcher 3.0, where the original researcher agent would focus on the actual research, while a research manager agent would be introduced to critique the results and ensure quality control. Additionally, a research director agent was added to break down the research goals into subtasks and delegate them to the research manager and researcher agents. This multi-agent approach led to more consistent research quality and a more autonomous system.

The author also discussed the two common ways to train specialized agents: fine-tuning and knowledge-base retrieval-augmented generation (RAG). While fine-tuning can improve model skills in specific tasks, it can be challenging and require specialized hardware. The author highlighted Anthropic's Gradio platform as a tool that simplifies the fine-tuning process and makes it accessible to developers and enterprises.

In the end, the author provided a step-by-step guide on how to build this multi-agent research system using Autogen, demonstrating the flexibility and power of this approach in creating autonomous and collaborative AI systems.

Fine-Tuning Made Easy: Leveraging Gradient for Model Customization

Fine-tuning high-performance open-source models can be a challenging task, often requiring specialized hardware with large memory capacity. However, Gradient, a platform developed by Anthropic, significantly reduces the barrier to fine-tuning by making the process extremely simple and accessible to all developers and enterprises.

With just a few lines of code, you can fine-tune models like LLaMA, Noris, and Hermès using Gradient. The platform supports multiple programming languages, including Node.js, Python, and a command-line interface, and provides all the necessary tools and tutorials to get you started quickly.

One of the key advantages of using Gradient is its pricing model. Traditionally, fine-tuning requires upfront costs for dedicated infrastructure and computing units. Gradient, on the other hand, removes the need for infrastructure and allows you to pay only for what you use, based on a token-based system.

If you click on the link in the description below, you will receive $5 in free credits to get started with Gradient. This can be particularly helpful if you have a need to fine-tune models but don't know where to start. Gradient's user-friendly platform and comprehensive resources make the process seamless, enabling you to focus on your specific use cases and requirements.

Orchestrating the Research Team: Roles, Responsibilities, and Coordination

The key to building an effective multi-agent research system lies in clearly defining the roles and responsibilities of each agent, as well as establishing a robust coordination framework. In this system, we have three distinct agents:

  1. Research Director: The director is responsible for managing the overall research process. They extract the list of companies to be researched from the Airtable database, break down the research tasks, and delegate them to the Research Manager and Researchers. The director also updates the Airtable records with the completed research results.

  2. Research Manager: The research manager acts as the quality control gatekeeper. They review the research results provided by the Researchers, provide feedback, and ensure the information gathered is comprehensive and aligned with the research objectives.

  3. Researchers: The researchers are the workhorses of the system. They are responsible for conducting the actual research, performing Google searches, scraping relevant websites, and summarizing the findings.

The coordination between these agents is facilitated by the Autogon framework, which simplifies the use of the OpenAI Assistant API. Each agent is defined as a GPT Assistant Agent, with specific system prompts and registered functions. The agents communicate through a group chat, where the Director delegates tasks, the Researchers provide updates, and the Manager reviews and provides feedback.

By breaking down the research process into these specialized roles, the system is able to deliver more consistent and high-quality research results. The Director ensures the research aligns with the overall objectives, the Manager provides quality control, and the Researchers focus on the execution of the tasks.

This multi-agent approach represents a paradigm shift in how we think about AGI (Artificial General Intelligence). Instead of a single, all-powerful AI, the system is composed of multiple, specialized agents that collaborate towards a shared goal. This modular and scalable design allows for the introduction of additional agents, such as a "Research Director" or "Data Analyst," to further enhance the system's capabilities.

Conclusion

The development of the AI researcher system showcases the rapid progress in AI capabilities, particularly in the areas of multi-agent collaboration and task-oriented reasoning. The key highlights of this system include:

  1. Modular Agent Architecture: The system is built using a multi-agent approach, with specialized agents (Director, Research Manager, and Researcher) working together to accomplish the research task. This modular design allows for flexibility and scalability.

  2. Automated Research Workflow: The system automates the research process, from breaking down the research goal, delegating tasks, conducting web searches, and summarizing findings, to updating the final results in the Airtable database.

  3. Quality Assurance: The Research Manager agent acts as a quality control mechanism, providing feedback and pushing the Researcher agent to find more comprehensive information to ensure high-quality research outputs.

  4. Leveraging External Tools: The system integrates various external services, such as Google Search, web scraping, and Airtable, to gather and organize the research data, demonstrating the ability to utilize a diverse set of tools.

  5. Continuous Improvement: The author highlights the iterative development process, with each version of the AI researcher system introducing new capabilities and addressing previous limitations, such as inconsistent quality and memory management.

  6. Accessibility and Scalability: The use of platforms like Gradio for fine-tuning models and Autogen for multi-agent coordination helps reduce the technical barriers for developers to build and deploy such systems.

Overall, this AI researcher system represents a significant step forward in the development of autonomous, task-oriented AI agents that can collaborate to tackle complex research tasks. The modular and scalable design, combined with the integration of external tools and services, showcases the potential for such systems to be applied in a wide range of domains, from sales and venture capital to any field that requires comprehensive and reliable research.

FAQ