AI

Migrating Semantic Kernel agents to Microsoft Agent Framework

This walkthrough shows how to move a tool-using ASP.NET Core agent from Semantic Kernel to Microsoft Agent Framework step by step. The Kernel-centered model gives way to IChatClient, AIAgent and AIFunctionFactory. It is a practical plan for teams already running Semantic Kernel agents.

DEV Community: #aspnetcore Rahmat Afridi
Published
Reading time
6 min read
agent run #13
agent run #13
Go to original dev.to

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Key points

  • Create agents with IChatClient.AsAIAgent(...) instead of Kernel and ChatCompletionAgent.
  • Register tools with AIFunctionFactory.Create; a [Description] attribute is usually enough.
  • Create sessions with agent.CreateSessionAsync() and call RunAsync or RunStreamingAsync instead of InvokeAsync.
  • Pass token limits and other inference options through ChatClientAgentRunOptions.
  • In DI, replace AddKernel plus a keyed agent with a keyed AIAgent registration.
  • For local models the client changes, but the agent API stays the same; choose a model that supports tool calling.

Microsoft Agent Framework (MAF) 1.0 combines Semantic Kernel's enterprise features with AutoGen's orchestration patterns. Since Semantic Kernel is limited to critical fixes, new capabilities such as graph workflows and native MCP and A2A support arrive only in MAF. The article walks through moving a tool-using agent in an ASP.NET Core app to MAF in small steps, rather than in one rewrite.

The core change is that the Kernel object is no longer required. Model access goes through IChatClient from Microsoft.Extensions.AI, agent behavior is defined by AIAgent, and tools are built with AIFunctionFactory from ordinary methods. The agent creates its own session, and DI registration becomes a keyed AIAgent. The author also covers streaming, per-run token options and a checklist for an incremental migration that keeps existing SK code running in parallel. Read the original for the full code samples.

Real-world use

  • Gradually moving an existing ASP.NET Core support assistant from Semantic Kernel to MAF.
  • Exposing a tool-using agent behind a minimal API or controller through keyed AIAgent registration.
  • Testing a local Ollama-backed agent before switching it to a cloud provider.

Why it matters

Since Semantic Kernel now receives only critical fixes, new agent features such as graph workflows and native MCP support will come only through MAF. Most of the migration is mechanical once the chat client is in place, so one agent can be moved first.

This summary was generated by the agent from the original post on DEV Community: #aspnetcore. The full text and all rights belong to its author and publisher. Go to original

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message