Andes.Extensions.AI.Agent
0.3.1
dotnet add package Andes.Extensions.AI.Agent --version 0.3.1
NuGet\Install-Package Andes.Extensions.AI.Agent -Version 0.3.1
<PackageReference Include="Andes.Extensions.AI.Agent" Version="0.3.1" />
<PackageVersion Include="Andes.Extensions.AI.Agent" Version="0.3.1" />
<PackageReference Include="Andes.Extensions.AI.Agent" />
paket add Andes.Extensions.AI.Agent --version 0.3.1
#r "nuget: Andes.Extensions.AI.Agent, 0.3.1"
#:package Andes.Extensions.AI.Agent@0.3.1
#addin nuget:?package=Andes.Extensions.AI.Agent&version=0.3.1
#tool nuget:?package=Andes.Extensions.AI.Agent&version=0.3.1
Andes.Extensions.AI.Agent
Microsoft Agent Framework support for Andes.Extensions.AI tool tracking. Adds two things on top of the core middleware:
- Classification — agents wrapped with
WithTracking()are recognized asToolKind.Agentand render with the"Calling {Agent} Agent"header in progress updates and usage reports. - Usage capture — each agent run's
AgentResponse.Usageis attributed to the calling tool's scope, so hosted or remote agents' token usage lands in theChatUsageReporteven when their pipeline cannot be instrumented.
Install
dotnet add package Andes.Extensions.AI.Agent
Quickstart
using Andes.Extensions.AI;
using Microsoft.Agents.AI;
using Microsoft.Extensions.AI;
AIAgent weatherAgent = weatherChatClient.AsAIAgent(
instructions: "You answer questions about the weather.",
name: "Weather Agent",
description: "Answers questions about the weather.",
tools: [AIFunctionFactory.Create(GetWeather)]);
IChatClient client = innerClient
.AsBuilder()
.UseToolTracking(options => options.UseAgentToolClassification())
.UseFunctionInvocation() // tracking must be registered before function invocation
.Build();
var chatOptions = new ChatOptions
{
Tools = [weatherAgent.WithTracking()],
};
await foreach (ChatResponseUpdate update in client.GetStreamingResponseAsync("prompt", chatOptions))
{
foreach (ChatProgressContent progress in update.Contents.OfType<ChatProgressContent>())
{
// e.g. "Calling Weather Agent" (header), then any statuses the agent's tools report
Console.WriteLine(progress.Progress.Message);
}
}
WithTracking carries the agent identity used for classification and attributes each run's usage to the calling tool's scope. Pass trackUsage: false when the agent's own chat pipeline uses UseToolTracking() — the nested pipeline already rolls its total usage up, and reporting AgentResponse.Usage on top would double-count. Pass reportFunctionCalls: true to additionally report a "Calling {Function} Tool" status each time the agent invokes one of its function tools (local function-invoking agents only; names only).
Nested agents render as their own activity: when a WithTracking-wrapped agent is a tool of another agent, or is invoked directly inside a tool body, the wrapper opens a child tracking scope — the run streams as a child activity under the enclosing tool (ParentScopeId/Depth on its progress events) and lands as a child ToolCallUsage with its own usage and duration in the ChatUsageReport. A tool the tracking middleware wrapped itself still opens exactly one scope, and report totals are unchanged either way.
Notes
- A function created by a plain
agent.AsAIFunction()call exposes neither its agent nor its usage; withoutWithTrackingit classifies as a regular function tool. The same applies to agents hidden inside your ownDelegatingAIFunctionwrappers, which this package never unwraps or bypasses. - The agent runs in-process on the caller's async flow, so statuses its tools report through
ChatProgress.Report(...)surface beneath the agent's header automatically. - Usage capture reports whatever the agent implementation surfaces on
AgentResponse.Usage; agents that report no usage attribute nothing. - Privacy posture matches the core package: progress events never carry prompt content, tool arguments, or tool results.
Full documentation lives in the repository docs.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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. |
-
net10.0
- Andes.Extensions.AI (>= 0.3.1)
- Microsoft.Agents.AI (>= 1.15.0)
- Microsoft.Extensions.AI (>= 10.8.1)
- Microsoft.Extensions.AI.Abstractions (>= 10.8.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.