TL;DR — Semantic Kernel (SK) is Microsoft's open-source SDK for integrating LLMs into enterprise applications. It's multi-language (C#, Python, Java), deeply integrated with Azure OpenAI, and designed around plugins (collections of functions the model can call). The kernel orchestrates model calls, plugin invocation, memory, and planning. If your stack is .NET/Azure, this is the natural choice.
What it is
Semantic Kernel is an SDK — not a framework with opinions about agent architecture, but a library you embed in your application. The Kernel object is the central orchestrator: you register AI services (models), plugins (functions), and memory (vector stores), then ask it to invoke prompts, call functions, or run an agent loop.
Fig 1 — The Kernel connects plugins, memory, and AI services into your application.
Why it exists
Enterprise .NET and Java shops need an AI integration layer that feels native to their stack — dependency injection, typed interfaces, enterprise auth. Semantic Kernel gives them that, with first-class Azure OpenAI support, while also working with OpenAI, Anthropic, Google, and local models.
Install & setup
# Python
pip install semantic-kernel
# C# (.NET)
dotnet add package Microsoft.SemanticKernel
Basic usage (Python)
from semantic_kernel import Kernel
from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion
kernel = Kernel()
kernel.add_service(AzureChatCompletion(
deployment_name="gpt-4o",
endpoint="https://your-endpoint.openai.azure.com/",
api_key="...",
))
result = await kernel.invoke_prompt("What is Kubernetes in one sentence?")
print(result)
Plugins — the core abstraction
A plugin is a class whose methods become functions the model can call. Native code functions and prompt template functions are treated identically.
from semantic_kernel.functions import kernel_function
class WeatherPlugin:
@kernel_function(description="Get weather for a city")
def get_weather(self, city: str) -> str:
return f"Sunny in {city}"
kernel.add_plugin(WeatherPlugin(), plugin_name="weather")
Agent loop
Enable auto function calling and the kernel runs a tool-calling loop — model picks functions, kernel executes them, feeds results back:
from semantic_kernel.connectors.ai.open_ai import OpenAIChatPromptExecutionSettings
settings = OpenAIChatPromptExecutionSettings(
function_choice_behavior="auto"
)
result = await kernel.invoke_prompt(
"What's the weather in London?",
settings=settings
)
Filters (middleware)
Filters let you intercept function calls, prompt rendering, and model invocations — for logging, auth checks, PII redaction:
from semantic_kernel.filters import FunctionInvocationContext
@kernel.filter(FunctionInvocationContext)
async def log_calls(context, next):
print(f"Calling: {context.function.name}")
await next(context)
print(f"Result: {context.result}")
When to use, when to skip
Use it if your team is .NET/Java, lives on Azure, or needs an SDK that fits enterprise patterns (DI, typed plugins, filters). Multi-language support means the same concepts work across your polyglot services.
Skip it if you're Python-only and want a richer agent ecosystem — LangChain or LangGraph have more integrations. If you want quick multi-agent setups, CrewAI or AutoGen are faster to prototype with.
vs the alternatives
| Tool | Best for | Trade-off |
|---|---|---|
| Semantic Kernel | Enterprise .NET/Java, Azure-first | Smaller Python ecosystem |
| LangChain | Python agents, huge integration catalog | Python-first |
| Pydantic AI | Type-safe Python agents | Python-only |
| Agno | Lightweight Python agents | Newer, smaller community |
Verified against Semantic Kernel docs (learn.microsoft.com/semantic-kernel), May 2026.