A comparative overview of LangChain, Semantic Kernel, AutoGen and more

Jane Huang
Data Science at Microsoft
5 min readFeb 20, 2024

By Jane Huang and Kirk Li

In this article, we delve into a comparative analysis of diverse strategies for developing applications empowered by Large Language Models (LLMs), encompassing OpenAI’s Assistant API, frameworks like LangChain, Semantic Kernel, AutoGen, and more. In the dynamic landscape of LLMs, the selection of an appropriate framework is paramount for the seamless integration of these models into applications. But fortunately, building an LLM-backed system doesn’t necessitate starting from square one.

Photo by Possessed Photography on Unsplash.

OpenAI’s Assistant API has emerged as a potent tool, streamlining the development of AI assistants within applications. Despite the convenience it offers, some experienced developers have raised reservations about potential drawbacks, citing concerns about its cost and observability issues in real-world services. While the Assistant API significantly minimizes development effort, there remains a lingering uncertainty regarding the long-term viability of its pricing model.

In contrast, alternative frameworks, such as LangChain, Semantic Kernel, and AutoGen, afford developers varying degrees of control and flexibility over their AI applications. These alternatives present a spectrum of choices, each catering to specific preferences and project requirements. Another prominent option available today is a “roll your own” solution that works without leveraging any SDKs or entrusting OpenAI to handle the complexities through its Assistant API. These choices not only differ in terms of flexibility but also in the level of development effort they entail. By providing developers with a range of alternatives, this article aims to empower them to make informed decisions aligned with their unique needs and aspirations for their projects.

Today, our focus revolves around the options offered by frameworks such as LangChain, Semantic Kernel, and AutoGen, each catering to different preferences and project requirements. Please note that the authors of this article do not assert novelty in any aspect of the frameworks discussed in this article. The contents have been sourced from open source documents with links and serve as a condensed representation of the authors’ learning and project experiences across various frameworks. It is essential to recognize that, due to the rapid evolution of AI technology, this article may not encompass the very latest developments over time.

In general, LangChain and Semantic Kernel share the common goal of integrating LLMs into applications but diverge in their approaches and features. LangChain necessitates explicit configuration of memory and context windows, unlike the Assistant API, which automates these aspects. While OpenAI’s Assistant API offering minimizes development effort, frameworks like LangChain and Semantic Kernel appeal to developers seeking a deeper understanding of and control over their AI applications. Those frameworks stand out by offering SDKs that bridge the gap between AI models and existing code. Those SDKs facilitate the integration of AI responses with real-world actions, making them ideal solutions for building fully automated AI agents capable of automating complex business processes. The extensibility achieved through plugins, tools, and connectors empowers developers to seamlessly orchestrate various existing code, offering flexibility in integrating AI services from different providers.

On the other hand, AutoGen, positioned as a multi-agent framework, differs from LangChain’s single-agent focus. It enables the creation of applications featuring multiple-agent collaboration, providing a versatile option for developers aiming for complex agent interactions. Understanding these distinctions is pivotal for developers who are deciding among these frameworks based on their project requirements and desired collaboration capabilities. In late January 2024, the creators of LangChain introduced LangGraph, another multi-agent workflow designed to tailor agent runtime. This release presents a significant departure in mental models compared to AutoGen. The key distinction lies in the framework’s approach to constructing agents. LangGraph promotes a method that entails explicitly defining distinct agents and their transition probabilities, depicting them as a graph. In contrast, AutoGen views this process more as a “conversation.” Moreover, LangGraph is seamlessly integrated into the LangChain ecosystem. This integration allows users to harness all LangChain integrations and take advantage of LangSmith observability features.

To initiate our comparative analysis, let’s delve into the foundational characteristics of several frameworks, as elucidated in Table 1. (Please drag the scrollbar to view the complete content that is not currently visible on the webpage due to width limitations). In this examination, we specifically compare three of the most widely recognized frameworks. It’s worth noting that there are additional intriguing but more specialized libraries — such as Guidance, Guardrails, Llama Index, and TypeChat — that developers might leverage for specific tasks during the development process. However, for the purpose of this article, we won’t be exploring those libraries in detail.

Table 1: Basic characteristics overview

Table 2: Sample lessons

Numerous valuable lessons on introduction can be found online. Here are a few examples:

Components of the frameworks

Next, let’s embark on a more in-depth exploration by scrutinizing and comparing the various components of the frameworks as shown in Tables 3–13.

Table 3: Component overview: actions orchestration

Table 4: Component overview: memory management

Table 5: Component overview: reusable components

Table 6: Component overview: prompt templates

Table 7: Component overview: document loaders

Table 8: Component overview: document transformation and splitting

Table 9: Component overview: construct sequence of calls

Table 10: Component overview: vector store

Table 11: Component overview: retriever

Table 12: Component overview: model I/O

Table 13: Component overview: data connection

Conclusion

As the landscape of LLMs continues to evolve, the choice of framework becomes a crucial decision for developers venturing into the realm of building sophisticated AI applications. Each option, whether it’s the streamlined convenience of the Assistant API or the granular control offered by frameworks such as LangChain, LangGraph, Semantic Kernel, and AutoGen comes with its own merits and considerations. Ultimately, the determination of which SDK to employ hinges on the specific needs, preferences, and objectives of developers, as well as the nature of the projects they are undertaking. Rather than a one-size-fits-all approach, the optimal solution may often involve a judicious combination of different SDKs, such as leveraging AutoGen in tandem with Semantic Kernel and OpenAI assistant API.

In his insightful blog post, John Maeda delves into the seamless integration of Semantic Kernel with AutoGen, shedding light on the synergies that can be harnessed. Additionally, Matthew Bolanos articulates a forward-looking vision for the future of Semantic Kernel by incorporating OpenAI assistants, as well as instructions in his series of publications “OpenAI Assistants: The Future of Semantic Kernel,” “OpenAI Assistants: a first look into using OpenAI Assistants with Semantic Kernel,” and “OpenAI Assistants: The power of templated assistant instructions” on Microsoft’s platform. Microsoft already has an experimental implementation that uses the OpenAI Assistants API (please refer to John Maeda’s SK basics samples); however, the team aims to completely abstract the agent interface to accommodate agents constructed with any model. To accomplish this, members of Microsoft’s semantic kernel team are utilizing the research findings from the AutoGen team to develop an abstraction capable of accommodating a wide range of experiences, including scenarios where agents collaborate as a team.

Further enriching the discourse, LangChain has disseminated comprehensive documentation elucidating the interaction between their framework and the OpenAI assistant. Gagan Bansal contributes to the conversation by exploring the integration of OpenAI assistants into AutoGen, a development discussed in detail through his insights on GPTAssistantAgent. In this dynamic landscape, staying informed about the collaborative possibilities among different SDKs is key to harnessing the full potential of Large Language Models in AI applications.

We would like to thank Casey Doyle for helping review the work.

--

--

Jane Huang
Data Science at Microsoft

Jane Huang is a principal ML scientist at Microsoft CX Data and AI team. She focuses on GAI/LLM applications, machine learning, and causal inference.