mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
WIP
This commit is contained in:
@@ -20,22 +20,31 @@ Func<string, string> orderParserFunc = input =>
|
||||
};
|
||||
var orderParserExecutor = orderParserFunc.BindAsExecutor("OrderParser");
|
||||
|
||||
Func<string, string> cancelOrderFunc = input => $"Cancelled order:{input}";
|
||||
var orderArchiver = orderParserFunc.BindAsExecutor("OrderArchiver");
|
||||
|
||||
OrderLookupExecutor orderLookupExecutor = new();
|
||||
OrderEnricherExecutor orderEnricherExeecutor = new();
|
||||
PaymentProcessorExecutor paymentProcessorExecutor = new();
|
||||
|
||||
Workflow workflow = new WorkflowBuilder(orderParserExecutor)
|
||||
Workflow processOrder = new WorkflowBuilder(orderParserExecutor)
|
||||
.WithName("FulfillOrder")
|
||||
.WithDescription("Looks up an order by ID and run payment processing")
|
||||
.AddEdge(orderParserExecutor, orderLookupExecutor)
|
||||
.AddEdge(orderLookupExecutor, orderEnricherExeecutor)
|
||||
.AddEdge(orderEnricherExeecutor, paymentProcessorExecutor)
|
||||
.WithOutputFrom(paymentProcessorExecutor)
|
||||
.Build();
|
||||
|
||||
Workflow cancelOrder = new WorkflowBuilder(orderParserExecutor)
|
||||
.WithName("CancelOrder")
|
||||
.WithDescription("Cancel an order")
|
||||
.AddEdge(orderParserExecutor, orderLookupExecutor)
|
||||
.AddEdge(orderLookupExecutor, orderArchiver)
|
||||
.Build();
|
||||
|
||||
var host = FunctionsApplication.CreateBuilder(args)
|
||||
.ConfigureFunctionsWebApplication()
|
||||
.ConfigureDurableOptions(options => options.Workflows.AddWorkflow(workflow))
|
||||
.ConfigureDurableOptions(options => options.Workflows.AddWorkflow([processOrder, cancelOrder]))
|
||||
.Build();
|
||||
|
||||
host.Run();
|
||||
|
||||
Reference in New Issue
Block a user