Skip to content

Migration from SK and AutoGen

Key Points

  • From SK to Agent Framework: replace Kernel + Plugins with IChatClient + Agent. Replace ChatHistory with AgentThread. Drop SK Planners.
  • From AutoGen (Python) to Agent Framework (.NET): port group chat to GroupChatOrchestration; rewrite tools as .NET methods.
  • Both migrations: incremental OK. Run both in parallel during transition.
  • Don't migrate just for the sake of it — production SK apps still fine. Migrate when adding new features.

SK → Agent Framework

Before (SK)

var kernel = Kernel.CreateBuilder()
    .AddOpenAIChatCompletion("gpt-4o-mini", apiKey)
    .Build();

kernel.Plugins.AddFromType<WeatherPlugin>();

var history = new ChatHistory();
history.AddUserMessage("What's the weather?");

var settings = new OpenAIPromptExecutionSettings
{
    FunctionChoiceBehavior = FunctionChoiceBehavior.Auto()
};

var resp = await kernel.GetRequiredService<IChatCompletionService>()
    .GetChatMessageContentAsync(history, settings, kernel);

After (Agent Framework)

IChatClient chat = new OpenAIClient(apiKey).AsChatClient("gpt-4o-mini")
    .AsBuilder().UseFunctionInvocation().Build();

var agent = new ChatClientAgent(chat)
{
    Tools = [
        AIFunctionFactory.Create(GetWeather),
        AIFunctionFactory.Create(GetForecast)
    ]
};

var resp = await agent.InvokeAsync("What's the weather?");

Cleaner; vendor-portable; OTel-friendly.

Mapping

SK Agent Framework
Kernel IChatClient + agent
Plugin List of AIFunction
ChatHistory IList<ChatMessage> or AgentThread
KernelFunction AIFunction
IChatCompletionService IChatClient
Planners Function calling auto

Step-by-step

  1. Replace Kernel construction with IChatClient (via Microsoft.Extensions.AI.OpenAI).
  2. Convert plugins: each [KernelFunction] becomes a method with [Description]. AIFunctionFactory.Create(method).
  3. Replace ChatHistory with IList<ChatMessage> or AgentThread.
  4. Drop planners: FunctionChoiceBehavior.Auto already handled by UseFunctionInvocation().
  5. Adapt prompts: SK prompt templating → string interpolation or your own templating.
  6. Tests: re-run; eval suite ensures parity.

Things SK still does

  • Prompt template engine (Liquid / Handlebars).
  • Some plugins not yet ported.
  • Hybrid: use SK for templates; Agent Framework for execution.

AutoGen → Agent Framework

AutoGen (Python) supports group chat. Equivalents in Agent Framework:

# AutoGen
agent_a = ConversableAgent(name="A", ...)
agent_b = ConversableAgent(name="B", ...)
groupchat = GroupChat(agents=[agent_a, agent_b], max_round=5)
manager = GroupChatManager(groupchat=groupchat)
user_proxy.initiate_chat(manager, message="...")
// Agent Framework
var agentA = new ChatClientAgent(chat) { Name = "A" };
var agentB = new ChatClientAgent(chat) { Name = "B" };
var orch = new GroupChatOrchestration(
    members: [agentA, agentB],
    selectionStrategy: ...,
    terminationStrategy: new MaxTurnsTerminationStrategy(5));
var resp = await orch.InvokeAsync("...");

Mapping

AutoGen Agent Framework
ConversableAgent ChatClientAgent
GroupChatManager GroupChatOrchestration
register_function AIFunctionFactory.Create
initiate_chat InvokeAsync

Incremental migration

Week 1: Add Microsoft.Extensions.AI; introduce IChatClient.
Week 2: Migrate one feature; SK remains for rest.
...
Month N: Full migration.

Both can coexist in same app.

When NOT migrate

  • Production SK app: stable; team familiar.
  • New work in same app: hybrid OK.
  • Tight timelines.

When DO migrate

  • New project.
  • Adding new agent/orchestration features.
  • Wanting OTel GenAI conventions.
  • Vendor-portable code (Anthropic / Gemini / etc.).
  • Cost (Microsoft.Extensions.AI free; SK still free).

Common gotchas

  • Prompt differences: SK uses Handlebars; Agent Framework expects raw strings. Port carefully.
  • Plugin discovery: SK auto-loads plugins; Agent Framework explicit.
  • Streaming differences: APIs slightly different; update consumers.
  • Memory model: SK ChatHistory ≠ AgentThread; thread management differs.

Senior considerations

  • Eval before / after: ensure response quality preserved.
  • Cost compare: prompts may shift; check token usage.
  • Logs: tool call schemas may differ; update dashboards.
  • Plan for partial migration — don't block on full conversion.

Cross-references