LombdaAiAgents 1.0.0

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

LombdaAgentSDK

LombdaAgentSDK is a lightweight C# SDK designed to create and run modular "agents" that can execute tasks, manage state, and communicate with your custom infrastructure. Inspired by modern AI/automation agent patterns, it provides a framework for orchestrating workflows and modular logic with minimal overhead.


🚀 Features

  • ✅ Simple Agent and State abstractions for building agent workflows.
  • ⚙️ Support for state transitions, condition checks, and results.
  • 🔍 Plug-and-play: easily inject your own function handlers.
  • 📦 .NET Standard compatible – works across .NET Framework and .NET Core.

📂 Installation

You can clone the repo directly:

git clone https://github.com/Johnny2x2/LombdaAgentSDK.git

Or include the library in your solution by adding the project reference.


🔧 Usage

Run an Agent

Agent agent = new Agent(new OpenAIModelClient("gpt-4o-mini"), "Assistant", "Have fun");

RunResult result = await Runner.RunAsync(agent, "Hello World!");

Automatic Structured Output from Type

public struct math_step
{
    public string explanation { get; set; }
    public string output { get; set; }
}

Agent agent = new Agent(
    new OpenAIModelClient("gpt-4o-mini"),
    "Assistant", 
    "Have fun",
    _output_schema: typeof(math_step));

RunResult result = await Runner.RunAsync(agent, "How can I solve 8x + 7 = -23?");

//Helper function to extract json from last message
math_step mathResult = result.ParseJson<math_step>();

Simple Tool Use

void async Task Run()
{
    Agent agent = new Agent(
        new OpenAIModelClient("gpt-4o-mini"), 
        "Assistant", 
        "Have fun",  
        _tools : [GetCurrentWeather]);

    RunResult result = await Runner.RunAsync(agent, "What is the weather in boston?");

    Console.WriteLine(result.Text);
}

[Tool( Description = "Get the current weather in a given location",
       In_parameters_description = [
        "The city and state, e.g. Boston, MA",
        "The temperature unit to use. Infer this from the specified location."
        ])]
public string GetCurrentWeather(string location, Unit unit = Unit.celsius)
{
    // Call the weather API here.
    return $"31 C";
} 

Create Complex Agent Workflows

Create a States

class PlanningState : BaseState<string, WebSearchPlan>
{
    public override async Task<WebSearchPlan> Invoke()
    {
        string instructions = """
            You are a helpful research assistant. 
            Given a query, come up with a set of web searches, to perform to best answer the query. 
            Output between 5 and 20 terms to query for. 
            """;

        Agent agent = new Agent(
            new OpenAIModelClient("gpt-4o-mini"), 
            "Assistant", 
            instructions, 
            _output_schema: typeof(WebSearchPlan));

        return (await Runner.RunAsync(agent, this.Input)).ParseJson<WebSearchPlan>();
    }
}

Connect States Together

PlanningState plannerState = new PlanningState(); 
ResearchState ResearchState = new ResearchState();
ReportingState reportingState = new ReportingState();

//Add input to first branch of state machine with Set Input
plannerState.SetInput("Research for me top 3 best E-bikes under $1500 for mountain trails");

//Setup Transitions between states
plannerState.Transitions.Add(new StateTransition<WebSearchPlan>(IfPlanCreated, ResearchState)); //Check if a plan was generated or Rerun

ResearchState.Transitions.Add(new StateTransition<string>(_ => true, reportingState)); //Use Lambda expression For passthrough to reporting state

reportingState.Transitions.Add(new StateTransition<ReportData>(_ => true, new ExitState())); //Use Lambda expression For passthrough to Exit

Run the StateMachine

//Create State Machine Runner
StateMachine stateMachine = new StateMachine();

//Run the state machine
await stateMachine.Run(plannerState);

//Report on the last state with Results
Console.WriteLine(reportingState.Output.FinalReport);

Creating State Machines

States essentially transforms the Input into the Output

Where FooState : BaseState<InputType, OutputType>

Invoke() Must Return the Output Type (Strongly Typed)

You can only Transition to a state where the Output of the current state is the Input to the next state

class ConvertStringToIntState : BaseState<string, int>
{
    public override async Task<int> Invoke()
    {
        return int.Parse(this.Input)
    }
}

You can build pipelines of states and let the agent transition between them based on the results.


🚦 Roadmap

  • Add non async support for agent execution.
  • Improve logging and diagnostics.

🤝 Contributing

Pull requests are welcome! For major changes, please open an issue first to discuss what you’d like to change.


📄 License

MIT


🙌 Acknowledgements

LlmTornado OpenAI-C#

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

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.8.0 207 8/5/2025
1.7.1 98 7/27/2025
1.7.0 94 7/27/2025
1.6.2 380 7/25/2025
1.6.1 300 7/25/2025
1.6.0 494 7/23/2025
1.5.0 301 7/20/2025
1.4.3 119 7/17/2025
1.4.2 129 7/15/2025
1.4.1 140 7/15/2025
1.4.0 136 7/14/2025
1.3.0 86 7/11/2025
1.2.0 145 7/10/2025
1.1.0 144 7/9/2025
1.0.0 146 7/7/2025