Semantic Kernel was the first AI library specifically created to build AI agent and chat experiences in .NET. Later the .NET team started working on Microsoft.Extensions.AI
as a common abstraction layer for integrating AI capabilities in your .NET applications. As a consequence, these 2 libraries have some overlap and similar abstractions exist in both libraries.
This post is part of a blog series. Other posts so far:
- Part I – An introduction to Microsoft.Extensions.AI
- Part II – ASP.NET Core integration
- Part III –Tool calling
- Part IV – Telemetry integration
- Part V – Chat history
- Part VI – Structured output
- Part VII - MCP integration
- Part VIII – Evaluations
- Part VIII – Evaluations (continued)
- Part IX (this post) - Semantic Kernel Integration
What now?
The good news is that Microsoft is actively working on aligning both libraries and (re)building Semantic Kernel on top of the same Microsoft.Extensions.AI
abstractions. This means that as a general recommendation you should start with the Microsoft.Extensions.AI
abstractions and move to Semantic Kernel when you need more high level features.
Combine Semantic Kernel with Microsoft.Extensions.AI
This native support for Microsoft.Extensions.AI types means you can now use Semantic Kernel with the broader Microsoft AI ecosystem more seamlessly, with consistent programming models and easy interoperability between different components.
Let me give an example on how both libraries can be combined…
We start by registering an Microsoft.Extensions.AI.ChatClient
inside a Semantic Kernel kernel :
We can later resolve this instance to use it inside our Chat app:
Of course, we can use the ChatClient
also indirectly through a ChatCompletionAgent
from Semantic Kernel:
More information
Semantic Kernel and Microsoft.Extensions.AI: Better Together, Part 1 | Semantic Kernel
Semantic Kernel and Microsoft.Extensions.AI: Better Together, Part 2 | Semantic Kernel
AI and Vector Data Extensions are now Generally Available (GA) - .NET Blog
Vector Data Extensions are now Generally Available (GA) | Semantic Kernel