The Future of AI: Building Networks of Collaborative Agents
Exploring the Tools and Strategies for Effective Multi-Agent Systems
This post outlines what tools I found that can create a network of AI agents, which will work collectively towards a common goal.
I approached this with a combination of self-search and assistance from ChatGPT.
I found a couple of interesting tools, LangChain looks the most promising.
The first question to answer though is why use multiple agents when I have a perfectly good agent in ChatGPT?
Why Multiple Agents vs. a Single Mammoth Agent?
A multiple agent system will be referred to as MAS from here on.
Scalability and Parallelism
Multiple agents handle large, complex problems by distributing tasks across agents.
Allows parallel operations, improving the time it takes to solve tasks. It does require more compute power however.
Robustness and Fault Tolerance
A single agent failure (i.e. an LLM hallucination) could lead to a complete system breakdown at worst, a bad solution at best. Multiple agents means more fault tolerance.
Specialization and Modularity
Agents can specialize in different tasks, leading to efficient solutions where collaboration is possible.
A single agent must generalize, reducing efficiency in specialized tasks.
A common practice when using a LLMs is to ask it to take on a persona of some expert. Why stop at just 1 expert when you can have a whole team of them?
Adaptability and Flexibility
MAS can dynamically adapt to changes, reconfiguring agents as needed. A single agent is less flexible in changing conditions.
Emergent Behavior and Innovation
Interactions between agents can lead to emergent behaviors and innovative solutions.
I’m most interested in this part, what kind of emergent behavior can we obtain from a system of AI agents? Will they form cliques, will they start to groupthink, will they change behavior as they start to communicate? I’ll probably write a blog on what emergence is and how it applies to AI agents.
Research Findings using ChatGPT
I asked ChatGPT 4o (in July 2024) to research the web and find 5 solutions for me to investigate, here is the prompt I use:
I would like to create a MAS system of LLM agents, I think I will create it in python. Research the web and present 5 options I should investigate further on how to create MAS. I want to be able to run the MAS locally on my computer, not on a cloud based system. If I need to code I want to use the python ecosystem. Provide links to each solution, and provide a level of effort estimate for each option. Explain your reasoning
This is what I got in response, note I’ve added some commentary from me on each tool.
LangChain
Description: Framework for developing applications with language models.
Level of Effort: Moderate.
Pros: Modular, supports web scraping, and tool integration.
Cons: Requires setup and understanding of chaining components.
Commentary from me: This looks promising.
Hugging Face Transformers
Description: Library for working with transformer models like BERT, GPT, etc.
Level of Effort: Moderate to High.
Pros: Extensive support, active community, easy integration.
Cons: Requires understanding of transformer models and managing computational resources.
Links: Hugging Face Transformers GitHub, Hugging Face Documentation
Commentary from me: I don’t immediately see any multi agent support on this page, I think these are just pre-trained models. These could be useful tools to give my future agents though…
Ray
Description: Framework for building and running distributed applications.
Level of Effort: High.
Pros: Excellent for scaling applications, robust support for distributed computing.
Cons: Requires knowledge of distributed computing.
Links: Ray Documentation, [Ray GitHub]
Commentary from me : Again this is not a tool for building networks of LLM agents, this is a tool for scaling ML training and serving. It’s not really relevant to what I am looking for.
Rasa
Description: Open-source framework for building conversational AI.
Level of Effort: Moderate.
Pros: Designed for conversational agents, customizable.
Cons: Primarily designed for dialogue systems, additional customization needed for other interactions.
Links: Rasa Documentation, Rasa GitHub
Commentary from me: This is a no code tool for building chatbots, again this is not a tool to build a network of LLM agents.
Mesa
Description: Agent-based modeling framework in Python.
Level of Effort: Moderate.
Pros: Flexible, easy to set up, good for simulating complex systems.
Cons: Requires additional work to integrate LLMs.
Links: Mesa Documentation, Mesa GitHub
Commentary from me: This package looks really cool, it is a way to simulate multiple agents that behave according to defined rules. It may be possible to integrate LLMs into them but not immediately obvious from the docs. I’ll probably keep looking into this.
My Own Research Findings
After a couple of minutes perusing online I found some great conversations on Reddit regarding tools to use, this post was pretty good I thought.
I read through it and took some notes. Then I asked chatgpt to review it and summarize the discourse. Here is what it summarized the post as:
LangChain
Positively viewed for its flexibility and extensive documentation.
Supports modular design, web scraping, and integration with tools like Tavily.
Haystack
Noted for flexibility with different LLMs and tasks like document search and QA.
Agent capabilities still in beta, which might be a limitation.
AutoGen
Developed by Microsoft, focuses on multi-agent conversation.
Strong potential for handling complex tasks through agent interactions.
LLaMaIndex
Useful for managing and querying large datasets with LLMs.
Camel Agents
Promising but requires better execution capabilities.
Critiques regarding their current effectiveness.
Conclusion
I’m going to use LangChain. It's in python, which I know, and it looks somewhat accessible. The fact ChatGPT and the reddit post both listed it favourably means its probably a good place to start.
I am very surprised with the poor performance of ChatGPT 4o when I asked it to list out tools to build networks of LLM agents. It did suggest Langchain, but none of the other suggestions were appropriate.
I first got the idea to investigate networks of agents after watching this fascinating video of Andrew Ng discussing the topic, if you have read until now you will probably find it interesting too.