diff --git a/dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/OpenAIResponseClientExtensions.cs b/dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/OpenAIResponseClientExtensions.cs
index 98561704f2..09046e1822 100644
--- a/dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/OpenAIResponseClientExtensions.cs
+++ b/dotnet/src/Microsoft.Agents.AI.OpenAI/Extensions/OpenAIResponseClientExtensions.cs
@@ -100,15 +100,23 @@ public static ChatClientAgent AsAIAgent(
/// This corresponds to setting the "store" property in the JSON representation to false.
///
/// The client.
+ ///
+ /// Includes an encrypted version of reasoning tokens in reasoning item outputs.
+ /// This enables reasoning items to be used in multi-turn conversations when using the Responses API statelessly
+ /// (like when the store parameter is set to false, or when an organization is enrolled in the zero data retention program).
+ /// Defaults to .
+ ///
/// An that can be used to converse via the that does not store responses for later retrieval.
/// is .
[Experimental(DiagnosticIds.Experiments.AgentsAIExperiments)]
- public static IChatClient AsIChatClientWithStoredOutputDisabled(this ResponsesClient responseClient)
+ public static IChatClient AsIChatClientWithStoredOutputDisabled(this ResponsesClient responseClient, bool includeReasoningEncryptedContent = true)
{
return Throw.IfNull(responseClient)
.AsIChatClient()
.AsBuilder()
- .ConfigureOptions(x => x.RawRepresentationFactory = _ => new CreateResponseOptions() { StoredOutputEnabled = false })
+ .ConfigureOptions(x => x.RawRepresentationFactory = _ => includeReasoningEncryptedContent
+ ? new CreateResponseOptions() { StoredOutputEnabled = false, IncludedProperties = { IncludedResponseProperty.ReasoningEncryptedContent } }
+ : new CreateResponseOptions() { StoredOutputEnabled = false })
.Build();
}
}
diff --git a/dotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Extensions/OpenAIResponseClientExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Extensions/OpenAIResponseClientExtensionsTests.cs
index 19a39c1d35..1205889e19 100644
--- a/dotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Extensions/OpenAIResponseClientExtensionsTests.cs
+++ b/dotnet/tests/Microsoft.Agents.AI.OpenAI.UnitTests/Extensions/OpenAIResponseClientExtensionsTests.cs
@@ -291,6 +291,85 @@ public void AsIChatClientWithStoredOutputDisabled_InnerResponsesClientIsAccessib
Assert.Same(responseClient, innerClient);
}
+ ///
+ /// Verify that AsIChatClientWithStoredOutputDisabled with includeReasoningEncryptedContent false
+ /// wraps the original ResponsesClient, which remains accessible via the service chain.
+ ///
+ [Fact]
+ public void AsIChatClientWithStoredOutputDisabled_WithIncludeReasoningFalse_InnerResponsesClientIsAccessible()
+ {
+ // Arrange
+ var responseClient = new TestOpenAIResponseClient();
+
+ // Act
+ var chatClient = responseClient.AsIChatClientWithStoredOutputDisabled(includeReasoningEncryptedContent: false);
+
+ // Assert - the inner ResponsesClient should be accessible via GetService
+ var innerClient = chatClient.GetService();
+ Assert.NotNull(innerClient);
+ Assert.Same(responseClient, innerClient);
+ }
+
+ ///
+ /// Verify that AsIChatClientWithStoredOutputDisabled with default parameter (includeReasoningEncryptedContent = true)
+ /// configures StoredOutputEnabled to false and includes ReasoningEncryptedContent in IncludedProperties.
+ ///
+ [Fact]
+ public void AsIChatClientWithStoredOutputDisabled_Default_ConfiguresStoredOutputDisabledWithReasoningEncryptedContent()
+ {
+ // Arrange
+ var responseClient = new TestOpenAIResponseClient();
+
+ // Act
+ var chatClient = responseClient.AsIChatClientWithStoredOutputDisabled();
+
+ // Assert
+ var createResponseOptions = GetCreateResponseOptionsFromPipeline(chatClient);
+ Assert.NotNull(createResponseOptions);
+ Assert.False(createResponseOptions.StoredOutputEnabled);
+ Assert.Contains(IncludedResponseProperty.ReasoningEncryptedContent, createResponseOptions.IncludedProperties);
+ }
+
+ ///
+ /// Verify that AsIChatClientWithStoredOutputDisabled with includeReasoningEncryptedContent explicitly set to true
+ /// configures StoredOutputEnabled to false and includes ReasoningEncryptedContent in IncludedProperties.
+ ///
+ [Fact]
+ public void AsIChatClientWithStoredOutputDisabled_WithIncludeReasoningTrue_ConfiguresStoredOutputDisabledWithReasoningEncryptedContent()
+ {
+ // Arrange
+ var responseClient = new TestOpenAIResponseClient();
+
+ // Act
+ var chatClient = responseClient.AsIChatClientWithStoredOutputDisabled(includeReasoningEncryptedContent: true);
+
+ // Assert
+ var createResponseOptions = GetCreateResponseOptionsFromPipeline(chatClient);
+ Assert.NotNull(createResponseOptions);
+ Assert.False(createResponseOptions.StoredOutputEnabled);
+ Assert.Contains(IncludedResponseProperty.ReasoningEncryptedContent, createResponseOptions.IncludedProperties);
+ }
+
+ ///
+ /// Verify that AsIChatClientWithStoredOutputDisabled with includeReasoningEncryptedContent set to false
+ /// configures StoredOutputEnabled to false and does not include ReasoningEncryptedContent in IncludedProperties.
+ ///
+ [Fact]
+ public void AsIChatClientWithStoredOutputDisabled_WithIncludeReasoningFalse_ConfiguresStoredOutputDisabledWithoutReasoningEncryptedContent()
+ {
+ // Arrange
+ var responseClient = new TestOpenAIResponseClient();
+
+ // Act
+ var chatClient = responseClient.AsIChatClientWithStoredOutputDisabled(includeReasoningEncryptedContent: false);
+
+ // Assert
+ var createResponseOptions = GetCreateResponseOptionsFromPipeline(chatClient);
+ Assert.NotNull(createResponseOptions);
+ Assert.False(createResponseOptions.StoredOutputEnabled);
+ Assert.DoesNotContain(IncludedResponseProperty.ReasoningEncryptedContent, createResponseOptions.IncludedProperties);
+ }
+
///
/// A simple test IServiceProvider implementation for testing.
///
@@ -309,4 +388,24 @@ private sealed class TestServiceProvider : IServiceProvider
BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
return property?.GetValue(client) as IServiceProvider;
}
+
+ ///
+ /// Extracts the produced by the ConfigureOptions pipeline
+ /// by using reflection to access the configure action and invoking it on a test .
+ ///
+ private static CreateResponseOptions? GetCreateResponseOptionsFromPipeline(IChatClient chatClient)
+ {
+ // The ConfigureOptionsChatClient stores the configure action in a private field.
+ var configureField = chatClient.GetType().GetField("_configureOptions", BindingFlags.NonPublic | BindingFlags.Instance);
+ Assert.NotNull(configureField);
+
+ var configureAction = configureField.GetValue(chatClient) as Action;
+ Assert.NotNull(configureAction);
+
+ var options = new ChatOptions();
+ configureAction(options);
+
+ Assert.NotNull(options.RawRepresentationFactory);
+ return options.RawRepresentationFactory(chatClient) as CreateResponseOptions;
+ }
}
diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/ChatMessageExtensionsTests.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/ChatMessageExtensionsTests.cs
index 5dae26e348..833ab0d402 100644
--- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/ChatMessageExtensionsTests.cs
+++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/Extensions/ChatMessageExtensionsTests.cs
@@ -1,6 +1,5 @@
// Copyright (c) Microsoft. All rights reserved.
-using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Agents.AI.Workflows.Declarative.Extensions;
diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/EditTableExecutorTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/EditTableExecutorTest.cs
index ad9d51c2fe..77e7f45ff6 100644
--- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/EditTableExecutorTest.cs
+++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/EditTableExecutorTest.cs
@@ -1,6 +1,5 @@
// Copyright (c) Microsoft. All rights reserved.
-using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
diff --git a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/RequestExternalInputExecutorTest.cs b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/RequestExternalInputExecutorTest.cs
index 1e11f1a0ae..8eda895b15 100644
--- a/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/RequestExternalInputExecutorTest.cs
+++ b/dotnet/tests/Microsoft.Agents.AI.Workflows.Declarative.UnitTests/ObjectModel/RequestExternalInputExecutorTest.cs
@@ -1,6 +1,5 @@
// Copyright (c) Microsoft. All rights reserved.
-using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;