VOOZH about

URL: https://www.nuget.org/packages/Diagrid.AI.Microsoft.AgentFramework/

⇱ NuGet Gallery | Diagrid.AI.Microsoft.AgentFramework 1.0.8




👁 Image
Diagrid.AI.Microsoft.AgentFramework 1.0.8

dotnet add package Diagrid.AI.Microsoft.AgentFramework --version 1.0.8
 
 
NuGet\Install-Package Diagrid.AI.Microsoft.AgentFramework -Version 1.0.8
 
 
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="Diagrid.AI.Microsoft.AgentFramework" Version="1.0.8" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Diagrid.AI.Microsoft.AgentFramework" Version="1.0.8" />
 
Directory.Packages.props
<PackageReference Include="Diagrid.AI.Microsoft.AgentFramework" />
 
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 Diagrid.AI.Microsoft.AgentFramework --version 1.0.8
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Diagrid.AI.Microsoft.AgentFramework, 1.0.8"
 
 
#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 Diagrid.AI.Microsoft.AgentFramework@1.0.8
 
 
#: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=Diagrid.AI.Microsoft.AgentFramework&version=1.0.8
 
Install as a Cake Addin
#tool nuget:?package=Diagrid.AI.Microsoft.AgentFramework&version=1.0.8
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

👁 Logo

👁 NuGet Version

Diagrid.AI.Microsoft.AgentFramework is a library that facilitates building agents using Microsoft's Agent Framework atop Dapr's Durable Workflows.

Register Agents with dependency injection

Simple DI registration

The following shows the simple dependency injection registration of MAF agents:

var builder = WebApplication.CreateBuilder(args);

// Register Dapr conversation client
builder.Services.AddDaprConversationClient();

// Register agents to run within 
builder.Services.AddDaprAgents()
 .WithAgent(
 agentName: "SampleAgent",
 conversationComponentName: "converastion-ollama",
 instructions: "You are a helpful assistant. Answer normally unless the prompt asks for JSON.",
 serviceLifetime: ServiceLifetime.Singleton);

var app = builder.Build();

Register Agents with typed deserialization contexts

The following elaborates to show how agent responses can be coerced into typed and deserialized JSON responses:

// Register the record that the result will be deserialized into
public sealed record StructuredAnswer(string Answer, double Confidence);

// Register the context used to deserialize the result - additional types need only be added with more `JsonSerializable` attributes
[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase)]
[JsonSerializable(typeof(StructuredAnswer))]
public partial class AgentInvokerJsonContext : JsonSerializerContext;

// Program startup
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDaprConversationClient();
builder.Services.AddDaprAgents(serializationOptions => 
{
 serializationOptions.AddContext(() => AgentInvokerJsonContext.Default);
}).WithAgent(
 agentName: "SampleAgent",
 conversationComponentName: "conversation-ollama",
 instructions: "You are a helpful assistant. Answer normally unless the prompt asks for JSON.",
 serviceLifetime: ServiceLifetime.Singleton);

var app = builder.Build();

Register Agents alongside Dapr Workflows

The following shows how Dapr Workflows can be registered alongside agent registrations:

// Register the record that the result will be deserialized into
public sealed record StructuredAnswer(string Answer, double Confidence);

// Register the context used to deserialize the result - additional types need only be added with more `JsonSerializable` attributes
[JsonSourceGenerationOptions(PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase)]
[JsonSerializable(typeof(StructuredAnswer))]
public partial class AgentInvokerJsonContext : JsonSerializerContext;

var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDaprConversationClient();
builder.Services.AddDaprAgents(serializationOptions => 
{
 serializationOptions.AddContext(() => AgentInvokerJsonContext.Default); // Necessary to deserialize the workflow results to strongly typed values
}, workflowOptions => 
{
 workflowOptions.RegisterWorkflow<SampleWorkflow>(); // Register workflow types normally here
}).WithAgent(
 agentName: "SampleAgent",
 conversationComponentName: "conversation-ollama",
 instructions: "You are a helpful assistant. Answer normally unless the prompt asks for JSON.",
 serviceLifetime: ServiceLifetime.Singleton);

var app = builder.Build();

Using Agents

Agents can be invoked in a variety of ways. The following examples show the most common approaches.

Via IDaprAgentInvoker injection

In this example, the IDaprAgentInvoker is registered via any of the above approaches with dependency injection and is used to provision an instance of the named agent.

public sealed record AskRequest(string Prompt);
app.MapPost("/ask", async (IDaprAgentInvoker invoker, AskRequest request, CancellationToken ct = default) => 
{
 var agent = invoker.GetAgent("SampleAgent"); // Retrieves the instance of the registered agent
 var response = await invoker.RunAgentAsync(agent, request.Prompt, cancellationToken: ct);
 return Results.Ok(new { response = response.Text });
});

Within Dapr Workflow context

In this example, we access an instance of a registered Agent from within a Dapr Workflow context.

public sealed partial class SampleWorkflow : Workflow<string, string>
{
 public override async Task<string> RunAsync(WorkflowContext context, string input)
 {
 var logger = context.CreateReplaySafeLogger(nameof(SampleWorkflow));
 var agent = context.GetAgent("SampleAgent"); // Retrieves the instance of the registered agent
 var result = await context.RunAgentAndDeserializeAsync<StructuredAnswer>(
 agent: agent,
 message: $"Analyze and return JSON: {{\"answer\": string, \"confidence\": number}}\n{input}"),
 logger: logger)
 .ConfigureAwait(false); // Runs the agent invocation as a Dapr workflow and returns the strongly-typed result
 // ...
 }
}

Links

Product Versions Compatible and additional computed target framework versions.
.NET net8.0 net8.0 is compatible.  net8.0-android net8.0-android was computed.  net8.0-browser net8.0-browser was computed.  net8.0-ios net8.0-ios was computed.  net8.0-maccatalyst net8.0-maccatalyst was computed.  net8.0-macos net8.0-macos was computed.  net8.0-tvos net8.0-tvos was computed.  net8.0-windows net8.0-windows was computed.  net9.0 net9.0 is compatible.  net9.0-android net9.0-android was computed.  net9.0-browser net9.0-browser was computed.  net9.0-ios net9.0-ios was computed.  net9.0-maccatalyst net9.0-maccatalyst was computed.  net9.0-macos net9.0-macos was computed.  net9.0-tvos net9.0-tvos was computed.  net9.0-windows net9.0-windows was computed.  net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows 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.0.8 138 6/16/2026
1.0.7 711 5/6/2026
1.0.6 131 4/30/2026
1.0.5 171 4/16/2026
1.0.4 105 4/14/2026
1.0.3 117 4/7/2026
1.0.3-rc.5 71 4/7/2026
1.0.2 91 3/11/2026