AgentGuard.Extensions.Presidio 0.0.1-preview-02

This is a prerelease version of AgentGuard.Extensions.Presidio.
dotnet add package AgentGuard.Extensions.Presidio --version 0.0.1-preview-02
                    
NuGet\Install-Package AgentGuard.Extensions.Presidio -Version 0.0.1-preview-02
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AgentGuard.Extensions.Presidio" Version="0.0.1-preview-02" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AgentGuard.Extensions.Presidio" Version="0.0.1-preview-02" />
                    
Directory.Packages.props
<PackageReference Include="AgentGuard.Extensions.Presidio" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AgentGuard.Extensions.Presidio --version 0.0.1-preview-02
                    
#r "nuget: AgentGuard.Extensions.Presidio, 0.0.1-preview-02"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AgentGuard.Extensions.Presidio@0.0.1-preview-02
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AgentGuard.Extensions.Presidio&version=0.0.1-preview-02&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=AgentGuard.Extensions.Presidio&version=0.0.1-preview-02&prerelease
                    
Install as a Cake Tool

AgentGuard.Extensions.Presidio

Example

using AgentGuard.Core;
using AgentGuard.Extensions.Abstractions;
using AgentGuard.Extensions.Presidio;
using Microsoft.Extensions.DependencyInjection;
using Presidio;
using Presidio.DependencyInjection;
using Presidio.Enums;
using Presidio.Models;
using Presidio.Options;

var services = new ServiceCollection();
services.AddPresidioSDK(new PresidioSDKOptions
{
    AnalyzerBaseAddress = new Uri("http://localhost:5002"),
    AnonymizerBaseAddress = new Uri("http://localhost:5001")
});

var serviceProvider = services.BuildServiceProvider();

var analyzer = serviceProvider.GetRequiredService<IPresidioAnalyzer>();
var anonymizer = serviceProvider.GetRequiredService<IPresidioAnonymizer>();

var options = new PresidioRuleOptions
{
    Analyzer = analyzer,
    Anonymizer = anonymizer,
    Language = "nl",
    Operation = PiiOperation.Replace,
    Replacement = "<REDACTED>",
    AdHocRecognizers =
    [
        new PatternRecognizer
        {
            Name = "Dutch Postcode recognizer",
            SupportedEntity = "NL_POSTCODE",
            SupportedLanguage = "nl",
            GlobalRegexFlags = RegexFlags.Multiline | RegexFlags.DotAll,
            Patterns =
            [
                new Pattern
                {
                    Name = "Dutch Postcode",
                    Regex = @"\b[1-9][0-9]{3}\s?(?!SA|SD|SS)[A-Z]{2}\b",
                    Score = 1
                }
            ],
            Context = ["postcode"]
        }
    ]
};

var policy = new GuardrailPolicyBuilder()
    .RedactPresidioPii(options)
    .Build();

var input = "Peter Jansen, Dorpsstraat 10, 5678 CD Utrecht, peter.jansen@email.com";
var result = await policy.EvaluateInputAsync(input);

Console.WriteLine(result.Text);

Sponsors

Entity Framework Extensions and Dapper Plus are major sponsors and proud to contribute to the development of AgentGuard.Extensions.

Entity Framework Extensions

Dapper Plus

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.1-preview-02 63 9/17/2026
0.0.1-preview-01 60 9/16/2026