(+351) 21 24 10006  ·  info@bconcepts.pt
Carnaxide, Lisbon
Azure AI & Machine Learning
Azure AI & Machine Learning 2 min

Semantic Kernel: orchestrate AI agents with .NET and Python

João Barros 26 de December de 2025 2 min read

Semantic Kernel is Microsoft's open-source SDK for building AI applications that combine LLMs with native code, plugins, semantic memory and agent orchestration. It is the technical foundation behind Microsoft Copilot.

Core concepts

Kernel       → central engine that coordinates everything
Plugin       → collection of functions (native or semantic)
  KernelFunction → individual function (native in C#/Python or a prompt template)
Memory       → persistent vector context (internal RAG)
Planner      → automatically selects and chains functions to achieve a goal

Create a kernel and call an LLM

import asyncio
from semantic_kernel import Kernel
from semantic_kernel.connectors.ai.open_ai import AzureChatCompletion

kernel = Kernel()
kernel.add_service(AzureChatCompletion(
    deployment_name="gpt-4o",
    endpoint=os.environ["AZURE_OPENAI_ENDPOINT"],
    api_key=os.environ["AZURE_OPENAI_KEY"]
))

# Inline semantic function
answer = await kernel.invoke_prompt(
    "Translate this text into formal English: {{$input}}",
    input="The sales report is ready for review."
)
print(answer)

Native plugin — expose code to the LLM

from semantic_kernel.functions import kernel_function

class SalesPlugin:
    @kernel_function(description="Returns total sales for a month")
    def get_monthly_sales(self, month: str, year: str) -> str:
        # Real logic: SQL query, API, etc.
        return f"Sales for {month}/{year}: 125,430€"

kernel.add_plugin(SalesPlugin(), plugin_name="sales")

# The LLM can now call this function automatically when relevant
answer = await kernel.invoke_prompt(
    "What were the total sales in March 2024?",
    # The planner decides to call get_monthly_sales(month='March', year='2024')
)

Semantic memory

from semantic_kernel.memory import SemanticTextMemory

memory = SemanticTextMemory(storage=..., embeddings_generator=...)
await memory.save_information("policies", id="vacation", text="Employees have 22 vacation days per year...")

# Retrieve relevant context
results = await memory.search("policies", "how many vacation days do I have?")
print(results[0].text)

Conclusion

Semantic Kernel is the most mature SDK for building enterprise assistants with LLMs on the Microsoft stack. The plugin abstraction lets the LLM call real code (SQL queries, APIs) instead of just generating text — that is what differentiates a chatbot from a useful agent.

Share: