// Copyright (c) Microsoft. All rights reserved.
using Microsoft.Agents.AI.Workflows;
namespace Microsoft.Agents.AI.DurableTask.Workflows;
///
/// Defines a client for running and managing workflow executions.
///
public interface IWorkflowClient
{
///
/// Runs a workflow and returns a handle to monitor its execution.
///
/// The type of the input to the workflow.
/// The workflow to execute.
/// The input to pass to the workflow's starting executor.
/// Optional identifier for the run. If not provided, a new ID will be generated.
/// A cancellation token to observe.
/// An that can be used to monitor the workflow execution.
ValueTask RunAsync(
Workflow workflow,
TInput input,
string? runId = null,
CancellationToken cancellationToken = default)
where TInput : notnull;
///
/// Runs a workflow with string input and returns a handle to monitor its execution.
///
/// The workflow to execute.
/// The string input to pass to the workflow.
/// Optional identifier for the run. If not provided, a new ID will be generated.
/// A cancellation token to observe.
/// An that can be used to monitor the workflow execution.
ValueTask RunAsync(
Workflow workflow,
string input,
string? runId = null,
CancellationToken cancellationToken = default);
///
/// Starts a workflow and returns a streaming handle to watch events in real-time.
///
/// The type of the input to the workflow.
/// The workflow to execute.
/// The input to pass to the workflow's starting executor.
/// Optional identifier for the run. If not provided, a new ID will be generated.
/// A cancellation token to observe.
/// An that can be used to stream workflow events.
ValueTask StreamAsync(
Workflow workflow,
TInput input,
string? runId = null,
CancellationToken cancellationToken = default)
where TInput : notnull;
///
/// Starts a workflow with string input and returns a streaming handle to watch events in real-time.
///
/// The workflow to execute.
/// The string input to pass to the workflow.
/// Optional identifier for the run. If not provided, a new ID will be generated.
/// A cancellation token to observe.
/// An that can be used to stream workflow events.
ValueTask StreamAsync(
Workflow workflow,
string input,
string? runId = null,
CancellationToken cancellationToken = default);
}