// Copyright (c) Microsoft. All rights reserved. using Microsoft.Agents.AI.Workflows; namespace Microsoft.Agents.AI.DurableTask.Workflows; /// /// Represents a workflow run that supports streaming workflow events as they occur. /// /// /// This interface defines the contract for streaming workflow runs in durable execution /// environments. Implementations provide real-time access to workflow events. /// public interface IStreamingWorkflowRun { /// /// Gets the unique identifier for the run. /// /// /// This identifier can be provided at the start of the run, or auto-generated. /// For durable runs, this corresponds to the orchestration instance ID. /// string RunId { get; } /// /// Asynchronously streams workflow events as they occur during workflow execution. /// /// /// This method yields instances in real time as the workflow /// progresses. The stream completes when the workflow completes, fails, or is terminated. /// Events are delivered in the order they are raised. /// /// /// A that can be used to cancel the streaming operation. /// If cancellation is requested, the stream will end and no further events will be yielded. /// /// /// An asynchronous stream of objects representing significant /// workflow state changes. /// IAsyncEnumerable WatchStreamAsync(CancellationToken cancellationToken = default); /// /// Sends a response to a to resume the workflow. /// /// The type of the response data. /// The request event to respond to. /// The response data to send. /// A cancellation token to observe. /// A representing the asynchronous operation. ValueTask SendResponseAsync( DurableWorkflowWaitingForInputEvent requestEvent, TResponse response, CancellationToken cancellationToken = default); }