AI & LLMs · Guide · AI & Prompt Tools
How to Use Semantic Kernel
Build intelligent agents using Microsoft's Semantic Kernel for C#, Python, or Java. Explore plugins, planners, and memory with this free, online guide — no registration required.
Semantic Kernel is Microsoft’s open-source SDK for orchestrating LLMs, plugins, and planners in C#, Python, or Java.
Advertisement
Where LangChain optimises for breadth and experimentation, Semantic Kernel targets enterprise apps: strong typing, dependency injection, telemetry, and first-class support for Azure OpenAI. It’s the framework powering much of Microsoft’s own Copilot surface.
What it is
Semantic Kernel exposes a Kernel object that wires together AI services (chat, embeddings, image), plugins (callable functions the model can invoke), memory (vector stores), and planners that turn a goal into a sequence of function calls. It’s available as NuGet, PyPI, and Maven packages with near-parity across languages.
Install / sign up
# Python pip install semantic-kernel # .NET dotnet add package Microsoft.SemanticKernel # Java # Add to pom.xml: # <dependency>com.microsoft.semantic-kernel:semantickernel-api</dependency> # Need an OpenAI or Azure OpenAI key
First session
Create a Kernel, register a chat service, and add a plugin. The model can then call your plugin functions automatically when it decides they’re relevant.
$ python
import semantic_kernel as sk
from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion
kernel = sk.Kernel()
kernel.add_service(OpenAIChatCompletion("gpt-4o", api_key))
kernel.add_plugin(parent_directory="./plugins", plugin_name="Weather")
reply = await kernel.invoke_prompt("What's the weather in Oslo?")
print(reply)Everyday workflows
- 1. Wrap existing REST APIs as plugins — the model will call them via function calling when appropriate.
- 2. Use the Handlebars or Stepwise planner to decompose complex goals into ordered plugin calls.
- 3. Plug in a memory store (Azure AI Search, Qdrant, Redis) for retrieval-augmented chat.
Gotchas and tips
Semantic Kernel leans heavily on dependency injection; in .NET especially, register services on the host builder rather than newing up a Kernel manually — you’ll get proper logging and configuration. Use the OpenTelemetry integration early so you can debug long plugin chains.
Planners can burn tokens quickly; prefer explicit function composition when the workflow is known and reserve planners for open-ended goals. The Python and .NET SDKs occasionally drift — pin versions in production and check release notes for breaking changes in the preview packages.
Who it’s for
Enterprise teams building Copilot-style features, especially on Azure, who want a supported SDK with strong typing and observability instead of a research-grade framework.
Use these while you read
Tools that pair with this guide
- System Prompt BuilderCompose a focused system prompt from a role, tone, constraints, and output format — copy-ready for any LLM.AI & Prompt Tools
- AI Prompt GeneratorTurn a vague idea into a structured prompt. Pick role, task, context, constraints, and output format. Works with ChatGPT, Claude, and Gemini.AI & Prompt Tools
- AI Token CounterEstimate tokens, characters, words, and approximate API cost for GPT-4o, GPT-4, Claude, and Gemini — before you hit send.AI & Prompt Tools
- AI Regex GeneratorDescribe what you want to match in plain English — get a canonical regex (email, URL, phone, UUID, etc.) plus a live test.AI & Prompt Tools
Advertisement
Continue reading
- AI & LLMsGitHub Copilot Pricing and ComparisonCompare free vs paid GitHub Copilot tiers and analyze it against ChatGPT, Cursor, and Tabnine. Find the best value plan instantly with this free online guide.
- AI & LLMsGitHub Copilot Features and CapabilitiesTest what Copilot really does — code accuracy, scope limits, debugging, web dev, legacy code, tests, docs, team customization. Free guide, no sign-up.
- AI & LLMsGitHub Copilot Security and Data HandlingAudit where your code goes, who sees it, training-data policy, network needs, and what happens when Copilot suggests broken code. Free, no sign-up.
- AI & LLMsAI Fluency SkillsThe 8 sub-skills of AI fluency: prompt structure, model selection, tool use, quality calibration, iteration, context management, cost awareness, privacy.
- AI & LLMsAnthropic Skills ExplainedSkills as Anthropic's answer to Custom GPTs — markdown-defined, version-controlled in git, work in terminal. Anatomy + Skills vs Custom GPTs.
- AI & LLMsKimi K2 vs DeepSeek V3Two open-weight Chinese flagships. Kimi K2 = 1M context, DeepSeek V3.2 = top-tier reasoning + coding. Pick by use case.