Devlooped.Agents.AI 0.9.0-rc.2

Prefix Reserved
This is a prerelease version of Devlooped.Agents.AI.
dotnet add package Devlooped.Agents.AI --version 0.9.0-rc.2
                    
NuGet\Install-Package Devlooped.Agents.AI -Version 0.9.0-rc.2
                    
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="Devlooped.Agents.AI" Version="0.9.0-rc.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Devlooped.Agents.AI" Version="0.9.0-rc.2" />
                    
Directory.Packages.props
<PackageReference Include="Devlooped.Agents.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 Devlooped.Agents.AI --version 0.9.0-rc.2
                    
#r "nuget: Devlooped.Agents.AI, 0.9.0-rc.2"
                    
#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 Devlooped.Agents.AI@0.9.0-rc.2
                    
#: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=Devlooped.Agents.AI&version=0.9.0-rc.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Devlooped.Agents.AI&version=0.9.0-rc.2&prerelease
                    
Install as a Cake Tool

EULA OSS GitHub

Extensions for Microsoft.Agents.AI, such as configuration-driven auto-reloading agents.

Open Source Maintenance Fee

To ensure the long-term sustainability of this project, users of this package who generate revenue must pay an Open Source Maintenance Fee. While the source code is freely available under the terms of the License, this package and other aspects of the project require adherence to the Maintenance Fee.

To pay the Maintenance Fee, become a Sponsor at the proper OSMF tier. A single fee covers all of Devlooped packages.

Overview

Microsoft.Agents.AI (aka Agent Framework is a comprehensive API for building AI agents. Its programatic model (which follows closely the Microsoft.Extensions.AI approach) provides maximum flexibility with little prescriptive structure.

This package provides additional extensions to make developing agents easier and more declarative.

Configurable Agents

Tweaking agent options such as description, instructions, chat client to use and its options, etc. is very common during development/testing. This package provides the ability to drive those settings from configuration (with auto-reload support). This makes it far easier to experiment with various combinations of agent instructions, chat client providers and options, and model parameters without changing code, recompiling or even restarting the application:

This example shows integration with configurable chat clients feature from the Devlooped.Extensions.AI package, but any IChatClient registered in the DI container with a matching key can be used.

{
  "AI": {
    "Agents": {
      "MyAgent": {
        "Description": "An AI agent that helps with customer support.",
        "Instructions": "You are a helpful assistant for customer support.",
        "Client": "Grok",
        "Options": {
          "ModelId": "grok-4",
          "Temperature": 0.5,
        }
      }
    },
    "Clients": {
      "Grok": {
        "Endpoint": "https://api.grok.ai/v1",
        "ModelId": "grok-4-fast-non-reasoning",
        "ApiKey": "xai-asdf"
      }
    }
  }
}
var host = new HostApplicationBuilder(args);
host.Configuration.AddJsonFile("appsettings.json, optional: false, reloadOnChange: true);

// πŸ‘‡ implicitly calls AddChatClients
host.AddAIAgents(); 

var app = host.Build();
var agent = app.Services.GetRequiredKeyedService<AIAgent>("MyAgent");

Agents are also properly registered in the corresponding Microsoft Agent Framework AgentCatalog:

var catalog = app.Services.GetRequiredService<AgentCatalog>();
await foreach (AIAgent agent in catalog.GetAgentsAsync())
{
    var metadata = agent.GetService<AIAgentMetadata>();
    Console.WriteLine($"Agent: {agent.Name} by {metadata.ProviderName}");
}

You can of course use any config format supported by .NET configuration, such as TOML which is arguably more human-friendly for hand-editing:

[ai.clients.openai]
modelid = "gpt-4.1"

[ai.clients.grok]
endpoint = "https://api.x.ai/v1"
modelid = "grok-4-fast-non-reasoning"

[ai.agents.orders]
description = "Manage orders using catalogs for food or any other item."
instructions = """
        You are an AI agent responsible for processing orders for food or other items.
        Your primary goals are to identify user intent, extract or request provider information, manage order data using tools and friendly responses to guide users through the ordering process.
    """

# ai.clients.openai, can omit the ai.clients prefix
client = "openai"

[ai.agents.orders.options]
modelid = "gpt-4o-mini"

This can be used by leveraging Tomlyn.Extensions.Configuration.

This package will automatically dedent and trim start and end newlines from multi-line instructions and descriptions when applying the configuration, avoiding unnecessary tokens being used for indentation while allowing flexible formatting in the config file.

You can also leverage the format pioneered by VS Code Chat Modes, (por "custom agents") by using markdown format plus YAML front-matter for better readability:

---
id: ai.agents.notes
description: Provides free-form memory
client: grok
model: grok-4-fast
---
You organize and keep notes for the user.
# Some header
More content

Visual Studio Code will ignore the additional attributes used by this project. In particular, the model property is a shorthand for setting the options.modelid, but in our implementation, the latter takes precedence over the former, which allows you to rely on model to drive the VSCode testing, and the longer form for run-time with the Agents Framework:

---
id: ai.agents.notes
description: Provides free-form memory
model: Grok Code Fast 1 (copilot)
client: grok
options: 
  modelid: grok-code-fast-1
---
// Instructions

agent model picker

Use the provided AddAgentMarkdown extension method to load instructions from files as follows:

var host = new HostApplicationBuilder(args);
host.Configuration.AddAgentMarkdown("notes.agent.md", optional: false, reloadOnChange: true);

The id field in the front-matter is required and specifies the configuration section name, and all other fields are added as if they were specified under it in the configuration.

Extensible AI Contexts

The Microsoft agent framework allows extending agents with dynamic context via AIContextProvider and AIContext. This package supports dynamic extension of a configured agent in the following ways (in order of priority):

  1. A keyed service AIContextProviderFactory with the same name as the agent will be set up just as if you had set it manually as the ChatClientAgentOptions.AIContextProviderFactory in code.
  2. A keyed service AIContextProvider with the same name as the agent.
  3. A keyed service AIContext with the same name as the agent.
  4. Aggregate of AI contexts pulled in via use setting for an agent.

The first three alternatives enable auto-wiring of context providers or contexts registered in the service collection and are pretty self-explanatory. The last alternative allows even more declarative scenarios involving reusable and cross-cutting context definitions.

For example, let's say you want to provide consistent tone for all your agents. It would be tedious, repetitive and harder to maintain if you had to set that in each agent's instructions. Instead, you can define a reusable context named tone such as:

[ai.context.tone]
instructions = """\
    Default to using spanish language, using argentinean "voseo" in your responses \
    (unless the user explicitly talks in a different language). \
    This means using "vos" instead of "tΓΊ" and conjugating verbs accordingly. \
    Don't use the expression "pa'" instead of "para". Don't mention the word "voseo".
    """

Then, you can reference that context in any agent using the use setting:

[ai.agents.support]
description = "An AI agent that helps with customer support."
instructions = "..."
client = "grok"
use = ["tone"]

[ai.agents.sales]
description = "An AI agent that helps with sales inquiries."
instructions = "..."
client = "openai"
use = ["tone"]

Configured contexts can provide all three components of an AIContext: instructions, messages and tools, such as:

[ai.context.timezone]
instructions = "Always assume the user's timezone is America/Argentina/Buenos_Aires unless specified otherwise."
messages = [
    { system = "You are aware of the current date and time in America/Argentina/Buenos_Aires." }
]
tools = ["get_date"]

If multiple contexts are specified in use, they are applied in order, concatenating their instructions, messages and tools.

In addition to configured sections, the use property can also reference exported contexts as either AIContext (for static context) or AIContextProvider (for dynamic context) registered in DI with a matching name.

Extensible Tools

The tools section allows specifying tool names registered in the DI container, such as:

services.AddKeyedSingleton("get_date", AIFunctionFactory.Create(() => DateTimeOffset.Now, "get_date"));

This tool will be automatically wired into any agent that uses the timezone context above.

Agents themselves can also add tools from DI into an agent's context without having to define an entire section just for that, by specifying the tool name directly in the tools array:

[ai.agents.support]
description = "An AI agent that helps with customer support."
instructions = "..."
client = "grok"
use = ["tone"]
tools = ["get_date"]

This enables a flexible and convenient mix of static and dynamic context for agents, all driven from configuration.

In addition to registering your own tools in DI, you can also use leverage the MCP C# SDK and reuse the same tool declarations:

builder.Services.AddMcpServer().WithTools<NotesTools>();

// πŸ‘‡ Reuse same tool definitions in agents
builder.AddAIAgents().WithTools<NotesTools>();

Sponsors

Clarius Org MFB Technologies, Inc. DRIVE.NET, Inc. Keith Pickford Thomas Bolon Kori Francis Uno Platform Reuben Swartz Jacob Foshee alternate text is missing from this package README image Eric Johnson David JENNI Jonathan Charley Wu Ken Bonny Simon Cropp agileworks-eu Zheyu Shen Vezel ChilliCream 4OTC Vincent Limo domischell Justin Wendlandt Adrian Alonso Michael Hagedorn alternate text is missing from this package README image torutek mccaffers

Sponsor this project

Learn more about GitHub Sponsors

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
0.9.0-rc.2 36 11/5/2025
0.9.0-rc.1 137 10/29/2025
0.9.0-rc 124 10/27/2025
0.9.0-beta 51 10/17/2025