Skip to content

Commit 81705e2

Browse files
authored
Merge branch 'main' into feat/durable_task
2 parents c756bd6 + aa2ff67 commit 81705e2

28 files changed

Lines changed: 1846 additions & 901 deletions

File tree

dotnet/Directory.Packages.props

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@
3333
<!-- Newtonsoft.Json -->
3434
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
3535
<!-- System.* -->
36-
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.3" />
36+
<PackageVersion Include="Microsoft.Bcl.AsyncInterfaces" Version="10.0.4" />
3737
<PackageVersion Include="Microsoft.Bcl.HashCode" Version="6.0.0" />
38+
<PackageVersion Include="Microsoft.Bcl.Memory" Version="10.0.4" />
3839
<PackageVersion Include="System.ClientModel" Version="1.9.0" />
3940
<PackageVersion Include="System.CodeDom" Version="10.0.0" />
4041
<PackageVersion Include="System.Collections.Immutable" Version="10.0.1" />
4142
<PackageVersion Include="System.CommandLine" Version="2.0.0-rc.2.25502.107" />
4243
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="10.0.3" />
43-
<PackageVersion Include="System.Linq.AsyncEnumerable" Version="10.0.0" />
44+
<PackageVersion Include="System.Linq.AsyncEnumerable" Version="10.0.4" />
4445
<PackageVersion Include="System.Net.Http.Json" Version="10.0.0" />
4546
<PackageVersion Include="System.Net.ServerSentEvents" Version="10.0.3" />
4647
<PackageVersion Include="System.Text.Json" Version="10.0.3" />
@@ -101,10 +102,10 @@
101102
<PackageVersion Include="Microsoft.Agents.Authentication.Msal" Version="1.3.171-beta" />
102103
<PackageVersion Include="Microsoft.Agents.Hosting.AspNetCore" Version="1.3.171-beta" />
103104
<!-- A2A -->
104-
<PackageVersion Include="A2A" Version="0.3.3-preview" />
105-
<PackageVersion Include="A2A.AspNetCore" Version="0.3.3-preview" />
105+
<PackageVersion Include="A2A" Version="0.3.4-preview" />
106+
<PackageVersion Include="A2A.AspNetCore" Version="0.3.4-preview" />
106107
<!-- MCP -->
107-
<PackageVersion Include="ModelContextProtocol" Version="0.8.0-preview.1" />
108+
<PackageVersion Include="ModelContextProtocol" Version="1.1.0" />
108109
<!-- Inference SDKs -->
109110
<PackageVersion Include="AWSSDK.Extensions.Bedrock.MEAI" Version="4.0.5.1" />
110111
<PackageVersion Include="Microsoft.ML.OnnxRuntimeGenAI" Version="0.10.0" />

dotnet/src/Microsoft.Agents.AI.A2A/Extensions/A2AMetadataExtensions.cs

Lines changed: 0 additions & 36 deletions
This file was deleted.

dotnet/src/Microsoft.Agents.AI.A2A/Extensions/AdditionalPropertiesDictionaryExtensions.cs

Lines changed: 0 additions & 44 deletions
This file was deleted.

dotnet/src/Microsoft.Agents.AI.Hosting.A2A/Converters/A2AMetadataExtensions.cs

Lines changed: 0 additions & 36 deletions
This file was deleted.

dotnet/src/Microsoft.Agents.AI.Hosting.A2A/Converters/AdditionalPropertiesDictionaryExtensions.cs

Lines changed: 0 additions & 44 deletions
This file was deleted.

dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/OpenAIResponseClientExtensions.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,15 +100,23 @@ public static ChatClientAgent AsAIAgent(
100100
/// This corresponds to setting the "store" property in the JSON representation to false.
101101
/// </remarks>
102102
/// <param name="responseClient">The client.</param>
103+
/// <param name="includeReasoningEncryptedContent">
104+
/// Includes an encrypted version of reasoning tokens in reasoning item outputs.
105+
/// This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly
106+
/// (like when the store parameter is set to false, or when an organization is enrolled in the zero data retention program).
107+
/// Defaults to <see langword="true"/>.
108+
/// </param>
103109
/// <returns>An <see cref="IChatClient"/> that can be used to converse via the <see cref="ResponsesClient"/> that does not store responses for later retrieval.</returns>
104110
/// <exception cref="ArgumentNullException"><paramref name="responseClient"/> is <see langword="null"/>.</exception>
105111
[Experimental(DiagnosticIds.Experiments.AgentsAIExperiments)]
106-
public static IChatClient AsIChatClientWithStoredOutputDisabled(this ResponsesClient responseClient)
112+
public static IChatClient AsIChatClientWithStoredOutputDisabled(this ResponsesClient responseClient, bool includeReasoningEncryptedContent = true)
107113
{
108114
return Throw.IfNull(responseClient)
109115
.AsIChatClient()
110116
.AsBuilder()
111-
.ConfigureOptions(x => x.RawRepresentationFactory = _ => new CreateResponseOptions() { StoredOutputEnabled = false })
117+
.ConfigureOptions(x => x.RawRepresentationFactory = _ => includeReasoningEncryptedContent
118+
? new CreateResponseOptions() { StoredOutputEnabled = false, IncludedProperties = { IncludedResponseProperty.ReasoningEncryptedContent } }
119+
: new CreateResponseOptions() { StoredOutputEnabled = false })
112120
.Build();
113121
}
114122
}

dotnet/src/Microsoft.Agents.AI.Workflows.Declarative.Mcp/DefaultMcpToolHandler.cs

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using System.Globalization;
66
using System.Linq;
77
using System.Net.Http;
8+
using System.Text;
89
using System.Threading;
910
using System.Threading.Tasks;
1011
using Microsoft.Extensions.AI;
@@ -222,31 +223,36 @@ private static void PopulateResultContent(McpServerToolResultContent resultConte
222223
}
223224
}
224225

225-
private static AIContent ConvertContentBlock(ContentBlock block)
226+
internal static AIContent ConvertContentBlock(ContentBlock block)
226227
{
227228
return block switch
228229
{
229230
TextContentBlock text => new TextContent(text.Text),
230-
ImageContentBlock image => CreateDataContentFromBase64(image.Data, image.MimeType ?? "image/*"),
231-
AudioContentBlock audio => CreateDataContentFromBase64(audio.Data, audio.MimeType ?? "audio/*"),
231+
ImageContentBlock image => CreateDataContent(image.Data, image.MimeType ?? "image/*"),
232+
AudioContentBlock audio => CreateDataContent(audio.Data, audio.MimeType ?? "audio/*"),
232233
_ => new TextContent(block.ToString() ?? string.Empty),
233234
};
234235
}
235236

236-
private static DataContent CreateDataContentFromBase64(string? base64Data, string mediaType)
237+
private static DataContent CreateDataContent(ReadOnlyMemory<byte> base64Utf8Data, string mediaType)
237238
{
238-
if (string.IsNullOrEmpty(base64Data))
239+
if (base64Utf8Data.IsEmpty)
239240
{
240241
return new DataContent($"data:{mediaType};base64,", mediaType);
241242
}
242243

244+
#if NET8_0_OR_GREATER
245+
string base64 = Encoding.UTF8.GetString(base64Utf8Data.Span);
246+
#else
247+
string base64 = Encoding.UTF8.GetString(base64Utf8Data.ToArray());
248+
#endif
249+
243250
// If it's already a data URI, use it directly
244-
if (base64Data.StartsWith("data:", StringComparison.OrdinalIgnoreCase))
251+
if (base64.StartsWith("data:", StringComparison.OrdinalIgnoreCase))
245252
{
246-
return new DataContent(base64Data, mediaType);
253+
return new DataContent(base64, mediaType);
247254
}
248255

249-
// Otherwise, construct a data URI from the base64 data
250-
return new DataContent($"data:{mediaType};base64,{base64Data}", mediaType);
256+
return new DataContent($"data:{mediaType};base64,{base64}", mediaType);
251257
}
252258
}

dotnet/src/Microsoft.Agents.AI.Workflows/Execution/LockstepRunEventStream.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ public async IAsyncEnumerable<WorkflowEvent> TakeEventStreamAsync(bool blockOnPe
7272
this.RunStatus = RunStatus.Running;
7373
runActivity?.AddEvent(new ActivityEvent(EventNames.WorkflowStarted));
7474

75+
// Emit WorkflowStartedEvent to the event stream for consumers
76+
eventSink.Enqueue(new WorkflowStartedEvent());
77+
7578
do
7679
{
7780
while (this._stepRunner.HasUnprocessedMessages &&

dotnet/src/Microsoft.Agents.AI.Workflows/Execution/StreamingRunEventStream.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,16 @@ private async Task RunLoopAsync(CancellationToken cancellationToken)
8888

8989
// Run all available supersteps continuously
9090
// Events are streamed out in real-time as they happen via the event handler
91-
while (this._stepRunner.HasUnprocessedMessages && !linkedSource.Token.IsCancellationRequested)
91+
if (this._stepRunner.HasUnprocessedMessages)
9292
{
93-
await this._stepRunner.RunSuperStepAsync(linkedSource.Token).ConfigureAwait(false);
93+
// Emit WorkflowStartedEvent only when there's actual work to process
94+
// This avoids spurious events on timeout-only loop iterations
95+
await this._eventChannel.Writer.WriteAsync(new WorkflowStartedEvent(), linkedSource.Token).ConfigureAwait(false);
96+
97+
while (this._stepRunner.HasUnprocessedMessages && !linkedSource.Token.IsCancellationRequested)
98+
{
99+
await this._stepRunner.RunSuperStepAsync(linkedSource.Token).ConfigureAwait(false);
100+
}
94101
}
95102

96103
// Update status based on what's waiting

dotnet/src/Microsoft.Agents.AI/Compaction/SummarizationCompactionStrategy.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,10 @@ protected override async ValueTask<bool> CompactCoreAsync(CompactionMessageIndex
161161

162162
// Generate summary using the chat client (single LLM call for all marked groups)
163163
int summarized = excludedGroups.Count;
164-
logger.LogSummarizationStarting(summarized, summarizationMessages.Count - 1, this.ChatClient.GetType().Name);
164+
if (logger.IsEnabled(LogLevel.Debug))
165+
{
166+
logger.LogSummarizationStarting(summarized, summarizationMessages.Count - 1, this.ChatClient.GetType().Name);
167+
}
165168

166169
using Activity? summarizeActivity = CompactionTelemetry.ActivitySource.StartActivity(CompactionTelemetry.ActivityNames.Summarize);
167170
summarizeActivity?.SetTag(CompactionTelemetry.Tags.GroupsSummarized, summarized);

0 commit comments

Comments
 (0)