<#@ template language="C#" inherits="CodeTemplate" visibility="internal" linePragmas="false" #> <#@ import namespace="Microsoft.Agents.AI.Workflows.Declarative.Extensions" #> <#@ assembly name="System.Core" #> // ------------------------------------------------------------------------------ // // This code was generated by a tool. // // ------------------------------------------------------------------------------ #nullable enable #pragma warning disable IDE0005 // Extra using directive is ok. using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.Agents.AI; using Microsoft.Agents.AI.Workflows; using Microsoft.Agents.AI.Workflows.Declarative; using Microsoft.Agents.AI.Workflows.Declarative.Kit; using Microsoft.Extensions.AI; <# if (this.Namespace is not null) {#> namespace <#= this.Namespace #>; <# } #> /// /// This class provides a factory method to create a instance. /// /// /// The workflow defined here was generated from a declarative workflow definition. /// Declarative workflows utilize Power FX for defining conditions and expressions. /// To learn more about Power FX, see: /// https://learn.microsoft.com/power-platform/power-fx/formula-reference-copilot-studio /// public static class <#= this.Prefix ?? string.Empty #>WorkflowProvider {<# foreach (string executor in ByLine(this.Executors, formatGroup: true)) { #> <#= executor #><# } #> public static Workflow CreateWorkflow( DeclarativeWorkflowOptions options, Func? inputTransform = null) where TInput : notnull { // Create root executor to initialize the workflow. inputTransform ??= (message) => DeclarativeWorkflowBuilder.DefaultTransform(message); <#= this.RootExecutorType #>Executor <#= this.RootInstance #> = new(options, inputTransform);<# // Create executor instances foreach (string instance in ByLine(this.Instances)) { #> <#= instance #><# }#> // Define the workflow builder WorkflowBuilder builder = new(<#= this.RootInstance #>); // Connect executors<# foreach (string edge in ByLine(this.Edges)) { #> <#= edge #><# } #> // Build the workflow return builder.Build(validateOrphans: false); } }