// Copyright (c) Microsoft. All rights reserved.
using System.Collections.Generic;
using Microsoft.Extensions.AI;
namespace Microsoft.Agents.AI.Workflows;
///
/// Provides extension methods for treating workflows as
///
public static class WorkflowHostingExtensions
{
///
/// Convert a workflow with the appropriate primary input type to an .
///
/// The workflow to be hosted by the resulting
/// A unique id for the hosting .
/// A name for the hosting .
/// A description for the hosting .
/// A to enable persistence of run state.
/// Specify the execution environment to use when running the workflows. See
/// , and
/// for the in-process environments.
/// If , will include
/// in the representing the workflow error.
/// If , will transform outgoing workflow outputs
/// into into content in s or the as appropriate.
///
public static AIAgent AsAgent(
this Workflow workflow,
string? id = null,
string? name = null,
string? description = null,
CheckpointManager? checkpointManager = null,
IWorkflowExecutionEnvironment? executionEnvironment = null,
bool includeExceptionDetails = false,
bool includeWorkflowOutputsInResponse = false)
{
return new WorkflowHostAgent(workflow, id, name, description, checkpointManager, executionEnvironment, includeExceptionDetails, includeWorkflowOutputsInResponse);
}
internal static FunctionCallContent ToFunctionCall(this ExternalRequest request)
{
Dictionary parameters = new()
{
{ "data", request.Data}
};
return new FunctionCallContent(request.RequestId, request.PortInfo.PortId, parameters);
}
}