Q&A
Integrating AI into Your Existing Applications Using Semantic Kernel and C#
As AI continues to reshape the way developers build applications, Microsoft's Semantic Kernel is emerging as a powerful tool for integrating AI-driven capabilities into existing codebases -- without requiring developers to switch programming languages. At the upcoming Visual Studio Live! conference in Las Vegas, Marcel de Vries, Global MD & CTO at Xebia, will present a session on how developers can leverage Semantic Kernel to build AI-enhanced applications with C#.
Semantic Kernel is an open-source SDK from Microsoft designed to help developers orchestrate AI models from OpenAI, Azure OpenAI, and Hugging Face. It allows for seamless AI integration within existing applications, making it possible to build copilot-like experiences and automate complex tasks using generative AI. With support for multiple programming languages -- including C#, Python, and Java -- Semantic Kernel abstracts much of the complexity of working with large language models (LLMs), making it easier for developers to incorporate AI-powered features into their software.
[Click on image for larger view.] Semantic Kernel Agents (source: Microsoft).
In his intermediate-level session, titled "Integrating AI into Your Existing Applications Using Semantic Kernel & C#," de Vries will walk attendees through the core capabilities of Semantic Kernel, explore how it simplifies AI orchestration, and discuss how developers can extend it with plugins, memory integrations, and additional AI models. He'll also address some of the challenges of working with LLMs and share strategies for making AI-infused applications more scalable and maintainable.
Ahead of his talk, de Vries spoke with Visual Studio Magazine about the potential of Semantic Kernel, how it enables agentic AI workflows, and the practical considerations developers should keep in mind when implementing AI-driven functionality.
VisualStudioMagazine: What inspired you to present a session on this topic?
de Vries: As a C# developer I have been reluctant to pick up the Python programming language that is used mostly in the AI world. And I found this great set of libraries that would help me implement AI-related features into my own applications without the need of learning a new language.
"I am very happy with C# and I get excited when Microsoft also sees ways to further empower our C# community and make it possible to do all great things with LLMs, RAG and agents when being a C# developer."
Marcel de Vries, Global MD & CTO, Xebia
I am very happy with C# and I get excited when Microsoft also sees ways to further empower our C# community and make it possible to do all great things with LLMs, Retrieval Augmented Generation (RAG) and agents when being a C# developer.
What are the primary capabilities of Semantic Kernel, and how does it differentiate itself from other AI orchestration frameworks?
Semantic Kernel is Microsoft's attempt to capture all the hard work that is done in the various product groups at Microsoft and make this available to a broader audience without the need to learn a new language. Semantic Kernel even comes with support for Java, Python and C# as the languages you can use with Semantic Kernel.
Since Microsoft is capturing all the work they do with AI in this library, it becomes more or less the place where you can find how to implement your own AI smartness in your applications. It is very practical in nature and it adopted all the things we know from other .NET frameworks like ASP.NET, Blazor and .NET MAUI. It uses the same Dependency Injection concepts, the same way of getting and configuring services you need, and this appeals to me a lot. It also integrates with OpenTelemetry, making sure your application can go beyond the proof of concept, and has good observability capabilities so your managed services team or DevOps team will also love what has been built, because it becomes good maintainable software.
Everything is about agentic AI these days, so how does SK help developers get started in this hot new area?
Yes, all the talks are about agentic AI nowadays, and Semantic Kernel is where Microsoft is capturing their practices regarding how to build agents. Now, I must say this is still very experimental, and every release contains lots of changes since we are currently figuring out in our industry what good looks like. This is an immature field at the moment, and SK is adopting what currently is used and tried at Microsoft and gives us the ability to use already tried and proven ways of creating agent workflow.
Can you elaborate on some other key types of applications or use cases best suited for Semantic Kernel?
Actually, the type of applications where you can use Semantic Kernel is any application you currently have that can be compiled against .NET Core. The Semantic Kernel provides the libraries to talk to various LLMs, and you can implement any scenario you can think of and then add that to your current applications. It can talk to OpenAI or Azure OpenAI, which also makes it great for use in the enterprise since it integrates so well with Azure and keeps your data private.
Use cases vary based on the models you use. You can talk to DALL-E, for example, and there you can have it generate images for you based on your data in your application. You can also use the latest OpenAI models, and you can send multimodal input as well. So, e.g., a picture and a prompt, and both sets of data are used as the context of the generation of results. You can also leverage a ChatGPT model to have visual input and interpret the input and get you data back. The use cases are infinite; it is more how you imagine the possibilities in your solution domain which is often the biggest challenge.
What challenges should developers anticipate when incorporating Semantic Kernel into their workflows?
First of all, how do you access the actual LLMs? Do you want to run them locally, at OpenAI, in the cloud of your choice? This is something you need to decide, and for this, you also need to set up secure practices so you don't leak the credentials you use for the models and APIs. Especially when you publish your code on a public repository, many scanning tools are looking for your keys and they will use them and ramp up a bill on your behalf!
Furthermore, Semantic Kernel -- and you might say the whole field of generative AI -- is immature, and hence, things have changed a lot. The Semantic Kernel team does publish versions of their libraries, but be aware that you will get to deal with the changes various vendors are making in how to use these models. And the Semantic Kernel libraries will change accordingly. So you need to make sure you can deal with that change all the time and ensure you have time on the backlog to keep up with the changes. Otherwise, you can be in for a treat in the near future. For example, the whole notion of the planner has changed significantly, and you need to change not only your code but also your approach, and that is way more work than a library update.
Also, the field of agents and agentic AI is very much in flux. It's great to experiment, but at the time of this writing, it's not something I would consider production ready yet. I expect a lot of churn in that area.
What strategies or features enable Semantic Kernel to create copilot-like experiences within applications?
Actually, the best way to create a copilot-like experience is to use Semantic Kernel together with another library called Kernel Memory. Kernel Memory abstracts away for you the notion of memory and that memory can be filled with your data based on standardized RAG patterns. You can map that to internal memory or to a backend on Azure that uses vector search, blob storage, functions, and queues to ingest documents like PowerPoint, Word, PDF, Text, Markdown, etc., and this you can feed to Semantic Kernel as a plugin. This plugin can provide more context to solve your questions and power your copilot application. I will also address this in my talk and show how to use Kernel Memory.
What resources would you recommend for developers to get up to speed with Semantic Kernel and prepare for your session?
It is beneficial if you have some ideas on what you would like to build. What are the scenarios you have in mind to use generative AI? When you have the scenarios clear in your mind, this session will give you your lightbulb moments on how to make it happen. It is good to have some basic idea what generative AI is and what it can do. I do see a lot of people still struggle with those basics and that might not help you pick up the concepts how Semantic Kernel is built and can be used in your app.
Note: Those wishing to attend the conference can save hundreds of dollars by registering early, according to the event's pricing page. "Save $300 when you register by the Early Bird savings deadline of Feb. 14," said the organizer of the event, which is presented by the parent company of Visual Studio Magazine.
About the Author
David Ramel is an editor and writer at Converge 360.