Semantic Kernel: A Practical Guide for Developers
How Semantic Kernel works: the kernel, plugins, auto function calling, agents, orchestration, vector stores, and its status next to Microsoft Agent Framework.
Semantic Kernel is Microsoft’s open-source SDK for wiring large language models into ordinary application code. You register AI services and your own functions with it, and it handles the back-and-forth when a model decides to call one of those functions. It also has an agent layer and multi-agent orchestration on top. This guide walks through each piece with the official examples, then covers the part many tutorials skip: Microsoft has named a successor, Microsoft Agent Framework, and you should know what that means before you start something new.
At a glance
| Semantic Kernel | |
|---|---|
| What it is | Model-agnostic SDK for building agents and connecting LLMs to your code |
| Languages | C#, Python, Java |
| Runtime requirements | Python 3.11 to 3.14, .NET 10.0+, JDK 17+ on Windows, macOS or Linux |
| Licence | MIT (GitHub API) |
| Install | pip install semantic-kernel or dotnet add package Microsoft.SemanticKernel |
| Status | Supported as v1.x; Microsoft calls Agent Framework its successor |
| Source | github.com/microsoft/semantic-kernel |
Our Semantic Kernel directory entry collects the repository details in one place.
The kernel
The kernel is the object everything else hangs off. Microsoft describes it as a dependency injection container: you give it services and plugins, and the rest of the SDK pulls what it needs from it.
- Services are AI services such as chat completion, plus supporting ones like logging and HTTP clients.
- Plugins are the code your AI services call to do work, for example reading a database or hitting an external API.
When you run a prompt through the kernel it picks an AI service, renders the prompt template, sends the request, parses the reply and hands the result back to your code. You can attach events and middleware to each of those steps, which gives you one place for logging, progress updates and responsible-AI checks. The kernel can also expose its registered functions as an MCP server so other applications can use them.
Plugins and functions
A plugin is a named group of functions the model is allowed to call. Other frameworks call these tools or actions; Semantic Kernel says “functions” because they are usually native methods in your codebase. The descriptions matter as much as the code. The model chooses which function to call from the text you attach to each function and its parameters, so vague descriptions lead to wrong calls.
You can bring plugins in three ways:
- Native code: a class whose methods carry the
KernelFunctionattribute in C# or the@kernel_functiondecorator in Python. Microsoft suggests starting here. - An OpenAPI specification, which lets you share one plugin across languages and platforms.
- An MCP server.
Microsoft also suggests snake_case names for functions and parameters even in C# or Java, since most models learned function calling from Python. Its docs separate retrieval functions, which feed data to the model and benefit from caching, from task automation functions, where it recommends a human approval step before anything runs.
How auto function calling works
Function calling is where Semantic Kernel saves the most code. Automatic invocation is the default. On each request it:
- turns every function in the kernel into a JSON schema description;
- sends those schemas with the chat history to the model;
- reads the reply, which is either a normal message or one or more function calls;
- if it is a call, pulls out the function name and arguments;
- runs the matching function in the kernel;
- adds the result to the chat history and sends it back to the model.
Steps 2 to 6 repeat until the model answers with a plain message or a maximum iteration count is hit. In C# you turn this on with FunctionChoiceBehavior.Auto() in the prompt execution settings; Python sets function_choice_behavior on its settings object. If you would rather run functions yourself, manual invocation is also available.
A working agent with a plugin
The repository README includes this Python example. It is shown here without the README’s structured-output settings. A ChatCompletionAgent gets a MenuPlugin, and the model calls get_specials and get_item_price on its own to answer the question. It reads Azure OpenAI settings from environment variables such as AZURE_OPENAI_API_KEY.
import asyncio
from typing import Annotated
from semantic_kernel.agents import ChatCompletionAgent
from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion
from semantic_kernel.functions import kernel_function
class MenuPlugin:
@kernel_function(description="Provides a list of specials from the menu.")
def get_specials(self) -> Annotated[str, "Returns the specials from the menu."]:
return """
Special Soup: Clam Chowder
Special Salad: Cobb Salad
Special Drink: Chai Tea
"""
@kernel_function(description="Provides the price of the requested menu item.")
def get_item_price(
self, menu_item: Annotated[str, "The name of the menu item."]
) -> Annotated[str, "Returns the price of the menu item."]:
return "$9.99"
async def main():
agent = ChatCompletionAgent(
service=AzureChatCompletion(),
name="SK-Assistant",
instructions="You are a helpful assistant.",
plugins=[MenuPlugin()],
)
response = await agent.get_response(messages="What is the price of the soup special?")
print(response.content)
asyncio.run(main())
Install with pip install semantic-kernel. Extras such as pip install semantic-kernel[azure] pull in tested versions of the provider SDKs for a given service.
Agents and orchestration
The Semantic Kernel Agent Framework builds agents from the same kernel, plugins and AI services. In Python the semantic-kernel.agents module contains ChatCompletionAgent, OpenAIAssistantAgent, AzureAIAgent and OpenAIResponsesAgent. In .NET you add Microsoft.SemanticKernel.Agents.Core for ChatCompletionAgent alongside the core package.
ChatCompletionAgent works with any chat completion service the kernel supports. To keep a conversation going across calls, pass it a ChatHistoryAgentThread. An agent can also be handed to another agent as a plugin, which is how the README’s triage example sends billing and refund questions to specialist agents.
For coordinating several agents, the orchestration package ships five patterns:
| Pattern | What it does |
|---|---|
| Concurrent | Sends the same task to every agent and gathers each result |
| Sequential | Runs agents in a fixed order, each taking the previous output |
| Handoff | Passes control between agents based on context or rules |
| Group chat | Agents share one conversation, steered by a manager |
| Magentic | A group-chat style pattern modelled on MagenticOne |
All five share one interface. You build the orchestration from your agents, start an InProcessRuntime, invoke it with a task and await the result. Two caveats: orchestration is marked experimental and may change significantly, and the Java SDK does not have it yet.
Memory and vector stores
Semantic Kernel’s vector store connectors give you one interface for creating collections and for adding, fetching and deleting records, so you can test against a local store and switch to a hosted one later. In .NET the abstraction lives in Microsoft.Extensions.VectorData.Abstractions, with connectors for Azure AI Search, Azure Cosmos DB, MongoDB, Qdrant, Redis, SQLite and Weaviate. Python ships its own abstraction and built-in implementations. Any vector store can be wrapped as a text search source for retrieval-augmented generation. The docs label this area preview or release candidate, depending on the language tab, so expect occasional breaking changes. Older code may still use the legacy Memory Store connectors.
On the model side, the C# connector packages cover OpenAI, Azure OpenAI, Azure AI Inference, Amazon, Google, Hugging Face, Mistral AI, Ollama and ONNX.
Semantic Kernel and Microsoft Agent Framework
This is the part to read before you commit. The Semantic Kernel README now opens by saying the project “is now Microsoft Agent Framework” and calls Agent Framework its “enterprise-ready successor”. It adds that Agent Framework has reached version 1.0 with stable APIs and long-term support. The Agent Framework overview says it was built by the same teams as Semantic Kernel and AutoGen, keeping Semantic Kernel’s enterprise features such as sessions, type safety, filters and telemetry, and adding graph-based workflows. It runs on .NET and Python, with Go in public preview.
On support, Microsoft’s Agent Framework blog post on Semantic Kernel treats Agent Framework as Semantic Kernel v2.0. Version 1.x stays supported: critical bugs and security issues will be fixed and some existing features will still reach general availability, but most new work goes into Agent Framework. Microsoft commits to supporting Semantic Kernel while many developers still use it, and for at least one year after Agent Framework became generally available.
The migration guide lists what changes when you move:
| Semantic Kernel | Agent Framework |
|---|---|
Microsoft.SemanticKernel namespaces | Microsoft.Agents.AI plus Microsoft.Extensions.AI types |
Every agent needs a Kernel | Agents are created straight from a provider client |
| Tools wrapped in plugins added to a kernel | Tools passed to the agent when it is created; no plugin concept |
| You create the right thread type yourself | The agent creates a session for you |
InvokeAsync streams back several items | RunAsync returns one AgentResponse |
One semantic-kernel package with extras | agent-framework-core plus separate provider packages |
For a side-by-side of Agent Framework against LangGraph, CrewAI and others, see our agent frameworks comparison. If you are weighing it against a sandboxed agent runtime, read NemoClaw vs Microsoft Agent Framework. More libraries are listed under agent frameworks.
When Semantic Kernel still makes sense
- You already run Semantic Kernel in production and it does what you need. It stays supported and gets security fixes, so there is no rush.
- Your team works in Java. Agent Framework’s documentation lists .NET, Python and Go, so Semantic Kernel is the Microsoft option with a Java SDK.
- You rely on kernel-centred features such as prompt templates, filters and the plugin model, and you want to plan the migration rather than do it under pressure.
For a new agent project in C# or Python, Microsoft’s own guidance points to Agent Framework, and the migration guide is the place to start if you are porting existing code.
Written by AI Agents Directory
Editorial team
Facts in this guide are checked against official documentation and repositories, which are linked in the article.