DEV Community

Alex Spinov
Alex Spinov

Posted on

Semantic Kernel Has a Free API You Should Know About

Semantic Kernel is Microsoft's SDK for integrating AI into .NET, Python, and Java applications. It provides a lightweight framework for building AI agents with plugins, planning, and memory.

Why Semantic Kernel for Enterprise AI

A .NET enterprise team needed to add AI capabilities to their existing C# codebase. LangChain was Python-only. Semantic Kernel gave them first-class .NET support with the same AI agent patterns.

Key Features:

  • .NET First — Built for C# developers (also supports Python and Java)
  • Plugin System — Turn any C# method into an AI-callable function
  • Auto Function Calling — AI automatically selects and calls your functions
  • Memory — Built-in conversation and semantic memory
  • Planners — AI creates and executes multi-step plans

Quick Start

dotnet add package Microsoft.SemanticKernel
Enter fullscreen mode Exit fullscreen mode
using Microsoft.SemanticKernel;

var kernel = Kernel.CreateBuilder()
    .AddOpenAIChatCompletion("gpt-4", apiKey)
    .Build();

var result = await kernel.InvokePromptAsync("What is the capital of France?");
Console.WriteLine(result);
Enter fullscreen mode Exit fullscreen mode

Plugins

public class WeatherPlugin
{
    [KernelFunction, Description("Gets the weather for a city")]
    public string GetWeather(string city) => $"Weather in {city}: 72F and sunny";
}

kernel.Plugins.AddFromType<WeatherPlugin>();

var settings = new OpenAIPromptExecutionSettings { FunctionChoiceBehavior = FunctionChoiceBehavior.Auto() };
var result = await kernel.InvokePromptAsync("What's the weather in Paris?", new(settings));
Enter fullscreen mode Exit fullscreen mode

Why Choose Semantic Kernel

  1. .NET native — perfect for C# codebases
  2. Plugin system — expose any method to AI
  3. Microsoft-backed — production-ready, actively maintained

Check out Semantic Kernel docs to get started.


Building .NET AI apps? Check out my Apify actors or email spinov001@gmail.com for custom solutions.

Top comments (0)