AIAgentSharp 1.0.0

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

AIAgentSharp

A powerful .NET library for building AI agents with LLM integration, tool execution, and state management.

Features

  • 🔄 Re/Act Pattern Support: Full implementation of the Re/Act (Reasoning and Acting) pattern for LLM agents
  • 🔧 Function Calling: Support for OpenAI-style function calling when available
  • ��️ Tool Framework: Rich tool system with automatic schema generation, validation, and introspection
  • 💾 State Persistence: Multiple state store implementations (in-memory, file-based)
  • 📊 Real-time Monitoring: Comprehensive event system for monitoring agent activity
  • 🔄 Loop Detection: Intelligent loop breaker to prevent infinite loops
  • 🔄 Deduplication: Smart caching of tool results to improve performance

Quick Start

using AIAgentSharp;

// Create components
var llm = new OpenAiLlmClient(apiKey, "gpt-4");
var store = new MemoryAgentStateStore();
var tools = new List<ITool> { new ConcatTool(), new GetIndicatorTool() };

// Configure agent
var config = new AgentConfiguration
{
    MaxTurns = 40,
    UseFunctionCalling = true,
    EmitPublicStatus = true
};

// Create and run agent
var agent = new StatefulAgent(llm, store, config: config);
var result = await agent.RunAsync("my-agent", "Your goal here", tools);

Console.WriteLine($"Success: {result.Succeeded}");
Console.WriteLine($"Output: {result.FinalOutput}");

Creating Custom Tools

[ToolParams(Description = "Parameters for weather lookup")]
public sealed class WeatherParams
{
    [ToolField(Description = "City name", Required = true)]
    public string City { get; set; } = default!;
}

public sealed class WeatherTool : BaseTool<WeatherParams, object>
{
    public override string Name => "get_weather";
    public override string Description => "Get current weather for a city";

    public override async Task<object> InvokeTypedAsync(WeatherParams parameters, CancellationToken ct = default)
    {
        // Your weather API logic here
        return new { city = parameters.City, temperature = "22°C" };
    }
}

Installation

dotnet add package AIAgentSharp

Documentation

For detailed documentation, examples, and API reference, visit: https://github.com/erwin-beckers/AIAgentSharp

License

MIT License - see LICENSE file for details.

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 was computed.  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 was computed.  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 (4)

Showing the top 4 NuGet packages that depend on AIAgentSharp:

Package Downloads
AIAgentSharp.OpenAI

OpenAI integration for AIAgentSharp - LLM-powered agents with OpenAI models.

AIAgentSharp.Gemini

Google Gemini integration for AIAgentSharp - LLM-powered agents with Google Gemini models.

AIAgentSharp.Mistral

Mistral AI integration for AIAgentSharp - LLM-powered agents with Mistral AI models.

AIAgentSharp.Anthropic

Anthropic Claude integration for AIAgentSharp - LLM-powered agents with Anthropic Claude models.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.11 130 8/22/2025
1.0.10 112 8/22/2025
1.0.9 137 8/20/2025
1.0.8 177 8/18/2025
1.0.7 121 8/18/2025
1.0.6 126 8/18/2025
1.0.5 125 8/18/2025
1.0.4 129 8/17/2025
1.0.2 128 8/17/2025
1.0.1 100 8/17/2025
1.0.0 101 8/17/2025