mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
refactor: [BREAKING] Remove generic Workflow<T> (#1551)
Remove input type checking in favour of explicit `.DescribeProtocolAsync()` flow. Also removes `.AsAgentAsync()` as the validation happens at workflow run time. This makes it easier to use Workflows with DI without resorting to async-over-sync.
This commit is contained in:
committed by
GitHub
Unverified
parent
7c1e3db846
commit
0ef4e739d5
+1
-1
@@ -24,7 +24,7 @@ public static class Program
|
||||
private static async Task Main()
|
||||
{
|
||||
// Create the workflow
|
||||
var workflow = await WorkflowHelper.GetWorkflowAsync();
|
||||
var workflow = WorkflowHelper.GetWorkflow();
|
||||
|
||||
// Execute the workflow
|
||||
await using StreamingRun handle = await InProcessExecution.StreamAsync(workflow, NumberSignal.Init);
|
||||
|
||||
+2
-2
@@ -10,7 +10,7 @@ internal static class WorkflowHelper
|
||||
/// Get a workflow that plays a number guessing game with human-in-the-loop interaction.
|
||||
/// An input port allows the external world to provide inputs to the workflow upon requests.
|
||||
/// </summary>
|
||||
internal static ValueTask<Workflow<NumberSignal>> GetWorkflowAsync()
|
||||
internal static Workflow GetWorkflow()
|
||||
{
|
||||
// Create the executors
|
||||
RequestPort numberRequestPort = RequestPort.Create<NumberSignal, int>("GuessNumber");
|
||||
@@ -21,7 +21,7 @@ internal static class WorkflowHelper
|
||||
.AddEdge(numberRequestPort, judgeExecutor)
|
||||
.AddEdge(judgeExecutor, numberRequestPort)
|
||||
.WithOutputFrom(judgeExecutor)
|
||||
.BuildAsync<NumberSignal>();
|
||||
.Build();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user