diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/MagenticPlanReviewResponse.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/MagenticPlanReviewResponse.cs index 0a171e1540..0a72ccfa0f 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/MagenticPlanReviewResponse.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/MagenticPlanReviewResponse.cs @@ -6,9 +6,12 @@ using Microsoft.Extensions.AI; namespace Microsoft.Agents.AI.Workflows; /// -/// . +/// Review feedback for a proposed plan, including any revisions if the plan is not approved as-is. An +/// empty list of review messages indicates approval of the proposed plan without any revisions. /// -/// +/// +/// Review feedback for a generated plan. Empty if the plan is approved as-is and changes are requested. +/// public record MagenticPlanReviewResponse(List Review) { internal bool IsApproved => this.Review.Count == 0; diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/MagenticProgressLedger.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/MagenticProgressLedger.cs index 51cf1f6e47..445007d3f3 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/MagenticProgressLedger.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/MagenticProgressLedger.cs @@ -154,8 +154,8 @@ public class MagenticProgressLedger questionBuilder.AppendLine(slot.FormattedQuestion); schemaBuilder.AppendLine($"\"{slot.Key}\": {{") - .AppendLine($" \"{ProgressLedgerSlot.ValueKey}\": string,") - .AppendLine($" \"{ProgressLedgerSlot.ReasonKey}\": {slot.SchemaType}{slot.SuffixString}") + .AppendLine($" \"{ProgressLedgerSlot.ValueKey}\": {slot.SchemaType}{slot.SuffixString},") + .AppendLine($" \"{ProgressLedgerSlot.ReasonKey}\": string") .AppendLine("}"); } schemaBuilder.AppendLine("}"); diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticManager.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticManager.cs index eda763c57f..936d9d951e 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticManager.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticManager.cs @@ -105,10 +105,10 @@ internal class MagenticManager(AIAgent managerAgent) lastException?.Throw(); } - public async ValueTask PrepareFinalAnswerAsync(MagenticTaskContext taskContext, IWorkflowContext context, CancellationToken canclleationToken) + public async ValueTask PrepareFinalAnswerAsync(MagenticTaskContext taskContext, IWorkflowContext context, CancellationToken cancellationToken) { ChatMessage finalAnswerRequest = new(ChatRole.User, taskContext.ToFinalAnswerPrompt()); - ChatMessage finalAnswer = await this.InvokeAgentAsync([.. taskContext.ChatHistory, finalAnswerRequest], context, canclleationToken) + ChatMessage finalAnswer = await this.InvokeAgentAsync([.. taskContext.ChatHistory, finalAnswerRequest], context, cancellationToken) .ConfigureAwait(false); return new(ChatRole.Assistant, finalAnswer.Text) diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticOrchestrator.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticOrchestrator.cs index 0961c15dac..b78183b039 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticOrchestrator.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/MagenticOrchestrator.cs @@ -198,7 +198,7 @@ internal class MagenticOrchestrator(AIAgent managerAgent, List team, Ta { string limitType = hitRoundLimit ? "round" : "reset"; - List messages = [new(ChatRole.Assistant, $"Task execution stopped due to hitting the maximim {limitType} count limit.")]; + List messages = [new(ChatRole.Assistant, $"Task execution stopped due to hitting the maximum {limitType} count limit.")]; await context.YieldOutputAsync(messages, cancellationToken).ConfigureAwait(false); taskContext.IsTerminated = true; @@ -232,7 +232,7 @@ internal class MagenticOrchestrator(AIAgent managerAgent, List team, Ta } // Check and handle stalls - if (taskContext.ProgressLedger.IsInLoop || taskContext.ProgressLedger.IsProgressBeingMade) + if (taskContext.ProgressLedger.IsInLoop || !taskContext.ProgressLedger.IsProgressBeingMade) { taskContext.TaskCounters.StallCount++; } diff --git a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/StreamingToolCallResultPairMatcher.cs b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/StreamingToolCallResultPairMatcher.cs index 80b0f6448e..bb72b8390a 100644 --- a/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/StreamingToolCallResultPairMatcher.cs +++ b/dotnet/src/Microsoft.Agents.AI.Workflows/Specialized/Magentic/StreamingToolCallResultPairMatcher.cs @@ -57,7 +57,7 @@ internal sealed class StreamingToolCallResultPairMatcher private bool TryResolve(CallType callType, string callId, [NotNullWhen(true)] out string? name) { - CallSummaryKey key = new(CallType.Function, callId); + CallSummaryKey key = new(callType, callId); bool hasMatchingCall = this._callSummaries.TryGetValue(key, out ToolCallSummary callSummary); if (hasMatchingCall) diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestProgressLedgerState.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestProgressLedgerState.cs index 04b9aab7f0..6484aa0c5a 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestProgressLedgerState.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestProgressLedgerState.cs @@ -29,7 +29,7 @@ public record TestProgressLedgerState(Slot? is_request_satisfied = null, private static readonly JsonSerializerOptions s_options = new() { - DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull | JsonIgnoreCondition.WhenReading + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull }; public JsonElement ToJson() => JsonSerializer.SerializeToElement(this, s_options); diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestReplayAgent.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestReplayAgent.cs index 944d2d7052..8373b844ed 100644 --- a/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestReplayAgent.cs +++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.UnitTests/TestReplayAgent.cs @@ -96,7 +96,7 @@ public class TestReplayAgent(List> messages, string? id = null private static List>? Validate(List>? candidateMessages) { - string? currentMessageId = null; + string? lastMessageId = null; if (candidateMessages != null) { @@ -104,11 +104,11 @@ public class TestReplayAgent(List> messages, string? id = null { foreach (ChatMessage message in candidateMessagesTurn) { - if (currentMessageId is null) + if (lastMessageId is null || lastMessageId != message.MessageId) { - currentMessageId = message.MessageId; + lastMessageId = message.MessageId; } - else if (currentMessageId == message.MessageId) + else if (lastMessageId == message.MessageId) { throw new ArgumentException("Duplicate consecutive message ids"); }