Agents & OrchestrationSûr100100/100
Migrating Semantic Kernel To Agents (Microsoft)
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".
ou envoie-le directement à ton agent.
Installer dans ton projet
$ curl -fsSL https://arboristhree.xyz/cli/install-skill.mjs -o /tmp/arboris-install-skill.mjs && node /tmp/arboris-install-skill.mjs migrating-semantic-kernel-to-agents__microsoft-upgrade-agent-plugins__plugins-upgrade-agent-extenders-upgrade-dotnet-upgrade-skills-lazy-libraries-bdd05d81de08Microsoft
microsoft/upgrade-agent-plugins
Contenu à copier
--- name: migrating-semantic-kernel-to-agents description: > 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". metadata: origin: Microsoft discovery: lazy traits: .NET|CSharp|VisualBasic|DotNetCore --- # Semantic Kernel to Agent Framework Migration ## Overview 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). ## Workflow ``` Migration Progress: - [ ] Step 1: Execute - [ ] Step 2: Validate ``` ### Step 1: Execute Execute continuously without pausing unless user interaction is truly needed. #### 1a. Update Package References For each project with **explicit** package dependencies (skip transitive-only consumers): 1. Read the project file to understand its structure and dependencies 2. Remove Semantic Kernel agent packages: - `Microsoft.SemanticKernel.Agents.Core` - `Microsoft.SemanticKernel.Agents.OpenAI` - `Microsoft.SemanticKernel.Agents.AzureAI` - `Microsoft.SemanticKernel` (only if used solely for agents) 3. Add Agent Framework packages based on provider (see `ref/provider-patterns.md` for the mapping): - `Microsoft.Agents.AI.Abstractions` (always required) - Provider-specific package (e.g., `Microsoft.Agents.AI.OpenAI`) 4. Never guess package versions - use available tools to determine the latest stable version **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: - Search for `Directory.Packages.props` starting from the project folder **upward** through parent directories - Read the existing file first to understand its structure - Edit (never recreate) the existing file: remove old `PackageVersion` entries, add new ones - Add `PackageReference` elements **without versions** in project files - Always use the full absolute path when editing `Directory.Packages.props` If projects specify versions directly in `PackageReference` elements, make all changes in the project file only. #### 1b. Update Code Files 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`: 1. Search for `Microsoft.SemanticKernel.Agents` in using statements, types, and API calls (skip comments and string literals) 2. Replace agent types, method calls, configuration patterns, and namespaces 3. Handle provider-specific patterns per `ref/provider-patterns.md` **Using statement rules:** - Replace SK agent using statements with AF equivalents - If no other SK agent API remains in the file, remove the using instead of replacing it - If no SK agent using statements existed originally, do not add AF using statements - Add namespace imports for types that moved (e.g., `Microsoft.Agents.AI` for `ChatClientAgent`) **Code preservation:** - Never add placeholder code or remove existing comments - Keep business logic as close to the original as possible - Track files/lines where conversion is impossible or may cause behavioral changes **NuGet names are case-insensitive** - account for this when searching or removing dependencies. #### 1c. Iterate Until Clean Search for `Microsoft.SemanticKernel.Agents` in all affected projects again. If any references remain, repeat step 1b. Continue until no SK agent references exist. ### Step 2: Validate 1. Run `dotnet build` on all modified projects - zero errors required 2. Fix all build errors without violating migration guidance 3. Verify using this checklist: - [ ] All `using Microsoft.SemanticKernel.Agents` statements replaced or removed - [ ] All `InvokeAsync` -> `RunAsync`, `InvokeStreamingAsync` -> `RunStreamingAsync` - [ ] Return types: `AgentRunResponse` (non-streaming), `IAsyncEnumerable<AgentRunResponseUpdate>` (streaming) - [ ] Thread creation uses `agent.GetNewThread()` - [ ] `[KernelFunction]` removed; `AIFunctionFactory.Create()` used - [ ] `AgentRunOptions` or `ChatClientAgentRunOptions` replaces `AgentInvokeOptions` - [ ] `RawRepresentation` replaces `InnerContent` ## Key Behavioral Differences These AF behaviors differ from SK and affect migration decisions: - **Automatic thread management**: AF manages thread state automatically. SK required manual thread updates in some scenarios (e.g., OpenAI Responses). - **Simplified tool registration**: AF uses direct `AIFunction` registration via `AIFunctionFactory.Create()` instead of the `KernelPlugin`/`KernelFunction` system. - **Unified return types**: Non-streaming returns `AgentRunResponse`; streaming returns `IAsyncEnumerable<AgentRunResponseUpdate>`. - **Two-level breaking glass**: For `ChatClient`-based agents, access underlying SDK objects by casting `RawRepresentation` to `ChatResponse`, then casting `ChatResponse.RawRepresentation` to the SDK type. - **Unified usage metadata**: Access via `response.Usage` (non-streaming) or `update.Contents.OfType<UsageContent>()` (streaming).
Colle ce Markdown dans ton agent ou utilise les boutons ci-dessus pour l’écrire dans ton projet.
Ce que fait Migrating Semantic Kernel To Agents (Microsoft)
[ ] Step 1: Execute
[ ] Step 2: Validate
`Microsoft.SemanticKernel.Agents.Core`
`Microsoft.SemanticKernel.Agents.OpenAI`
Comment utiliser Migrating Semantic Kernel To Agents (Microsoft)
1
Copie le prompt
Un clic copie le prompt packagé (ou l'envoie à ton agent).
2
L'agent installe le skill
Il ajoute le SKILL.md et ses ressources à ton projet.
3
Activation automatique
Le skill s'active dès que le contexte correspond.
Déclencheurs pour Migrating Semantic Kernel To Agents (Microsoft)
Dis simplement à ton agent quelque chose comme :
Applique le skill migrating-semantic-kernel-to-agents__microsoft-upgrade-agent-plugins__plugins-upgrade-agent-extenders-upgrade-dotnet-upgrade-skills-lazy-libraries-bdd05d81de08 à cette tâche
Utilise migrating-semantic-kernel-to-agents__microsoft-upgrade-agent-plugins__plugins-upgrade-agent-extenders-upgrade-dotnet-upgrade-skills-lazy-libraries-bdd05d81de08 pour améliorer cette implémentation
Passe en revue ce sujet avec migrating-semantic-kernel-to-agents__microsoft-upgrade-agent-plugins__plugins-upgrade-agent-extenders-upgrade-dotnet-upgrade-skills-lazy-libraries-bdd05d81de08
Skills liés à Migrating Semantic Kernel To Agents (Microsoft)
Acceleration (Microsoft)
Compare synthetic acceleration options and clearly separate scenario value from forecast commitments.Account Overview (Microsoft)
Create a synthetic Acme account overview and identify evidence that merits seller attention.Acroform Writer (Microsoft)
Use this skill whenever the user wants values written INTO an existing PDF form that lives in the connected SharePoint knowledge source — filling out, completing, populating, or submitting a fillable PDF (application, intake sheet, contract, government form) from data they supply, a spreadsheet row, or the conversation. Triggers include "fill out the job application form", "complete the intake form for [person]", "populate our standard NDA template", and "make this ready to send / non-editable" (flatten). The source form should be found via knowledge search; only ask the user to upload it if knowledge search turns up nothing plausible. different task), and do NOT use it on scanned/image-only PDFs that have no real fillable fields — those need OCR or manual overlay instead, which this skill explicitly detects and reports rather than silently failing.