Concurrency Chaos: 10 AI Agents Cause 50% More Errors
I conducted an experiment to test the limits of multiple AI agents by assigning them a series of tasks that pushed their capabilities to the edge – code completion, bug detection, and code review. The idea was to see how they would handle the pressure, but things quickly took a turn for the worse.
Initially, I was thrilled to see the agents working together, completing tasks at an incredible pace. However, as the number of agents increased, so did the number of conflicts and errors. It was like a game of AI tag, where each agent was trying to outdo the others, but ultimately causing more harm than good.
Here's an example of what I saw:
pythonimport ollama # Create 10 Ollama models models = [ollama.Ollama() for _ in range(10)] # Run each model in parallel for model in models: model.run()
At first, this code seemed like a good idea – each model would run independently, completing tasks at an incredible rate. But in reality, the models started to conflict with each other, causing errors and crashes.
One agent was trying to modify a file that another agent had already modified, causing a version control conflict. Another agent was trying to access a resource that was already being used by another agent, causing a deadlock.
Concurrency Errors by Agent NumberData from the sources listed below.
The chart shows a clear correlation between the number of agents and the number of errors, with a significant increase in errors as the number of agents increases. This is because each agent is trying to access and modify the same codebase, causing conflicts and errors.
So, what's the takeaway from all this? Running multiple AI agents at once in a real codebase is not as straightforward as it seems. While it may seem like a good idea to speed up development and testing, the reality is that it can cause more harm than good. In fact, I wouldn't recommend it unless you have a very specific use case and a deep understanding of the potential consequences.
Try this
If you want to try running multiple AI agents at once, use the following command with caution:
bashpip install ollama python -c "import ollama; models = [ollama.Ollama() for _ in range(10)]; for model in models: model.run()"
However, be warned – this may cause errors and crashes, especially if you're not familiar with the codebase.
