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())
Native vs Semantic Functions
Native functions are decorated Python/C# methods that run your business logic:
from semantic_kernel.functions import kernel_function
class EmailPlugin:
@kernel_function(description="Send an email to a recipient")
def send_email(self, recipient: str, subject: str, body: str) -> str:
# your actual email sending logic
return f"Email sent to {recipient}"
Semantic functions are prompt templates stored as files — they call the LLM and return text. The AI can chain native and semantic functions together.
Memory and Vector Stores
Semantic Kernel includes a memory abstraction layer that works with multiple vector stores: Azure AI Search, Chroma, Pinecone, Weaviate, and in-memory. You store text with embeddings and retrieve by semantic similarity:
await kernel.memory.save_information("my-docs", id="doc1", text="Quarterly revenue was $4.2M")
results = await kernel.memory.search("my-docs", "what was the revenue?")
Process Framework
The newer Process Framework adds stateful, long-running workflows to Semantic Kernel — think multi-step business processes where state must persist across sessions. It's designed for enterprise scenarios like document review pipelines and approval workflows.
Azure AI Integration
Semantic Kernel integrates natively with Azure AI services including Azure OpenAI, Azure AI Search, and Azure AI Foundry. For Microsoft-stack enterprises already using Azure, this makes it the path of least resistance for production AI applications.