microsoft/migrating-semantic-kernel-to-agents
> Migrates .NET projects from Microsoft Semantic Kernel Agents (Microsoft.SemanticKernel.Agents) to Microsoft Agent Framework (Microsoft.Agents.AI). Handles NuGet package updates, namespace changes, agent creation, tool registration, thread management, and invocation transformations. Use when migrating ChatCompletionAgent, OpenAIAssistantAgent, AzureAIAgent, OpenAIResponseAgent, or A2AAgent to Agent Framework. Triggers for "semantic kernel to agents", "migrate SK agents", "upgrade agents framework", "ChatCompletionAgent to ChatClientAgent", "Microsoft.SemanticKernel.Agents to Microsoft.Agents.AI".
npx skills add https://github.com/microsoft/upgrade-agent-plugins --skill migrating-semantic-kernel-to-agents
Migrate .NET projects from Microsoft.SemanticKernel.Agents to Microsoft.Agents.AI (Agent Framework). The migration involves updating NuGet packages, namespaces, agent creation patterns, tool registration, thread management, and invocation methods.
API mappings and code examples: Read ref/api-mappings.md for detailed type/method/pattern transformations.
Provider-specific patterns: Read ref/provider-patterns.md for per-provider migration (OpenAI, Azure OpenAI, Assistants, Azure AI Foundry, A2A, Responses).
Migration Progress:
- [ ] Step 1: Execute
- [ ] Step 2: Validate
Execute continuously without pausing unless user interaction is truly needed.
For each project with explicit package dependencies (skip transitive-only consumers):
Microsoft.SemanticKernel.Agents.CoreMicrosoft.SemanticKernel.Agents.OpenAIMicrosoft.SemanticKernel.Agents.AzureAIMicrosoft.SemanticKernel (only if used solely for agents)ref/provider-patterns.md for the mapping):Microsoft.Agents.AI.Abstractions (always required)Microsoft.Agents.AI.OpenAI)Central Package Management (CPM):
If PackageReference elements lack versions or use VersionOverride, the project uses CPM. Handle it carefully because creating a duplicate props file or using wrong paths causes silent build failures:
Directory.Packages.props starting from the project folder upward through parent directoriesPackageVersion entries, add new onesPackageReference elements without versions in project filesDirectory.Packages.propsIf projects specify versions directly in PackageReference elements, make all changes in the project file only.
Find all code files in affected projects (including transitive dependents) that reference SK agent APIs. Use search tools and pass each project's root folder.
Apply transformations from ref/api-mappings.md:
Microsoft.SemanticKernel.Agents in using statements, types, and API calls (skip comments and string literals)ref/provider-patterns.mdUsing statement rules:
Microsoft.Agents.AI for ChatClientAgent)Code preservation:
NuGet names are case-insensitive - account for this when searching or removing dependencies.
Search for Microsoft.SemanticKernel.Agents in all affected projects again. If any references remain, repeat step 1b. Continue until no SK agent references exist.
dotnet build on all modified projects - zero errors requiredusing Microsoft.SemanticKernel.Agents statements replaced or removedInvokeAsync -> RunAsync, InvokeStreamingAsync -> RunStreamingAsyncAgentRunResponse (non-streaming), IAsyncEnumerable<AgentRunResponseUpdate> (streaming)agent.GetNewThread()[KernelFunction] removed; AIFunctionFactory.Create() usedAgentRunOptions or ChatClientAgentRunOptions replaces AgentInvokeOptionsRawRepresentation replaces InnerContentThese AF behaviors differ from SK and affect migration decisions:
AIFunction registration via AIFunctionFactory.Create() instead of the KernelPlugin/KernelFunction system.AgentRunResponse; streaming returns IAsyncEnumerable<AgentRunResponseUpdate>.ChatClient-based agents, access underlying SDK objects by casting RawRepresentation to ChatResponse, then casting ChatResponse.RawRepresentation to the SDK type.response.Usage (non-streaming) or update.Contents.OfType<UsageContent>() (streaming).Take microsoft/migrating-semantic-kernel-to-agents from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.