Skip to content

Commit c88f889

Browse files
committed
Update the migration guidelines with latest changes
1 parent 551219c commit c88f889

File tree

1 file changed

+22
-72
lines changed

1 file changed

+22
-72
lines changed

.github/upgrades/prompts/SemanticKernelToAgentFramework.md

Lines changed: 22 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -142,9 +142,9 @@ Replace these Semantic Kernel agent classes with their Agent Framework equivalen
142142
|----------------------|----------------------------|-------------------|
143143
| `IChatCompletionService` | `IChatClient` | Convert to `IChatClient` using `chatService.AsChatClient()` extensions |
144144
| `ChatCompletionAgent` | `ChatClientAgent` | Remove `Kernel` parameter, add `IChatClient` parameter |
145-
| `OpenAIAssistantAgent` | `AIAgent` (via extension) | **New**: `OpenAIClient.GetAssistantClient().CreateAIAgent()` <br> **Existing**: `OpenAIClient.GetAssistantClient().GetAIAgent(assistantId)` |
145+
| `OpenAIAssistantAgent` | `AIAgent` (via extension) | ⚠️ **Deprecated** - Use Responses API instead. <br> **New**: `OpenAIClient.GetAssistantClient().CreateAIAgent()` <br> **Existing**: `OpenAIClient.GetAssistantClient().GetAIAgent(assistantId)` |
146146
| `AzureAIAgent` | `AIAgent` (via extension) | **New**: `PersistentAgentsClient.CreateAIAgent()` <br> **Existing**: `PersistentAgentsClient.GetAIAgent(agentId)` |
147-
| `OpenAIResponseAgent` | `AIAgent` (via extension) | Replace with `OpenAIClient.GetOpenAIResponseClient().CreateAIAgent()` |
147+
| `OpenAIResponseAgent` | `AIAgent` (via extension) | Replace with `OpenAIClient.GetOpenAIResponseClient(modelId).CreateAIAgent()` |
148148
| `A2AAgent` | `AIAgent` (via extension) | Replace with `A2ACardResolver.GetAIAgentAsync()` |
149149
| `BedrockAgent` | Not supported | Custom implementation required |
150150

@@ -529,14 +529,14 @@ AIAgent agent = new OpenAIClient(apiKey)
529529
.CreateAIAgent(instructions: instructions);
530530
```
531531

532-
**OpenAI Assistants (New):**
532+
**OpenAI Assistants (New):** ⚠️ *Deprecated - Use Responses API instead*
533533
```csharp
534534
AIAgent agent = new OpenAIClient(apiKey)
535535
.GetAssistantClient()
536536
.CreateAIAgent(modelId, instructions: instructions);
537537
```
538538

539-
**OpenAI Assistants (Existing):**
539+
**OpenAI Assistants (Existing):** ⚠️ *Deprecated - Use Responses API instead*
540540
```csharp
541541
AIAgent agent = new OpenAIClient(apiKey)
542542
.GetAssistantClient()
@@ -562,6 +562,20 @@ AIAgent agent = await new PersistentAgentsClient(endpoint, credential)
562562
.GetAIAgentAsync(agentId);
563563
```
564564

565+
**OpenAI Responses:** *(Recommended for OpenAI)*
566+
```csharp
567+
AIAgent agent = new OpenAIClient(apiKey)
568+
.GetOpenAIResponseClient(modelId)
569+
.CreateAIAgent(instructions: instructions);
570+
```
571+
572+
**Azure OpenAI Responses:** *(Recommended for Azure OpenAI)*
573+
```csharp
574+
AIAgent agent = new AzureOpenAIClient(endpoint, credential)
575+
.GetOpenAIResponseClient(deploymentName)
576+
.CreateAIAgent(instructions: instructions);
577+
```
578+
565579
**A2A:**
566580
```csharp
567581
A2ACardResolver resolver = new(new Uri(agentHost));
@@ -980,6 +994,8 @@ AIAgent agent = new AzureOpenAIClient(new Uri(endpoint), new AzureCliCredential(
980994

981995
### 3. OpenAI Assistants Migration
982996

997+
> ⚠️ **DEPRECATION WARNING**: The OpenAI Assistants API has been deprecated. The Agent Framework extension methods for Assistants are marked as `[Obsolete]`. **Please use the Responses API instead** (see Section 6: OpenAI Responses Migration).
998+
983999
<configuration_changes>
9841000
**Remove Semantic Kernel Packages:**
9851001
```xml
@@ -1291,52 +1307,7 @@ var result = await agent.RunAsync(userInput, thread);
12911307
```
12921308
</api_changes>
12931309

1294-
### 8. A2A Migration
1295-
1296-
<configuration_changes>
1297-
**Remove Semantic Kernel Packages:**
1298-
```xml
1299-
<PackageReference Include="Microsoft.SemanticKernel.Agents.A2A" />
1300-
```
1301-
1302-
**Add Agent Framework Packages:**
1303-
```xml
1304-
<PackageReference Include="Microsoft.Agents.AI.A2A" />
1305-
```
1306-
</configuration_changes>
1307-
1308-
<api_changes>
1309-
**Replace this Semantic Kernel pattern:**
1310-
```csharp
1311-
using A2A;
1312-
using Microsoft.SemanticKernel;
1313-
using Microsoft.SemanticKernel.Agents;
1314-
using Microsoft.SemanticKernel.Agents.A2A;
1315-
1316-
using var httpClient = CreateHttpClient();
1317-
var client = new A2AClient(agentUrl, httpClient);
1318-
var cardResolver = new A2ACardResolver(url, httpClient);
1319-
var agentCard = await cardResolver.GetAgentCardAsync();
1320-
Console.WriteLine(JsonSerializer.Serialize(agentCard, s_jsonSerializerOptions));
1321-
var agent = new A2AAgent(client, agentCard);
1322-
```
1323-
1324-
**With this Agent Framework pattern:**
1325-
```csharp
1326-
using System;
1327-
using A2A;
1328-
using Microsoft.Agents.AI;
1329-
using Microsoft.Agents.AI.A2A;
1330-
1331-
// Initialize an A2ACardResolver to get an A2A agent card.
1332-
A2ACardResolver agentCardResolver = new(new Uri(a2aAgentHost));
1333-
1334-
// Create an instance of the AIAgent for an existing A2A agent specified by the agent card.
1335-
AIAgent agent = await agentCardResolver.GetAIAgentAsync();
1336-
```
1337-
</api_changes>
1338-
1339-
### 9. Unsupported Providers (Require Custom Implementation)
1310+
### 8. Unsupported Providers (Require Custom Implementation)
13401311

13411312
<behavioral_changes>
13421313
#### BedrockAgent Migration
@@ -1507,7 +1478,7 @@ Console.WriteLine(result);
15071478
```
15081479
</behavioral_changes>
15091480

1510-
### 10. Function Invocation Filtering
1481+
### 9. Function Invocation Filtering
15111482

15121483
**Invocation Context**
15131484

@@ -1615,25 +1586,4 @@ var filteredAgent = originalAgent
16151586
.Build();
16161587
```
16171588

1618-
### 11. Function Invocation Contexts
1619-
1620-
**Invocation Context**
1621-
1622-
Semantic Kernel's `IAutoFunctionInvocationFilter` provides a `AutoFunctionInvocationContext` where Agent Framework provides `FunctionInvocationContext`
16231589

1624-
The property mapping guide from a `AutoFunctionInvocationContext` to a `FunctionInvocationContext` is as follows:
1625-
1626-
| Semantic Kernel | Agent Framework |
1627-
| --- | --- |
1628-
| RequestSequenceIndex | Iteration |
1629-
| FunctionSequenceIndex | FunctionCallIndex |
1630-
| ToolCallId | CallContent.CallId |
1631-
| ChatMessageContent | Messages[0] |
1632-
| ExecutionSettings | Options |
1633-
| ChatHistory | Messages |
1634-
| Function | Function |
1635-
| Kernel | N/A |
1636-
| Result | Use `return` from the delegate |
1637-
| Terminate | Terminate |
1638-
| CancellationToken | provided via argument to middleware delegate |
1639-
| Arguments | Arguments |

0 commit comments

Comments
 (0)