TheEvolution of AI Agents frameworks: From Autogen to LangGraph
In the past, severallibraries such as Autogen and Langchain Agent Executor were usedto create AI agents and the workflow of their tasks. These tools aimed tosimplify and automate processes by enabling multiple agents to work together inperforming more complex tasks. But for the past several months, we have beenworking with LangGraph and felt in love with it for the significantimprovements it offers to AI developers.
Autogen was oneof the first frameworks and provided a much needed higher level of abstraction,making it easier to set up AI agents. However, the interaction between agentsfelt often somewhat like "magic" — too opaque for developers whoneeded more granular control over how the processes were defined and executed.This lack of transparency could lead to challenges in debugging andfine-tuning.
Then came LangchainAgent Executor, which allowed developers to pass "tools" toagents, and the system would keep calling these tools until it produced a finalanswer. It even allowed agents to call other agents, and the decision on whichagent to use next was managed by AI.
However, the LangchainAgent Executor approach had its drawbacks. For instance:
- It was difficult to track the individual steps of each agent. If one agent was responsible for searching Google and retrieving results, it wasn’t easy to display those results to the user in real-time.
- It also posed challenges in transferring information between agents. Imagine one agent uses Google to find information and another is tasked with finding related images. You might want the second agent to use a summary of the article as input for image searches, but this kind of information handoff wasn’t straightforward.
State ofthe art AI Agents framework? LangGraph!
LangGraphaddresses many of these limitations by providing a more modular and flexibleframework for managing agents. Here’s how it differs from its predecessors:
FlexibleGlobal State Management
LangGraph allowsdevelopers to define a global state. This means that agents can eitheraccess the entire state or just a portion of it, depending on their task. Thisflexibility is critical when coordinating multiple agents, as it allows forbetter communication and resource sharing. For instance, the agent responsiblefor finding images could be given a summary of the article, which it could useto refine its keyword searches.
ModularDesign with Graph Structure
At the core of LangGraphis a graph-based structure, where nodes represent either calls to alanguage model (LLM) or the use of other tools. Each node functions as a stepin the process, taking the current state as input and outputting an updatedstate.
The edges in thegraph define the flow of information between nodes. These edges can be:
- Optional: allowing the process to branch into different states based on logic or the decisions of the LLM.
- Required: ensuring that after a Google search, for example, the next step will always be for a copywriting agent to process the search results.
Debuggingand Visualization
LangGraph also enhancesdebugging and visualization. Developers can render the graph, making it easierfor others to understand the workflow. Debugging is simplified throughintegration with tools like Langsmith, or open-source alternatives like Langfuse.These tools allow developers to monitor the execution in real-time, displayingactions such as which articles were selected, what’s currently happening, andeven statistics like token usage.
TheTrade-Off: Flexibility vs. Complexity
While LangGraph offerssubstantial improvements in flexibility and control, it does come with asteeper learning curve. The ability to define global states, manage complexagent interactions, and create sophisticated logic chains gives developerslow-level control but also requires a deeper understanding of the system.
LangGraph marks asignificant evolution in the design and management of AI agents, offering apowerful, modular solution for complex workflows. For developers who needgranular control and detailed oversight of agent operations, LangGraph presentsa promising option. However, with great flexibility comes complexity, meaningdevelopers must invest time in learning the framework to fully leverage itscapabilities. That’s what we have done, making LangGraph our tool of choice forall complex GenAI solutions that need multiple agents working together.