What Is Semantic Kernel?
Semantic Kernel is Microsoft's open-source SDK for building AI-powered applications. It targets enterprise developers building in C# or Python who need a structured, production-ready approach to integrating LLMs into existing software systems.
The key architectural idea: your business logic lives in plugins, the AI orchestrates those plugins using natural language, and the Kernel ties everything together.
Core Architecture
Kernel - the central object that holds configuration, services (LLM connections, memory stores), and plugins.
Plugins - collections of functions the AI can call. Plugins can be native (regular Python/C# functions) or semantic (prompt templates that themselves call an LLM).
Planners - AI-driven orchestrators that decompose a user goal into a sequence of plugin function calls.
import asyncio
from semantic_kernel import Kernel
from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion
from semantic_kernel.core_plugins import TimePlugin, MathPlugin
kernel = Kernel()
kernel.add_service(OpenAIChatCompletion(ai_model_id="gpt-4o", api_key="YOUR_KEY"))
kernel.add_plugin(TimePlugin(), plugin_name="time")
kernel.add_plugin(MathPlugin(), plugin_name="math")
async def main():
result = await kernel.invoke_prompt(
"What is 15% of the number of days until the end of the year from today?"
)
print(result)
asyncio.run(main())