IntentSharp.Extensions.AI 1.0.1

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package IntentSharp.Extensions.AI --version 1.0.1
                    
NuGet\Install-Package IntentSharp.Extensions.AI -Version 1.0.1
                    
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="IntentSharp.Extensions.AI" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IntentSharp.Extensions.AI" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="IntentSharp.Extensions.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 IntentSharp.Extensions.AI --version 1.0.1
                    
#r "nuget: IntentSharp.Extensions.AI, 1.0.1"
                    
#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 IntentSharp.Extensions.AI@1.0.1
                    
#: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=IntentSharp.Extensions.AI&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=IntentSharp.Extensions.AI&version=1.0.1
                    
Install as a Cake Tool

IntentSharp.Extensions.AI: checked results and agent tools for IChatClient

Use IntentSharp's typed results, validation and bounded retries with an existing Microsoft.Extensions.AI IChatClient. Connect a configured backend such as Ollama or Azure OpenAI, or expose named catalog intents as AIFunction tools for a Microsoft Agent Framework agent or another function-calling host.

The backend and its configured models determine which model services are available. This package bridges your chat client; it does not install or configure a vendor SDK for you. It targets .NET 8, .NET 9 and .NET 10 and installs the exact matching versions of IntentSharp and IntentSharp.Catalog.

Quick start: try the bridge without a model

This complete console example supplies a small scripted IChatClient. It returns 9, then 4. The first value breaks the numeric check, so IntentSharp retries; the second passes. It makes no network requests and needs no API key.

dotnet new console -n CheckedChatClient --framework net8.0
cd CheckedChatClient
dotnet add package IntentSharp.Extensions.AI --version 1.0.1

Replace Program.cs with:

using IntentSharp;
using IntentSharp.Extensions.AI;
using Microsoft.Extensions.AI;

using var model = new DemoChatClient();
using var client = new IntentClientBuilder()
    .UseChatClient(model, name: "demo", model: "scripted")
    .Build();

var options = new AIRequestOptions { MaxAttempts = 2, MaxModelCalls = 2 }
    .Require<int>(value => value >= 1 && value <= 5, "Urgency must be from 1 to 5.");
var result = await client.TransformAsync<int>("The production line stops tomorrow.",
    "Rate the urgency from 1 to 5.", options);

Console.WriteLine($"Success: {result.Success}");
if (result.Success) Console.WriteLine($"Urgency: {result.Value}");
else foreach (var issue in result.Issues) Console.WriteLine(issue);
Console.WriteLine($"Chat-client calls: {model.Calls}");

public sealed class DemoChatClient : IChatClient
{
    public int Calls { get; private set; }

    public Task<ChatResponse> GetResponseAsync(IEnumerable<ChatMessage> messages,
        ChatOptions? options = null, CancellationToken cancellationToken = default)
    {
        cancellationToken.ThrowIfCancellationRequested();
        Calls++;
        var text = Calls == 1 ? "{\"value\":9}" : "{\"value\":4}";
        return Task.FromResult(new ChatResponse(new ChatMessage(ChatRole.Assistant, text))
        {
            FinishReason = ChatFinishReason.Stop
        });
    }

    public IAsyncEnumerable<ChatResponseUpdate> GetStreamingResponseAsync(
        IEnumerable<ChatMessage> messages, ChatOptions? options = null,
        CancellationToken cancellationToken = default)
        => throw new NotSupportedException("This demo supplies complete replies only.");

    public object? GetService(Type serviceType, object? serviceKey = null) => null;
    public void Dispose() { }
}

Run dotnet run. The output is:

Success: True
Urgency: 4
Chat-client calls: 2

This verifies the adapter and checks with fixed replies. It does not measure a model's classification quality. For real inference, replace DemoChatClient with your application's configured IChatClient. The application keeps ownership of that client. Model calls then incur the backend's normal usage charges.

Connect an existing backend

Use UseChatClient for the primary provider and UseChatClientAsFallback for a fallback. The chat-client kind in a provider file can also select a chat client registered in dependency injection. See the Microsoft.Extensions.AI guide.

Invalid output retries with the findings, within your limits. A failed request to the chat client itself is not retried by IntentSharp; configure transport retries in the chat client's pipeline or use a fallback. A passing result means the configured checks passed, not that an answer is factually correct. IntentSharp consumes complete responses rather than streaming a partial typed result.

Give an agent checked intent tools

Once you have an IntentRuntime loaded with your intent definitions, this helper creates tool options. Save it as CatalogTools.cs:

using IntentSharp.Catalog;
using IntentSharp.Extensions.AI;
using Microsoft.Extensions.AI;

public static class CatalogTools
{
    public static ChatOptions For(IntentRuntime runtime)
        => new() { Tools = [.. runtime.AsAIFunctions()] };
}

Pass those options to your configured agent's GetResponseAsync. Its function-calling host must execute tool calls; attaching tools alone does not create an agent loop. Each intent tool returns a value after its checks pass, or an error result describing failure. Recreate the tools after a catalog reload that changes tool descriptions or adds intents, so their published metadata is current.

Which package do I need?

Need Package
Native OpenAI GPT or Anthropic Claude calls, without IChatClient IntentSharp
Named intent definitions without chat-client integration IntentSharp.Catalog
An IChatClient backend or intents exposed as agent tools IntentSharp.Extensions.AI
Versioned rule files for checkpoint enforcement IntentSharp.Guardrails

Keep all installed IntentSharp packages at the same version. Changes to instructions and compatible rules can reload through Catalog; new compiled result types, named code checks and call sites still need an application release. The agent's permissions and approval process remain application responsibilities.

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

Unified Intent Architecture separates explicit instructions, contracts and rules from application logic. This adapter connects those IntentSharp building blocks to your model and agent integrations.

Built and sold by C2Consultants LLC. C2Empowered, the company's self-hosted operations platform, is built on IntentSharp; how the two fit together.

Product 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. 
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.1.0 62 11/13/2026
1.0.1 130 11/6/2026
1.0.0 143 10/28/2026
1.0.0-rc.3 89 10/20/2026

IntentSharp 1.0.1: updated package READMEs, discovery metadata and runnable examples. No runtime or public API changes. Release notes: https://intentsharp.com/changelog