diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableHaltRequestedEvent.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableHaltRequestedEvent.cs
new file mode 100644
index 0000000000..a8b35765e1
--- /dev/null
+++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableHaltRequestedEvent.cs
@@ -0,0 +1,29 @@
+// Copyright (c) Microsoft. All rights reserved.
+
+using Microsoft.Agents.AI.Workflows;
+
+namespace Microsoft.Agents.AI.DurableTask;
+
+///
+/// Event raised when an executor requests the workflow to halt via .
+///
+///
+/// This is the durable equivalent of the internal RequestHaltEvent since that class is not accessible
+/// from outside the Workflows assembly.
+///
+public sealed class DurableHaltRequestedEvent : WorkflowEvent
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The ID of the executor that requested the halt.
+ public DurableHaltRequestedEvent(string executorId) : base($"Halt requested by {executorId}")
+ {
+ this.ExecutorId = executorId;
+ }
+
+ ///
+ /// Gets the ID of the executor that requested the halt.
+ ///
+ public string ExecutorId { get; }
+}
diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableOptions.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableOptions.cs
index d737dfcf3e..82bb8a419f 100644
--- a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableOptions.cs
+++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableOptions.cs
@@ -20,7 +20,7 @@ public sealed class DurableOptions
///
/// Initializes a new instance of the class.
///
- public DurableOptions()
+ internal DurableOptions()
{
this.Workflows = new DurableWorkflowOptions(this);
}
diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableRequestInfoEvent.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableRequestInfoEvent.cs
new file mode 100644
index 0000000000..d816f41d78
--- /dev/null
+++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableRequestInfoEvent.cs
@@ -0,0 +1,67 @@
+// Copyright (c) Microsoft. All rights reserved.
+
+using System.Diagnostics.CodeAnalysis;
+using System.Text.Json;
+using Microsoft.Agents.AI.Workflows;
+
+namespace Microsoft.Agents.AI.DurableTask;
+
+///
+/// Event raised when the durable workflow is waiting for external input at a .
+///
+/// The ID of the request port waiting for input.
+/// The serialized input data that was passed to the RequestPort.
+/// The full type name of the request type.
+/// The full type name of the expected response type.
+/// The request port definition, if available.
+public sealed class DurableRequestInfoEvent(
+ string RequestPortId,
+ string Input,
+ string RequestType,
+ string ResponseType,
+ RequestPort? RequestPort) : WorkflowEvent(Input)
+{
+ ///
+ /// Gets the ID of the request port waiting for input.
+ ///
+ public string RequestPortId { get; } = RequestPortId;
+
+ ///
+ /// Gets the serialized input data that was passed to the RequestPort.
+ ///
+ public string Input { get; } = Input;
+
+ ///
+ /// Gets the full type name of the request type.
+ ///
+ public string RequestType { get; } = RequestType;
+
+ ///
+ /// Gets the full type name of the expected response type.
+ ///
+ public string ResponseType { get; } = ResponseType;
+
+ ///
+ /// Gets the request port definition, if available.
+ ///
+ public RequestPort? RequestPort { get; } = RequestPort;
+
+ ///
+ /// Attempts to deserialize the input data to the specified type.
+ ///
+ /// The type to deserialize to.
+ /// The deserialized input, or default if deserialization fails.
+ [UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Deserializing workflow types provided by the caller.")]
+ [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Deserializing workflow types provided by the caller.")]
+ public T? GetInputAs()
+ {
+ try
+ {
+ return JsonSerializer.Deserialize(this.Input);
+ }
+ catch (JsonException)
+ {
+ return default;
+ }
+ }
+}
diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableRun.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableRun.cs
index d52df322ee..f928fd8958 100644
--- a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableRun.cs
+++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableRun.cs
@@ -116,7 +116,7 @@ public sealed class DurableRun : IRun
/// The data to send with the event.
/// A cancellation token to observe.
#pragma warning disable CA1030 // Use events where appropriate - This is intentionally a method that sends events to an orchestration
- public async ValueTask SendExternalEventAsync(string eventName, object? eventData = null, CancellationToken cancellationToken = default)
+ internal async ValueTask SendExternalEventAsync(string eventName, object? eventData = null, CancellationToken cancellationToken = default)
#pragma warning restore CA1030
{
await this._client.RaiseEventAsync(
@@ -131,7 +131,7 @@ public sealed class DurableRun : IRun
///
/// The workflow event to send.
/// A cancellation token to observe.
- public ValueTask SendEventAsync(WorkflowEvent workflowEvent, CancellationToken cancellationToken = default)
+ internal ValueTask SendEventAsync(WorkflowEvent workflowEvent, CancellationToken cancellationToken = default)
=> this.SendExternalEventAsync("WorkflowEvent", workflowEvent, cancellationToken);
///
@@ -238,49 +238,3 @@ public sealed class DurableRun : IRun
return default;
}
}
-
-///
-/// Represents the execution status of a durable workflow run.
-///
-public enum DurableRunStatus
-{
- ///
- /// The orchestration instance was not found.
- ///
- NotFound,
-
- ///
- /// The orchestration is pending and has not started.
- ///
- Pending,
-
- ///
- /// The orchestration is currently running.
- ///
- Running,
-
- ///
- /// The orchestration completed successfully.
- ///
- Completed,
-
- ///
- /// The orchestration failed with an error.
- ///
- Failed,
-
- ///
- /// The orchestration was terminated.
- ///
- Terminated,
-
- ///
- /// The orchestration is suspended.
- ///
- Suspended,
-
- ///
- /// The orchestration status is unknown.
- ///
- Unknown
-}
diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableRunStatus.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableRunStatus.cs
new file mode 100644
index 0000000000..bb9bdee0f4
--- /dev/null
+++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableRunStatus.cs
@@ -0,0 +1,49 @@
+// Copyright (c) Microsoft. All rights reserved.
+
+namespace Microsoft.Agents.AI.DurableTask;
+
+///
+/// Represents the execution status of a durable workflow run.
+///
+public enum DurableRunStatus
+{
+ ///
+ /// The orchestration instance was not found.
+ ///
+ NotFound,
+
+ ///
+ /// The orchestration is pending and has not started.
+ ///
+ Pending,
+
+ ///
+ /// The orchestration is currently running.
+ ///
+ Running,
+
+ ///
+ /// The orchestration completed successfully.
+ ///
+ Completed,
+
+ ///
+ /// The orchestration failed with an error.
+ ///
+ Failed,
+
+ ///
+ /// The orchestration was terminated.
+ ///
+ Terminated,
+
+ ///
+ /// The orchestration is suspended.
+ ///
+ Suspended,
+
+ ///
+ /// The orchestration status is unknown.
+ ///
+ Unknown
+}
diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableStreamingRun.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableStreamingRun.cs
index 18a58d92d3..078c2a1904 100644
--- a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableStreamingRun.cs
+++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableStreamingRun.cs
@@ -473,158 +473,3 @@ public sealed class DurableStreamingRun : IStreamingRun
return requestPorts;
}
}
-
-///
-/// Event raised when the durable workflow is waiting for external input at a .
-///
-/// The ID of the request port waiting for input.
-/// The serialized input data that was passed to the RequestPort.
-/// The full type name of the request type.
-/// The full type name of the expected response type.
-/// The request port definition, if available.
-public sealed class DurableRequestInfoEvent(
- string RequestPortId,
- string Input,
- string RequestType,
- string ResponseType,
- RequestPort? RequestPort) : WorkflowEvent(Input)
-{
- ///
- /// Gets the ID of the request port waiting for input.
- ///
- public string RequestPortId { get; } = RequestPortId;
-
- ///
- /// Gets the serialized input data that was passed to the RequestPort.
- ///
- public string Input { get; } = Input;
-
- ///
- /// Gets the full type name of the request type.
- ///
- public string RequestType { get; } = RequestType;
-
- ///
- /// Gets the full type name of the expected response type.
- ///
- public string ResponseType { get; } = ResponseType;
-
- ///
- /// Gets the request port definition, if available.
- ///
- public RequestPort? RequestPort { get; } = RequestPort;
-
- ///
- /// Attempts to deserialize the input data to the specified type.
- ///
- /// The type to deserialize to.
- /// The deserialized input, or default if deserialization fails.
- [UnconditionalSuppressMessage("AOT", "IL3050", Justification = "Deserializing workflow types provided by the caller.")]
- [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Deserializing workflow types provided by the caller.")]
- public T? GetInputAs()
- {
- try
- {
- return JsonSerializer.Deserialize(this.Input);
- }
- catch (JsonException)
- {
- return default;
- }
- }
-}
-
-///
-/// Event raised when a durable workflow completes successfully.
-///
-public sealed class DurableWorkflowCompletedEvent : WorkflowEvent
-{
- ///
- /// Initializes a new instance of the class.
- ///
- /// The serialized result of the workflow.
- public DurableWorkflowCompletedEvent(string? result) : base(result)
- {
- this.Result = result;
- }
-
- ///
- /// Gets the serialized result of the workflow.
- ///
- public string? Result { get; }
-}
-
-///
-/// Event raised when a durable workflow fails.
-///
-public sealed class DurableWorkflowFailedEvent : WorkflowEvent
-{
- ///
- /// Initializes a new instance of the class.
- ///
- /// The error message describing the failure.
- public DurableWorkflowFailedEvent(string errorMessage) : base(errorMessage)
- {
- this.ErrorMessage = errorMessage;
- }
-
- ///
- /// Gets the error message describing the failure.
- ///
- public string ErrorMessage { get; }
-}
-
-///
-/// Event raised when an executor yields intermediate output via .
-///
-///
-/// This is the durable equivalent of since that class has an internal
-/// constructor not accessible from outside the Workflows assembly.
-///
-public sealed class DurableYieldedOutputEvent : WorkflowEvent
-{
- ///
- /// Initializes a new instance of the class.
- ///
- /// The ID of the executor that yielded the output.
- /// The yielded output value.
- public DurableYieldedOutputEvent(string executorId, object output) : base(output)
- {
- this.ExecutorId = executorId;
- this.Output = output;
- }
-
- ///
- /// Gets the ID of the executor that yielded the output.
- ///
- public string ExecutorId { get; }
-
- ///
- /// Gets the yielded output value.
- ///
- public object Output { get; }
-}
-
-///
-/// Event raised when an executor requests the workflow to halt via .
-///
-///
-/// This is the durable equivalent of the internal RequestHaltEvent since that class is not accessible
-/// from outside the Workflows assembly.
-///
-public sealed class DurableHaltRequestedEvent : WorkflowEvent
-{
- ///
- /// Initializes a new instance of the class.
- ///
- /// The ID of the executor that requested the halt.
- public DurableHaltRequestedEvent(string executorId) : base($"Halt requested by {executorId}")
- {
- this.ExecutorId = executorId;
- }
-
- ///
- /// Gets the ID of the executor that requested the halt.
- ///
- public string ExecutorId { get; }
-}
diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableWorkflow.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableWorkflow.cs
index f55d621026..23d36b4fa2 100644
--- a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableWorkflow.cs
+++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableWorkflow.cs
@@ -8,7 +8,7 @@ namespace Microsoft.Agents.AI.DurableTask;
///
/// Provides methods to run workflows as durable orchestrations.
///
-public static class DurableWorkflow
+internal static class DurableWorkflow
{
///
/// Runs a workflow as a durable orchestration and returns a handle to monitor its execution.
diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableWorkflowCompletedEvent.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableWorkflowCompletedEvent.cs
new file mode 100644
index 0000000000..6a676da20f
--- /dev/null
+++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableWorkflowCompletedEvent.cs
@@ -0,0 +1,25 @@
+// Copyright (c) Microsoft. All rights reserved.
+
+using Microsoft.Agents.AI.Workflows;
+
+namespace Microsoft.Agents.AI.DurableTask;
+
+///
+/// Event raised when a durable workflow completes successfully.
+///
+public sealed class DurableWorkflowCompletedEvent : WorkflowEvent
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The serialized result of the workflow.
+ public DurableWorkflowCompletedEvent(string? result) : base(result)
+ {
+ this.Result = result;
+ }
+
+ ///
+ /// Gets the serialized result of the workflow.
+ ///
+ public string? Result { get; }
+}
diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableWorkflowFailedEvent.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableWorkflowFailedEvent.cs
new file mode 100644
index 0000000000..e68b16eae8
--- /dev/null
+++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableWorkflowFailedEvent.cs
@@ -0,0 +1,25 @@
+// Copyright (c) Microsoft. All rights reserved.
+
+using Microsoft.Agents.AI.Workflows;
+
+namespace Microsoft.Agents.AI.DurableTask;
+
+///
+/// Event raised when a durable workflow fails.
+///
+public sealed class DurableWorkflowFailedEvent : WorkflowEvent
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The error message describing the failure.
+ public DurableWorkflowFailedEvent(string errorMessage) : base(errorMessage)
+ {
+ this.ErrorMessage = errorMessage;
+ }
+
+ ///
+ /// Gets the error message describing the failure.
+ ///
+ public string ErrorMessage { get; }
+}
diff --git a/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableYieldedOutputEvent.cs b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableYieldedOutputEvent.cs
new file mode 100644
index 0000000000..db2149fde2
--- /dev/null
+++ b/dotnet/src/Microsoft.Agents.AI.DurableTask/DurableYieldedOutputEvent.cs
@@ -0,0 +1,36 @@
+// Copyright (c) Microsoft. All rights reserved.
+
+using Microsoft.Agents.AI.Workflows;
+
+namespace Microsoft.Agents.AI.DurableTask;
+
+///
+/// Event raised when an executor yields intermediate output via .
+///
+///
+/// This is the durable equivalent of since that class has an internal
+/// constructor not accessible from outside the Workflows assembly.
+///
+public sealed class DurableYieldedOutputEvent : WorkflowEvent
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The ID of the executor that yielded the output.
+ /// The yielded output value.
+ public DurableYieldedOutputEvent(string executorId, object output) : base(output)
+ {
+ this.ExecutorId = executorId;
+ this.Output = output;
+ }
+
+ ///
+ /// Gets the ID of the executor that yielded the output.
+ ///
+ public string ExecutorId { get; }
+
+ ///
+ /// Gets the yielded output value.
+ ///
+ public object Output { get; }
+}