Pervaxis.Core.AI 1.6.0

dotnet add package Pervaxis.Core.AI --version 1.6.0
                    
NuGet\Install-Package Pervaxis.Core.AI -Version 1.6.0
                    
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="Pervaxis.Core.AI" Version="1.6.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Pervaxis.Core.AI" Version="1.6.0" />
                    
Directory.Packages.props
<PackageReference Include="Pervaxis.Core.AI" />
                    
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 Pervaxis.Core.AI --version 1.6.0
                    
#r "nuget: Pervaxis.Core.AI, 1.6.0"
                    
#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 Pervaxis.Core.AI@1.6.0
                    
#: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=Pervaxis.Core.AI&version=1.6.0
                    
Install as a Cake Addin
#tool nuget:?package=Pervaxis.Core.AI&version=1.6.0
                    
Install as a Cake Tool

Pervaxis.Core.AI

AWS Bedrock Converse API integration with guardrail evaluation, human approval gating, versioned prompt registry, and fully traceable AI invocation results. Implements Section 18 of the Pervaxis Platform Spec.

Installation

dotnet add package Pervaxis.Core.AI

Registration

builder.Services.AddPervaxisAI(options =>
{
    options.Bedrock.DefaultModelId = BedrockModelIds.ClaudeSonnet46;
    options.Bedrock.Region = "us-east-1";
});

Configuration via appsettings.json:

{
  "Pervaxis": {
    "AI": {
      "Bedrock": {
        "DefaultModelId": "us.anthropic.claude-sonnet-4-6-20251101-v1:0",
        "Region": "us-east-1",
        "MaxTokens": 2048,
        "Temperature": 0.3
      }
    }
  }
}

Available Models

BedrockModelIds.ClaudeSonnet46   // us.anthropic.claude-sonnet-4-6-20251101-v1:0
BedrockModelIds.ClaudeOpus46     // us.anthropic.claude-opus-4-6-20251101-v1:0
BedrockModelIds.ClaudeHaiku45    // us.anthropic.claude-haiku-4-5-20251001-v1:0
BedrockModelIds.NovaProV1        // us.amazon.nova-pro-v1:0
BedrockModelIds.TitanEmbeddingsV2 // amazon.titan-embed-text-v2:0

Invoking Bedrock

public class TriageService(IBedrockClient bedrock, IPromptRegistry prompts)
{
    public async Task<string> AnalyseAsync(string incidentDetail, CancellationToken ct)
    {
        var prompt = prompts.GetLatest("triage.root-cause-analysis");

        var result = await bedrock.InvokeAsync(new AiInvocationRequest
        {
            SystemPrompt = prompt.Render(new Dictionary<string, string>
            {
                ["serviceName"] = "order-service"
            }),
            UserMessage = incidentDetail,
            PromptKey = prompt.Key,
            PromptVersion = prompt.Version,
            RiskLevel = AiRiskLevel.Low,
            CorrelationId = correlationId
        }, ct);

        return result.Output;
    }
}

AI Invocation Pipeline (Section 18)

Every invocation flows through:

Request → GuardrailPolicy.EvaluateAsync()
             ↓ Blocked → throw
        → ApprovalGate.RequiresApproval(riskLevel)?
             ↓ Yes → ApprovalGate.RequestApprovalAsync()
        → BedrockRuntime.ConverseAsync()
        → AiInvocationResult<string> (fully traceable)

Versioned Prompt Registry

// Register prompts at startup
registry.Register(new PromptDefinition
{
    Key = "triage.root-cause-analysis",
    Version = "1.0.0",
    Content = "You are a {serviceName} expert. Analyse: {incident}",
    RiskLevel = AiRiskLevel.Low
});

// Retrieve by exact version or latest
var prompt = registry.Get("triage.root-cause-analysis", "1.0.0");
var latest = registry.GetLatest("triage.root-cause-analysis");

// Render with variables
var rendered = prompt.Render(new Dictionary<string, string>
{
    ["serviceName"] = "order-service",
    ["incident"] = "DB connection timeout"
});

Risk Levels and Approval Gate

Risk Level AutoApprovalGate Behaviour
Low Auto-approved
Medium Auto-approved
High Throws InvalidOperationException — replace with real gate
Critical Throws InvalidOperationException — replace with real gate

For production, register a real IAiActionApprovalGate (ServiceNow, Slack workflow, etc.):

builder.Services.AddScoped<IAiActionApprovalGate, ServiceNowApprovalGate>();

Custom Guardrails

public sealed class ContentFilterPolicy : IAiGuardrailPolicy
{
    public string PolicyName => "content-filter";

    public Task<GuardrailResult> EvaluateAsync(
        AiInvocationRequest request, CancellationToken ct = default)
    {
        if (request.UserMessage.Contains("DROP TABLE"))
            return Task.FromResult(GuardrailResult.Block(PolicyName, "SQL injection attempt"));

        return Task.FromResult(GuardrailResult.Pass());
    }
}

// Register
builder.Services.AddAiGuardrailPolicy<ContentFilterPolicy>();

AWS IAM Requirements

{
  "Effect": "Allow",
  "Action": ["bedrock:InvokeModel", "bedrock:Converse"],
  "Resource": "arn:aws:bedrock:us-east-1::foundation-model/*"
}

Pervaxis Platform · Clarivex Technologies · https://clarivex.tech

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
1.6.0 44 6/6/2026