Semantic Kernel
Microsoft's open-source SDK for integrating LLMs into applications. Model-agnostic (OpenAI, Azure OpenAI, Google, Hugging Face, Mistral, etc.), supports Python, C#, and Java. Provides plugins (tools), prompt templating, multi-agent orchestration (AgentChat framework), and vector store integrations for RAG. Production-stable as of v1.x. Currently the primary Microsoft-maintained AI framework (AutoGen is maintenance-only; Microsoft Agent Framework is the future successor).
Warnings
- breaking Azure Identity fallback authentication removed. In older versions, AzureChatCompletion would silently fall back to azure-identity DefaultAzureCredential if no api_key was provided. This implicit fallback has been removed. Code relying on it will now raise errors on import or at runtime.
- breaking SemanticTextMemory and MemoryStoreBase are deprecated and will be removed. The entire old memory store architecture (semantic_kernel.memory, semantic_kernel.connectors.memory_stores) has been superseded by the new VectorStore API.
- breaking Google connector migrated from google-generativeai SDK to the new google-genai SDK (v1.39.0, Feb 2026). If using the Google connector, the underlying dependency has changed.
- breaking Template argument encoding now throws on complex types. Previously, complex types (custom classes, anonymous types, collections) passed as prompt template arguments were silently not encoded. Now an exception is raised if automatic encoding is enabled (the default) and a complex type is passed.
- breaking sk_function decorator removed. The old @sk_function decorator from pre-1.0 is gone. All plugin methods must use @kernel_function.
- breaking SKContext removed. Replaced by KernelArguments. Any code importing or using SKContext will fail.
- gotcha azure-identity is NOT included in the base pip install semantic-kernel. Importing AzureChatCompletion (which requires Entra ID support) will fail with ImportError if azure-identity is not installed separately.
- gotcha Microsoft Agent Framework (successor to both AutoGen and Semantic Kernel) has reached Release Candidate status (Feb 2026). Semantic Kernel remains actively maintained but Microsoft is directing new agentic projects toward Agent Framework.
- gotcha Pydantic v1 is not supported. semantic-kernel requires Pydantic v2. If your project pins Pydantic v1 (e.g., via an older FastAPI or LangChain version), there will be a dependency conflict.
Install
-
pip install --upgrade semantic-kernel -
pip install --upgrade semantic-kernel[azure] -
pip install --upgrade semantic-kernel[google] -
pip install --upgrade semantic-kernel[all]
Imports
- Kernel
from semantic_kernel import Kernel
- AzureChatCompletion
from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion
- kernel_function decorator
from semantic_kernel.functions import kernel_function
- SemanticTextMemory (DEPRECATED)
from semantic_kernel.data.vector import VectorStoreField, vectorstoremodel
- KernelArguments
from semantic_kernel.functions import KernelArguments
Quickstart
import asyncio
from semantic_kernel import Kernel
from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion
from semantic_kernel.connectors.ai.open_ai import OpenAIChatPromptExecutionSettings
from semantic_kernel.contents import ChatHistory
async def main():
kernel = Kernel()
kernel.add_service(OpenAIChatCompletion(ai_model_id="gpt-4o"))
history = ChatHistory(system_message="You are a helpful assistant.")
history.add_user_message("Hello, what can you do?")
service = kernel.get_service(type=OpenAIChatCompletion)
settings = OpenAIChatPromptExecutionSettings()
response = await service.get_chat_message_content(chat_history=history, settings=settings, kernel=kernel)
print(response.content)
asyncio.run(main())