mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
eb06faea2d
* Add AG-UI Blazor sample * Add AG-UI getting started samples * Cleanups * Update the dojo samples * cleanups * Fix readme * Address feedback and further cleanups * Fix build * Missing fixes
53 lines
1.7 KiB
C#
53 lines
1.7 KiB
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using System.ComponentModel;
|
|
|
|
namespace AGUIDojoServer.AgenticUI;
|
|
|
|
internal static class AgenticPlanningTools
|
|
{
|
|
[Description("Create a plan with multiple steps.")]
|
|
public static Plan CreatePlan([Description("List of step descriptions to create the plan.")] List<string> steps)
|
|
{
|
|
return new Plan
|
|
{
|
|
Steps = [.. steps.Select(s => new Step { Description = s, Status = StepStatus.Pending })]
|
|
};
|
|
}
|
|
|
|
[Description("Update a step in the plan with new description or status.")]
|
|
public static async Task<List<JsonPatchOperation>> UpdatePlanStepAsync(
|
|
[Description("The index of the step to update.")] int index,
|
|
[Description("The new description for the step (optional).")] string? description = null,
|
|
[Description("The new status for the step (optional).")] StepStatus? status = null)
|
|
{
|
|
var changes = new List<JsonPatchOperation>();
|
|
|
|
if (description is not null)
|
|
{
|
|
changes.Add(new JsonPatchOperation
|
|
{
|
|
Op = "replace",
|
|
Path = $"/steps/{index}/description",
|
|
Value = description
|
|
});
|
|
}
|
|
|
|
if (status.HasValue)
|
|
{
|
|
// Status must be lowercase to match AG-UI frontend expectations: "pending" or "completed"
|
|
string statusValue = status.Value == StepStatus.Pending ? "pending" : "completed";
|
|
changes.Add(new JsonPatchOperation
|
|
{
|
|
Op = "replace",
|
|
Path = $"/steps/{index}/status",
|
|
Value = statusValue
|
|
});
|
|
}
|
|
|
|
await Task.Delay(1000);
|
|
|
|
return changes;
|
|
}
|
|
}
|