diff --git a/dotnet/Directory.Packages.props b/dotnet/Directory.Packages.props
index c5bd2191c4..09ddef3781 100644
--- a/dotnet/Directory.Packages.props
+++ b/dotnet/Directory.Packages.props
@@ -70,6 +70,7 @@
+
diff --git a/dotnet/agent-framework-dotnet.slnx b/dotnet/agent-framework-dotnet.slnx
index 576d2c5c54..c36761c9fc 100644
--- a/dotnet/agent-framework-dotnet.slnx
+++ b/dotnet/agent-framework-dotnet.slnx
@@ -453,6 +453,10 @@
+
+
+
+
diff --git a/dotnet/eng/MSBuild/Shared.props b/dotnet/eng/MSBuild/Shared.props
index 94ac5b417b..1a3feb4c4f 100644
--- a/dotnet/eng/MSBuild/Shared.props
+++ b/dotnet/eng/MSBuild/Shared.props
@@ -29,4 +29,7 @@
+
+
+
diff --git a/dotnet/src/Microsoft.Agents.AI.FoundryMemory/FoundryMemoryProvider.cs b/dotnet/src/Microsoft.Agents.AI.FoundryMemory/FoundryMemoryProvider.cs
index 35baa055d1..6f9f37518e 100644
--- a/dotnet/src/Microsoft.Agents.AI.FoundryMemory/FoundryMemoryProvider.cs
+++ b/dotnet/src/Microsoft.Agents.AI.FoundryMemory/FoundryMemoryProvider.cs
@@ -10,6 +10,7 @@
using System.Threading.Tasks;
using Azure.AI.Projects;
using Microsoft.Extensions.AI;
+using Microsoft.Extensions.Compliance.Redaction;
using Microsoft.Extensions.Logging;
using Microsoft.Shared.DiagnosticIds;
using Microsoft.Shared.Diagnostics;
@@ -37,7 +38,7 @@ public sealed class FoundryMemoryProvider : AIContextProvider
private readonly string _memoryStoreName;
private readonly int _maxMemories;
private readonly int _updateDelay;
- private readonly bool _enableSensitiveTelemetryData;
+ private readonly Redactor _redactor;
private readonly AIProjectClient _client;
private readonly ILogger? _logger;
@@ -79,7 +80,7 @@ public FoundryMemoryProvider(
this._memoryStoreName = memoryStoreName;
this._maxMemories = effectiveOptions.MaxMemories;
this._updateDelay = effectiveOptions.UpdateDelay;
- this._enableSensitiveTelemetryData = effectiveOptions.EnableSensitiveTelemetryData;
+ this._redactor = effectiveOptions.EnableSensitiveTelemetryData ? NullRedactor.Instance : (effectiveOptions.Redactor ?? new ReplacingRedactor(""));
}
///
@@ -416,7 +417,7 @@ private static MessageResponseItem ToResponseItem(ChatRole role, string text)
private static bool IsAllowedRole(ChatRole role) =>
role == ChatRole.User || role == ChatRole.Assistant || role == ChatRole.System;
- private string? SanitizeLogData(string? data) => this._enableSensitiveTelemetryData ? data : "";
+ private string SanitizeLogData(string? data) => this._redactor.Redact(data);
///
/// Represents the state of a stored in the .
diff --git a/dotnet/src/Microsoft.Agents.AI.FoundryMemory/FoundryMemoryProviderOptions.cs b/dotnet/src/Microsoft.Agents.AI.FoundryMemory/FoundryMemoryProviderOptions.cs
index 870fe1d271..cf4fb5ab15 100644
--- a/dotnet/src/Microsoft.Agents.AI.FoundryMemory/FoundryMemoryProviderOptions.cs
+++ b/dotnet/src/Microsoft.Agents.AI.FoundryMemory/FoundryMemoryProviderOptions.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using Microsoft.Extensions.AI;
+using Microsoft.Extensions.Compliance.Redaction;
namespace Microsoft.Agents.AI.FoundryMemory;
@@ -37,8 +38,22 @@ public sealed class FoundryMemoryProviderOptions
/// Gets or sets a value indicating whether sensitive data such as user ids and user messages may appear in logs.
///
/// Defaults to .
+ ///
+ /// When set to , sensitive data is passed through to logs unchanged and any
+ /// configured is ignored. This property takes precedence over .
+ ///
public bool EnableSensitiveTelemetryData { get; set; }
+ ///
+ /// Gets or sets a custom used to redact sensitive data in log output.
+ ///
+ ///
+ /// When (the default), sensitive data is replaced with a placeholder.
+ /// When set, this redactor is used to transform sensitive values before they are logged.
+ /// Ignored when is .
+ ///
+ public Redactor? Redactor { get; set; }
+
///
/// Gets or sets the key used to store the provider state in the session's .
///
diff --git a/dotnet/src/Microsoft.Agents.AI.FoundryMemory/Microsoft.Agents.AI.FoundryMemory.csproj b/dotnet/src/Microsoft.Agents.AI.FoundryMemory/Microsoft.Agents.AI.FoundryMemory.csproj
index a1b8f85ae8..7abc3d0bcc 100644
--- a/dotnet/src/Microsoft.Agents.AI.FoundryMemory/Microsoft.Agents.AI.FoundryMemory.csproj
+++ b/dotnet/src/Microsoft.Agents.AI.FoundryMemory/Microsoft.Agents.AI.FoundryMemory.csproj
@@ -8,6 +8,7 @@
truetrue
+ truetruetrue
@@ -20,6 +21,7 @@
+
diff --git a/dotnet/src/Microsoft.Agents.AI.Mem0/Mem0Provider.cs b/dotnet/src/Microsoft.Agents.AI.Mem0/Mem0Provider.cs
index d7c54e2114..8be799ac1a 100644
--- a/dotnet/src/Microsoft.Agents.AI.Mem0/Mem0Provider.cs
+++ b/dotnet/src/Microsoft.Agents.AI.Mem0/Mem0Provider.cs
@@ -8,6 +8,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.AI;
+using Microsoft.Extensions.Compliance.Redaction;
using Microsoft.Extensions.Logging;
using Microsoft.Shared.Diagnostics;
@@ -51,7 +52,7 @@ public sealed class Mem0Provider : MessageAIContextProvider
private readonly ProviderSessionState _sessionState;
private IReadOnlyList? _stateKeys;
private readonly string _contextPrompt;
- private readonly bool _enableSensitiveTelemetryData;
+ private readonly Redactor _redactor;
private readonly Mem0Client _client;
private readonly ILogger? _logger;
@@ -91,7 +92,7 @@ public Mem0Provider(HttpClient httpClient, Func stateIniti
this._client = new Mem0Client(httpClient);
this._contextPrompt = options?.ContextPrompt ?? DefaultContextPrompt;
- this._enableSensitiveTelemetryData = options?.EnableSensitiveTelemetryData ?? false;
+ this._redactor = options?.EnableSensitiveTelemetryData == true ? NullRedactor.Instance : (options?.Redactor ?? new ReplacingRedactor(""));
}
///
@@ -297,5 +298,5 @@ public State(Mem0ProviderScope storageScope, Mem0ProviderScope? searchScope = nu
public Mem0ProviderScope SearchScope { get; }
}
- private string? SanitizeLogData(string? data) => this._enableSensitiveTelemetryData ? data : "";
+ private string SanitizeLogData(string? data) => this._redactor.Redact(data);
}
diff --git a/dotnet/src/Microsoft.Agents.AI.Mem0/Mem0ProviderOptions.cs b/dotnet/src/Microsoft.Agents.AI.Mem0/Mem0ProviderOptions.cs
index 4a3a16712f..2c09bf9a7d 100644
--- a/dotnet/src/Microsoft.Agents.AI.Mem0/Mem0ProviderOptions.cs
+++ b/dotnet/src/Microsoft.Agents.AI.Mem0/Mem0ProviderOptions.cs
@@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using Microsoft.Extensions.AI;
+using Microsoft.Extensions.Compliance.Redaction;
namespace Microsoft.Agents.AI.Mem0;
@@ -21,8 +22,22 @@ public sealed class Mem0ProviderOptions
/// Gets or sets a value indicating whether sensitive data such as user ids and user messages may appear in logs.
///
/// Defaults to .
+ ///
+ /// When set to , sensitive data is passed through to logs unchanged and any
+ /// configured is ignored. This property takes precedence over .
+ ///
public bool EnableSensitiveTelemetryData { get; set; }
+ ///
+ /// Gets or sets a custom used to redact sensitive data in log output.
+ ///
+ ///
+ /// When (the default), sensitive data is replaced with a placeholder.
+ /// When set, this redactor is used to transform sensitive values before they are logged.
+ /// Ignored when is .
+ ///
+ public Redactor? Redactor { get; set; }
+
///
/// Gets or sets the key used to store the provider state in the session's .
///
diff --git a/dotnet/src/Microsoft.Agents.AI.Mem0/Microsoft.Agents.AI.Mem0.csproj b/dotnet/src/Microsoft.Agents.AI.Mem0/Microsoft.Agents.AI.Mem0.csproj
index 52bcdda165..9612b3d4b0 100644
--- a/dotnet/src/Microsoft.Agents.AI.Mem0/Microsoft.Agents.AI.Mem0.csproj
+++ b/dotnet/src/Microsoft.Agents.AI.Mem0/Microsoft.Agents.AI.Mem0.csproj
@@ -6,6 +6,7 @@
true
+ truetrue
@@ -23,6 +24,10 @@
+
+
+
+
Microsoft Agent Framework - Mem0 integration
diff --git a/dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProvider.cs b/dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProvider.cs
index 6881f7303f..2bc8408a26 100644
--- a/dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProvider.cs
+++ b/dotnet/src/Microsoft.Agents.AI/Memory/ChatHistoryMemoryProvider.cs
@@ -7,6 +7,7 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.AI;
+using Microsoft.Extensions.Compliance.Redaction;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.VectorData;
using Microsoft.Shared.Diagnostics;
@@ -80,7 +81,7 @@ public sealed class ChatHistoryMemoryProvider : MessageAIContextProvider, IDispo
private readonly VectorStoreCollection