IntentSharp.Guardrails
1.1.0
Prefix Reserved
dotnet add package IntentSharp.Guardrails --version 1.1.0
NuGet\Install-Package IntentSharp.Guardrails -Version 1.1.0
<PackageReference Include="IntentSharp.Guardrails" Version="1.1.0" />
<PackageVersion Include="IntentSharp.Guardrails" Version="1.1.0" />
<PackageReference Include="IntentSharp.Guardrails" />
paket add IntentSharp.Guardrails --version 1.1.0
#r "nuget: IntentSharp.Guardrails, 1.1.0"
#:package IntentSharp.Guardrails@1.1.0
#addin nuget:?package=IntentSharp.Guardrails&version=1.1.0
#tool nuget:?package=IntentSharp.Guardrails&version=1.1.0
IntentSharp.Guardrails: versioned rule files for AI and application operations
Keep allow and deny lists, patterns, ranges, JSON Schema checks and operation limits in YAML or JSON rule files. IntentSharp evaluates the configured rules in your process at model, tool and data-operation checkpoints. The checks themselves make no model call, and a deny rule takes precedence over an allow rule.
Use this package when rule sets belong outside compiled C# code. It adds document-backed guardrails to IntentSharp, targets .NET 8, .NET 9 and .NET 10, and installs the matching core version. An application that supplies rule sets in code needs only the core package.
Quick start: refuse access to an audit table
This complete example checks a proposed data operation. It does not connect to a database or call a model.
dotnet new console -n RuleFiles --framework net8.0
cd RuleFiles
dotnet add package IntentSharp.Guardrails --version 1.1.0
Create policy/intentsharp.guardrails.yaml, the manifest that lists the rule files:
intentsharp: guardrails/1
documents: [rules/orders.rules.yaml]
Create policy/rules/orders.rules.yaml:
intentsharp: rules/1
set: orders-data
checkpoint: data
rules:
- { id: tables, subject: data.entities, allow: [orders, customers] }
- { id: no-audit, subject: data.entities, deny: [audit_log] }
- { id: read-only, subject: data.operations, allow: [read] }
settings:
data.maxResults: 500
Add this item group inside the application project file:
<ItemGroup>
<None Update="policy/**/*" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
Replace Program.cs with:
using System.Text.Json.Nodes;
using IntentSharp;
using IntentSharp.Documents;
using IntentSharp.Guardrails;
using IntentSharp.Testing;
var provider = new ScriptedProvider();
using var store = new FolderDocumentStore(Path.Combine(AppContext.BaseDirectory, "policy"));
using var client = new IntentClientBuilder()
.UseProvider(provider)
.WithDocumentStore(store)
.WithGuardrailFiles(store, "orders-data")
.Build();
var subjects = new SubjectValues()
.Add("data.entities", new JsonArray("audit_log"))
.Add("data.operations", new JsonArray("read"));
var decision = await client.CheckAsync(GuardrailCheckpoint.Data, subjects, ["orders-data"]);
Console.WriteLine($"Allowed: {decision.Allowed}");
foreach (var violation in decision.Violations) Console.WriteLine(violation.Message);
Console.WriteLine($"Provider calls: {provider.CallCount}");
Run dotnet run. Allowed is False, the violations describe the refusal, and Provider calls is 0.
The scripted provider supplies the client's provider dependency; this check never asks it for a reply.
The application must honor the decision before performing its operation. For generated commands, implement an
ITarget and use the core's TargetRuntime to integrate command inspection and execution with the data checkpoint.
A standalone CheckAsync call does not execute or intercept database commands.
Checkpoints
| Checkpoint | Checked before |
|---|---|
request |
A model call |
reply |
A model reply is returned |
tool |
An intent runs as a tool |
embedding |
An embedding call |
data |
A target executes a command |
environment |
A recompile |
Reload rules and retain decision context
Decisions identify the rule set, document and version that were evaluated. Supported saved edits apply to later checks; a rule file that fails to load keeps its last good version in force. Versioned documents support reverting an earlier definition. An enforced rule must cover the subjects it governs, and a missing security setting fails closed.
The example reads the files copied to the build output. To change rules while the application runs, edit the watched output files or configure a managed absolute folder. Editing the project copy alone reaches the build output only at the next build.
An edit that widens access is flagged and applies by default after validation. Applications that require approval
must supply their own edit writer to hold it for review. Turning plain-language rules into deterministic checks
through WithRuleCompilation or AddRuleCompilation is experimental and opt-in; ordinary rule evaluation does not
require it. These rules govern the integrated checkpoints, not arbitrary code or operations outside them.
Which package do I need?
| Need | Package |
|---|---|
| Typed model calls and code-defined checks | IntentSharp |
| Instructions, result shapes and rules in named intent files | IntentSharp.Catalog |
| Versioned checkpoint rule files | IntentSharp.Guardrails |
An existing IChatClient or catalog intents exposed as agent tools |
IntentSharp.Extensions.AI |
| Models defined per intent, obtained from a specialist service you wire in | IntentSharp.Specialist |
Keep all installed IntentSharp packages at the same version. Rule files and intent files serve different purposes; Catalog does not replace checkpoint rule sets.
Documentation, evaluation and support
Commercial software, not open source. Evaluate free for 30 days on development and test systems; after that, business use needs a paid license. Production use needs a paid license from the first day. For help, use the website's support information or NuGet's Contact owners link.
The wider direction
External rule files are one building block of Unified Intent Architecture. Your application defines the protected operations, integrations and human approvals; this package provides the versioned rules checked at its checkpoints.
Built and sold by C2Consultants LLC. C2Empowered, the company's self-hosted operations platform, is built on IntentSharp; how the two fit together.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. 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. |
-
net10.0
- IntentSharp (= 1.1.0)
- JsonSchema.Net (>= 9.4.1)
- YamlDotNet (>= 18.1.0)
-
net8.0
- IntentSharp (= 1.1.0)
- JsonSchema.Net (>= 9.4.1)
- YamlDotNet (>= 18.1.0)
-
net9.0
- IntentSharp (= 1.1.0)
- JsonSchema.Net (>= 9.4.1)
- YamlDotNet (>= 18.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
IntentSharp 1.1.0: a fifth package, IntentSharp.Specialist, for models defined per intent, and additions to the four existing packages. Nothing is removed or changed in meaning, so an application on 1.0.x upgrades without code changes. Release notes: https://intentsharp.com/changelog