mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
25 lines
929 B
C#
25 lines
929 B
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
|
|
using Microsoft.Agents.AI.Hosting.AzureFunctions;
|
|
using Microsoft.Agents.AI.Workflows;
|
|
using Microsoft.Azure.Functions.Worker.Builder;
|
|
using Microsoft.Extensions.Hosting;
|
|
using SingleAgent;
|
|
|
|
OrderIdParserExecutor orderParser = new();
|
|
OrderEnrich orderEnrich = new();
|
|
PaymentProcesserExecutor paymentProcessor = new();
|
|
NotifyFraudExecutor notifyFraud = new();
|
|
|
|
WorkflowBuilder builder = new(orderParser);
|
|
builder.AddEdge(orderParser, orderEnrich);
|
|
builder.AddEdge(orderEnrich, notifyFraud, condition: OrderRouteConditions.WhenBlocked());
|
|
builder.AddEdge(orderEnrich, paymentProcessor, condition: OrderRouteConditions.WhenNotBlocked());
|
|
|
|
var workflow = builder.WithName("ProcessOrder").Build();
|
|
|
|
FunctionsApplication.CreateBuilder(args)
|
|
.ConfigureFunctionsWebApplication()
|
|
.ConfigureDurableOptions(options => options.Workflows.AddWorkflow(workflow))
|
|
.Build().Run();
|