Skip to content

Commit a2ff853

Browse files
committed
merged main
2 parents 711200e + b5ca0c8 commit a2ff853

File tree

623 files changed

+21860
-19686
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

623 files changed

+21860
-19686
lines changed

.github/upgrades/prompts/SemanticKernelToAgentFramework.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ After completing migration, verify these specific items:
105105
1. **Compilation**: Execute `dotnet build` on all modified projects - zero errors required
106106
2. **Namespace Updates**: Confirm all `using Microsoft.SemanticKernel.Agents` statements are replaced
107107
3. **Method Calls**: Verify all `InvokeAsync` calls are changed to `RunAsync`
108-
4. **Return Types**: Confirm handling of `AgentRunResponse` instead of `IAsyncEnumerable<AgentResponseItem<ChatMessageContent>>`
108+
4. **Return Types**: Confirm handling of `AgentResponse` instead of `IAsyncEnumerable<AgentResponseItem<ChatMessageContent>>`
109109
5. **Thread Creation**: Validate all thread creation uses `agent.GetNewThread()` pattern
110110
6. **Tool Registration**: Ensure `[KernelFunction]` attributes are removed and `AIFunctionFactory.Create()` is used
111111
7. **Options Configuration**: Verify `AgentRunOptions` or `ChatClientAgentRunOptions` replaces `AgentInvokeOptions`
@@ -119,7 +119,7 @@ Agent Framework provides functionality for creating and managing AI agents throu
119119
Key API differences:
120120
- Agent creation: Remove Kernel dependency, use direct client-based creation
121121
- Method names: `InvokeAsync``RunAsync`, `InvokeStreamingAsync``RunStreamingAsync`
122-
- Return types: `IAsyncEnumerable<AgentResponseItem<ChatMessageContent>>``AgentRunResponse`
122+
- Return types: `IAsyncEnumerable<AgentResponseItem<ChatMessageContent>>``AgentResponse`
123123
- Thread creation: Provider-specific constructors → `agent.GetNewThread()`
124124
- Tool registration: `KernelPlugin` system → Direct `AIFunction` registration
125125
- Options: `AgentInvokeOptions` → Provider-specific run options (e.g., `ChatClientAgentRunOptions`)
@@ -166,8 +166,8 @@ Replace these method calls:
166166
| `thread.DeleteAsync()` | Provider-specific cleanup | Use provider client directly |
167167

168168
Return type changes:
169-
- `IAsyncEnumerable<AgentResponseItem<ChatMessageContent>>``AgentRunResponse`
170-
- `IAsyncEnumerable<StreamingChatMessageContent>``IAsyncEnumerable<AgentRunResponseUpdate>`
169+
- `IAsyncEnumerable<AgentResponseItem<ChatMessageContent>>``AgentResponse`
170+
- `IAsyncEnumerable<StreamingChatMessageContent>``IAsyncEnumerable<AgentResponseUpdate>`
171171
</api_changes>
172172

173173
<configuration_changes>
@@ -191,8 +191,8 @@ Agent Framework changes these behaviors compared to Semantic Kernel Agents:
191191
1. **Thread Management**: Agent Framework automatically manages thread state. Semantic Kernel required manual thread updates in some scenarios (e.g., OpenAI Responses).
192192

193193
2. **Return Types**:
194-
- Non-streaming: Returns single `AgentRunResponse` instead of `IAsyncEnumerable<AgentResponseItem<ChatMessageContent>>`
195-
- Streaming: Returns `IAsyncEnumerable<AgentRunResponseUpdate>` instead of `IAsyncEnumerable<StreamingChatMessageContent>`
194+
- Non-streaming: Returns single `AgentResponse` instead of `IAsyncEnumerable<AgentResponseItem<ChatMessageContent>>`
195+
- Streaming: Returns `IAsyncEnumerable<AgentResponseUpdate>` instead of `IAsyncEnumerable<StreamingChatMessageContent>`
196196

197197
3. **Tool Registration**: Agent Framework uses direct function registration without requiring `[KernelFunction]` attributes.
198198

@@ -397,7 +397,7 @@ await foreach (AgentResponseItem<ChatMessageContent> item in agent.InvokeAsync(u
397397

398398
**With this Agent Framework non-streaming pattern:**
399399
```csharp
400-
AgentRunResponse result = await agent.RunAsync(userInput, thread, options);
400+
AgentResponse result = await agent.RunAsync(userInput, thread, options);
401401
Console.WriteLine(result);
402402
```
403403

@@ -411,7 +411,7 @@ await foreach (StreamingChatMessageContent update in agent.InvokeStreamingAsync(
411411

412412
**With this Agent Framework streaming pattern:**
413413
```csharp
414-
await foreach (AgentRunResponseUpdate update in agent.RunStreamingAsync(userInput, thread, options))
414+
await foreach (AgentResponseUpdate update in agent.RunStreamingAsync(userInput, thread, options))
415415
{
416416
Console.Write(update);
417417
}
@@ -420,8 +420,8 @@ await foreach (AgentRunResponseUpdate update in agent.RunStreamingAsync(userInpu
420420
**Required changes:**
421421
1. Replace `agent.InvokeAsync()` with `agent.RunAsync()`
422422
2. Replace `agent.InvokeStreamingAsync()` with `agent.RunStreamingAsync()`
423-
3. Change return type handling from `IAsyncEnumerable<AgentResponseItem<ChatMessageContent>>` to `AgentRunResponse`
424-
4. Change streaming type from `StreamingChatMessageContent` to `AgentRunResponseUpdate`
423+
3. Change return type handling from `IAsyncEnumerable<AgentResponseItem<ChatMessageContent>>` to `AgentResponse`
424+
4. Change streaming type from `StreamingChatMessageContent` to `AgentResponseUpdate`
425425
5. Remove `await foreach` for non-streaming calls
426426
6. Access message content directly from result object instead of iterating
427427
</api_changes>
@@ -661,7 +661,7 @@ await foreach (var result in agent.InvokeAsync(input, thread, options))
661661
```csharp
662662
ChatClientAgentRunOptions options = new(new ChatOptions { MaxOutputTokens = 1000 });
663663

664-
AgentRunResponse result = await agent.RunAsync(input, thread, options);
664+
AgentResponse result = await agent.RunAsync(input, thread, options);
665665
Console.WriteLine(result);
666666

667667
// Access underlying content when needed:
@@ -689,7 +689,7 @@ await foreach (var result in agent.InvokeAsync(input, thread, options))
689689

690690
**With this Agent Framework non-streaming usage pattern:**
691691
```csharp
692-
AgentRunResponse result = await agent.RunAsync(input, thread, options);
692+
AgentResponse result = await agent.RunAsync(input, thread, options);
693693
Console.WriteLine($"Tokens: {result.Usage.TotalTokenCount}");
694694
```
695695

@@ -709,7 +709,7 @@ await foreach (StreamingChatMessageContent response in agent.InvokeStreamingAsyn
709709

710710
**With this Agent Framework streaming usage pattern:**
711711
```csharp
712-
await foreach (AgentRunResponseUpdate update in agent.RunStreamingAsync(input, thread, options))
712+
await foreach (AgentResponseUpdate update in agent.RunStreamingAsync(input, thread, options))
713713
{
714714
if (update.Contents.OfType<UsageContent>().FirstOrDefault() is { } usageContent)
715715
{

.github/workflows/merge-gatekeeper.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ jobs:
2929
token: ${{ secrets.GITHUB_TOKEN }}
3030
timeout: 3600
3131
interval: 30
32+
ignored: CodeQL

.github/workflows/python-merge-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
id: azure-functions-setup
9898
- name: Test with pytest
9999
timeout-minutes: 10
100-
run: uv run poe all-tests -n logical --dist loadfile --dist worksteal --timeout 300 --retries 3 --retry-delay 10
100+
run: uv run poe all-tests -n logical --dist loadfile --dist worksteal --timeout 600 --retries 3 --retry-delay 10
101101
working-directory: ./python
102102
- name: Test core samples
103103
timeout-minutes: 10

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ agents.md
206206
WARP.md
207207
**/memory-bank/
208208
**/projectBrief.md
209+
**/tmpclaude*
209210

210211
# Azurite storage emulator files
211212
*/__azurite_db_blob__.json

docs/decisions/0001-agent-run-response.md

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ foreach (var update in response.Messages)
163163
### Option 2 Run: Container with Primary and Secondary Properties, RunStreaming: Stream of Primary + Secondary
164164

165165
Run returns a new response type that has separate properties for the Primary Content and the Secondary Updates leading up to it.
166-
The Primary content is available in the `AgentRunResponse.Messages` property while Secondary updates are in a new `AgentRunResponse.Updates` property.
167-
`AgentRunResponse.Text` returns the Primary content text.
166+
The Primary content is available in the `AgentResponse.Messages` property while Secondary updates are in a new `AgentResponse.Updates` property.
167+
`AgentResponse.Text` returns the Primary content text.
168168

169169
Since streaming would still need to return an `IAsyncEnumerable` of updates, the design would differ from non-streaming.
170170
With non-streaming Primary and Secondary content is split into separate lists, while with streaming it's combined in one stream.
@@ -232,24 +232,24 @@ await foreach (var update in responses)
232232
```csharp
233233
class Agent
234234
{
235-
public abstract Task<AgentRunResponse> RunAsync(
235+
public abstract Task<AgentResponse> RunAsync(
236236
IReadOnlyCollection<ChatMessage> messages,
237237
AgentThread? thread = null,
238238
AgentRunOptions? options = null,
239239
CancellationToken cancellationToken = default);
240240

241-
public abstract IAsyncEnumerable<AgentRunResponseUpdate> RunStreamingAsync(
241+
public abstract IAsyncEnumerable<AgentResponseUpdate> RunStreamingAsync(
242242
IReadOnlyCollection<ChatMessage> messages,
243243
AgentThread? thread = null,
244244
AgentRunOptions? options = null,
245245
CancellationToken cancellationToken = default);
246246
}
247247

248-
class AgentRunResponse : ChatResponse
248+
class AgentResponse : ChatResponse
249249
{
250250
}
251251

252-
public class AgentRunResponseUpdate : ChatResponseUpdate
252+
public class AgentResponseUpdate : ChatResponseUpdate
253253
{
254254
}
255255
```
@@ -265,20 +265,20 @@ The new types could also exclude properties that make less sense for agents, lik
265265
```csharp
266266
class Agent
267267
{
268-
public abstract Task<AgentRunResponse> RunAsync(
268+
public abstract Task<AgentResponse> RunAsync(
269269
IReadOnlyCollection<ChatMessage> messages,
270270
AgentThread? thread = null,
271271
AgentRunOptions? options = null,
272272
CancellationToken cancellationToken = default);
273273

274-
public abstract IAsyncEnumerable<AgentRunResponseUpdate> RunStreamingAsync(
274+
public abstract IAsyncEnumerable<AgentResponseUpdate> RunStreamingAsync(
275275
IReadOnlyCollection<ChatMessage> messages,
276276
AgentThread? thread = null,
277277
AgentRunOptions? options = null,
278278
CancellationToken cancellationToken = default);
279279
}
280280

281-
class AgentRunResponse // Compare with ChatResponse
281+
class AgentResponse // Compare with ChatResponse
282282
{
283283
public string Text { get; } // Aggregation of TextContent from messages.
284284
@@ -294,12 +294,12 @@ class AgentRunResponse // Compare with ChatResponse
294294
public AdditionalPropertiesDictionary? AdditionalProperties { get; set; }
295295
}
296296

297-
// Not Included in AgentRunResponse compared to ChatResponse
297+
// Not Included in AgentResponse compared to ChatResponse
298298
public ChatFinishReason? FinishReason { get; set; }
299299
public string? ConversationId { get; set; }
300300
public string? ModelId { get; set; }
301301

302-
public class AgentRunResponseUpdate // Compare with ChatResponseUpdate
302+
public class AgentResponseUpdate // Compare with ChatResponseUpdate
303303
{
304304
public string Text { get; } // Aggregation of TextContent from Contents.
305305
@@ -317,7 +317,7 @@ public class AgentRunResponseUpdate // Compare with ChatResponseUpdate
317317
public AdditionalPropertiesDictionary? AdditionalProperties { get; set; }
318318
}
319319

320-
// Not Included in AgentRunResponseUpdate compared to ChatResponseUpdate
320+
// Not Included in AgentResponseUpdate compared to ChatResponseUpdate
321321
public ChatFinishReason? FinishReason { get; set; }
322322
public string? ConversationId { get; set; }
323323
public string? ModelId { get; set; }
@@ -360,15 +360,15 @@ public class ChatFinishReason
360360
### Option 2: Add another property on responses for AgentRun
361361

362362
```csharp
363-
class AgentRunResponse
363+
class AgentResponse
364364
{
365365
...
366366
public AgentRun RunReference { get; set; } // Reference to long running process
367367
...
368368
}
369369

370370

371-
public class AgentRunResponseUpdate
371+
public class AgentResponseUpdate
372372
{
373373
...
374374
public AgentRun RunReference { get; set; } // Reference to long running process
@@ -424,7 +424,7 @@ Note that where an agent doesn't support structured output, it may also be possi
424424
See [Structured Outputs Support](#structured-outputs-support) for a comparison on what other agent frameworks and protocols support.
425425

426426
To support a good user experience for structured outputs, I'm proposing that we follow the pattern used by MEAI.
427-
We would add a generic version of `AgentRunResponse<T>`, that allows us to get the agent result already deserialized into our preferred type.
427+
We would add a generic version of `AgentResponse<T>`, that allows us to get the agent result already deserialized into our preferred type.
428428
This would be coupled with generic overload extension methods for Run that automatically builds a schema from the supplied type and updates
429429
the run options.
430430

@@ -438,14 +438,14 @@ class Movie
438438
public int ReleaseYear { get; set; }
439439
}
440440

441-
AgentRunResponse<Movie[]> response = agent.RunAsync<Movie[]>("What are the top 3 children's movies of the 80s.");
441+
AgentResponse<Movie[]> response = agent.RunAsync<Movie[]>("What are the top 3 children's movies of the 80s.");
442442
Movie[] movies = response.Result
443443
```
444444

445445
If we only support requesting a schema at agent creation time or where an agent has a built in schema, the following would be the preferred approach:
446446

447447
```csharp
448-
AgentRunResponse response = agent.RunAsync("What are the top 3 children's movies of the 80s.");
448+
AgentResponse response = agent.RunAsync("What are the top 3 children's movies of the 80s.");
449449
Movie[] movies = response.TryParseStructuredOutput<Movie[]>();
450450
```
451451

@@ -463,7 +463,7 @@ Option 2 chosen so that we can vary Agent responses independently of Chat Client
463463
### StructuredOutputs Decision
464464

465465
We will not support structured output per run request, but individual agents are free to allow this on the concrete implementation or at construction time.
466-
We will however add support for easily extracting a structured output type from the `AgentRunResponse`.
466+
We will however add support for easily extracting a structured output type from the `AgentResponse`.
467467

468468
## Addendum 1: AIContext Derived Types for different response types / Gap Analysis (Work in progress)
469469

docs/decisions/0005-python-naming-conventions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The table below represents the majority of the naming changes discussed in issue
5454
| *Mcp* & *Http* | *MCP* & *HTTP* | accepted | Acronyms should be uppercased in class names, according to PEP 8. | None |
5555
| `agent.run_streaming` | `agent.run_stream` | accepted | Shorter and more closely aligns with AutoGen and Semantic Kernel names for the same methods. | None |
5656
| `workflow.run_streaming` | `workflow.run_stream` | accepted | In sync with `agent.run_stream` and shorter and more closely aligns with AutoGen and Semantic Kernel names for the same methods. | None |
57-
| AgentRunResponse & AgentRunResponseUpdate | AgentResponse & AgentResponseUpdate | rejected | Rejected, because it is the response to a run invocation and AgentResponse is too generic. | None |
57+
| AgentResponse & AgentResponseUpdate | AgentResponse & AgentResponseUpdate | rejected | Rejected, because it is the response to a run invocation and AgentResponse is too generic. | None |
5858
| *Content | * | rejected | Rejected other content type renames (removing `Content` suffix) because it would reduce clarity and discoverability. | Item was also considered, but rejected as it is very similar to Content, but would be inconsistent with dotnet. |
5959
| ChatResponse & ChatResponseUpdate | Response & ResponseUpdate | rejected | Rejected, because Response is too generic. | None |
6060

docs/decisions/0006-userapproval.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ while (response.ApprovalRequests.Count > 0)
161161
response = await agent.RunAsync(messages, thread);
162162
}
163163

164-
class AgentRunResponse
164+
class AgentResponse
165165
{
166166
...
167167

168-
// A new property on AgentRunResponse to aggregate the ApprovalRequestContent items from
168+
// A new property on AgentResponse to aggregate the ApprovalRequestContent items from
169169
// the response messages (Similar to the Text property).
170170
public IEnumerable<ApprovalRequestContent> ApprovalRequests { get; set; }
171171

@@ -251,11 +251,11 @@ while (response.UserInputRequests.Any())
251251
response = await agent.RunAsync(messages, thread);
252252
}
253253

254-
class AgentRunResponse
254+
class AgentResponse
255255
{
256256
...
257257

258-
// A new property on AgentRunResponse to aggregate the UserInputRequestContent items from
258+
// A new property on AgentResponse to aggregate the UserInputRequestContent items from
259259
// the response messages (Similar to the Text property).
260260
public IReadOnlyList<UserInputRequestContent> UserInputRequests { get; set; }
261261

@@ -366,11 +366,11 @@ while (response.UserInputRequests.Any())
366366
response = await agent.RunAsync(messages, thread);
367367
}
368368

369-
class AgentRunResponse
369+
class AgentResponse
370370
{
371371
...
372372

373-
// A new property on AgentRunResponse to aggregate the UserInputRequestContent items from
373+
// A new property on AgentResponse to aggregate the UserInputRequestContent items from
374374
// the response messages (Similar to the Text property).
375375
public IEnumerable<UserInputRequestContent> UserInputRequests { get; set; }
376376

docs/decisions/0007-agent-filtering-middleware.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public class AIAgent
115115
}
116116
}
117117

118-
public async Task<AgentRunResponse> RunAsync(
118+
public async Task<AgentResponse> RunAsync(
119119
IReadOnlyCollection<ChatMessage> messages,
120120
AgentThread? thread = null,
121121
AgentRunOptions? options = null,
@@ -135,7 +135,7 @@ public class AIAgent
135135
return context.Response ?? throw new InvalidOperationException("Agent execution did not produce a response");
136136
}
137137

138-
protected abstract Task<AgentRunResponse> ExecuteCoreLogicAsync(
138+
protected abstract Task<AgentResponse> ExecuteCoreLogicAsync(
139139
IReadOnlyCollection<ChatMessage> messages,
140140
AgentThread? thread,
141141
AgentRunOptions? options,
@@ -190,7 +190,7 @@ internal sealed class GuardrailCallbackAgent : DelegatingAIAgent
190190

191191
public GuardrailCallbackAgent(AIAgent innerAgent) : base(innerAgent) { }
192192

193-
public override async Task<AgentRunResponse> RunAsync(IEnumerable<ChatMessage> messages, AgentThread? thread = null, AgentRunOptions? options = null, CancellationToken cancellationToken = default)
193+
public override async Task<AgentResponse> RunAsync(IEnumerable<ChatMessage> messages, AgentThread? thread = null, AgentRunOptions? options = null, CancellationToken cancellationToken = default)
194194
{
195195
var filteredMessages = this.FilterMessages(messages);
196196
Console.WriteLine($"Guardrail Middleware - Filtered messages: {new ChatResponse(filteredMessages).Text}");
@@ -202,14 +202,14 @@ internal sealed class GuardrailCallbackAgent : DelegatingAIAgent
202202
return response;
203203
}
204204

205-
public override async IAsyncEnumerable<AgentRunResponseUpdate> RunStreamingAsync(IEnumerable<ChatMessage> messages, AgentThread? thread = null, AgentRunOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
205+
public override async IAsyncEnumerable<AgentResponseUpdate> RunStreamingAsync(IEnumerable<ChatMessage> messages, AgentThread? thread = null, AgentRunOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
206206
{
207207
var filteredMessages = this.FilterMessages(messages);
208208
await foreach (var update in this.InnerAgent.RunStreamingAsync(filteredMessages, thread, options, cancellationToken))
209209
{
210210
if (update.Text != null)
211211
{
212-
yield return new AgentRunResponseUpdate(update.Role, this.FilterContent(update.Text));
212+
yield return new AgentResponseUpdate(update.Role, this.FilterContent(update.Text));
213213
}
214214
else
215215
{
@@ -252,7 +252,7 @@ internal sealed class RunningCallbackHandlerAgent : DelegatingAIAgent
252252
this._func = func;
253253
}
254254

255-
public override async Task<AgentRunResponse> RunAsync(IEnumerable<ChatMessage> messages, AgentThread? thread = null, AgentRunOptions? options = null, CancellationToken cancellationToken = default)
255+
public override async Task<AgentResponse> RunAsync(IEnumerable<ChatMessage> messages, AgentThread? thread = null, AgentRunOptions? options = null, CancellationToken cancellationToken = default)
256256
{
257257
var context = new AgentInvokeCallbackContext(this, messages, thread, options, isStreaming: false, cancellationToken);
258258

@@ -469,7 +469,7 @@ public sealed class CallbackEnabledAgent : DelegatingAIAgent
469469
this._callbacksProcessor = callbackMiddlewareProcessor ?? new();
470470
}
471471

472-
public override async Task<AgentRunResponse> RunAsync(
472+
public override async Task<AgentResponse> RunAsync(
473473
IEnumerable<ChatMessage> messages,
474474
AgentThread? thread = null,
475475
AgentRunOptions? options = null,
@@ -541,7 +541,7 @@ public abstract class AgentContext
541541
public class AgentRunContext : AgentContext
542542
{
543543
public IList<ChatMessage> Messages { get; set; }
544-
public AgentRunResponse? Response { get; set; }
544+
public AgentResponse? Response { get; set; }
545545
public AgentThread? Thread { get; }
546546

547547
public AgentRunContext(AIAgent agent, IList<ChatMessage> messages, AgentThread? thread, AgentRunOptions? options)

0 commit comments

Comments
 (0)