Build a financial multi-agent system with AG2 (formerly AutoGen) and Ollama
The big tech companies say the future belongs to AI agents. And we think the same. Multi-agent collaboration will soon be an essential part of every software.
Microsoft recently announced (Opens in a new window) a swarm of new agents for 2025 in its products at the Ignite conference. As data scientists and software engineers, it is essential to understand how AI agents work and how you can use them efficiently.
In our view, the companies of the future will be driven by AI agents, which will give these companies an economic advantage over other companies. Therefore, it's time to take a closer look at multi-agent systems.
But what is the best way to start? 🤔
We have spent months with several frameworks for multi-agent systems, and we struggle with the complexity of it all. Then we came across AG2 (formerly AutoGen), and it offers exactly what we need.
AG2 offers features like conversation patterns, support for tool use, and human-in-the-loop workflows. In short, this framework simplifies the process of developing production-ready multi-agent applications.
In this article, we build a multi-agent system to perform a financial analysis of the Tesla stock. Best of all, we run it locally, so you don't have any API costs.
We’ll discuss the following points:
What is AG2?
Technical requirements
Agents in AG2
Conversable Agent
Assistant Agent
User Proxy Agent
Group Chat Manager
What are Conversation Patterns?
Two-agent chat
Sequential chat
Group Chat
Nested Chat
What are Agentic Design Patterns?
Reflection
Tool Use
Planning
Multi-Agent Collaboration
Perform a multi-agent financial analysis of Tesla stock
Configuration
Definition of the Task
Definition of the Agents
Build a Group Chat
Conclusion
So we’ve no time to waste. Let’s dive in!
What is AG2?
When you are searching for "AutoGen" online, you might feel confused at first. There are two frameworks that are related to AutoGen: AG2 (formerly AutoGen) and Microsoft’s AutoGen.
AG2 continues the original AutoGen framework and is maintained by its original creators. The original creators left Microsoft and rebranded the framework. It is now hosted under the "AG2ai" organization. AG2 focuses on a community-driven approach with open governance.
Microsoft continues to develop the framework AutoGen independently of AG2. In addition, Microsoft has introduced major updates, including a complete rewrite of version 0.4. In this context, Microsoft wants to adapt the framework so it better fits Microsoft programming interfaces.
In this article, we use the framework AG2. It is an open-source framework designed for building AI agents and enabling multi-agent collaboration to solve tasks. The framework simplifies the orchestration and automation of complex LLM workflow. It’s like PyTorch for building AI agents.
To read this post you'll need to become a member. Members help us fund our work to ensure we can stick around long-term.
See our plans (Opens in a new window)
Already a member? Log in (Opens in a new window)