- Fully generated C# SDK based on official Guardrails AI OpenAPI specification using AutoSDK
- Same day update to support new features
- Updated and supported automatically if there are no breaking changes
- All modern .NET features - nullability, trimming, NativeAOT, etc.
- MEAI
AIFunctiontools for use with anyIChatClient
using Guardrails;
// Connect to a self-hosted Guardrails server (default: http://localhost:8000)
using var client = new GuardrailsClient(apiKey);
// Or specify a custom base URL
using var client = new GuardrailsClient(apiKey, baseUri: new Uri("https://my-guardrails-server.example.com"));var result = await client.Validate.ValidateAsync(
guardName: "my-guard",
llmOutput: "Some LLM output to validate");
Console.WriteLine($"Validation passed: {result.ValidationPassed}");var guards = await client.Guard.GetGuardsAsync();
foreach (var guard in guards)
{
Console.WriteLine($"Guard: {guard.Name} ({guard.Id})");
}using Microsoft.Extensions.AI;
// Use Guardrails as tools with any IChatClient
var tools = new[]
{
client.AsValidateTool(),
client.AsListGuardsTool(),
client.AsGetGuardTool(),
};
var chatOptions = new ChatOptions { Tools = [..tools] };Priority place for bugs: https://github.com/tryAGI/Guardrails/issues
Priority place for ideas and general questions: https://github.com/tryAGI/Guardrails/discussions
Discord: https://discord.gg/Ca2xhfBf3v
This project is supported by JetBrains through the Open Source Support Program.
