Melic.AgentFramework.Observability 0.1.0

dotnet add package Melic.AgentFramework.Observability --version 0.1.0
                    
NuGet\Install-Package Melic.AgentFramework.Observability -Version 0.1.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="Melic.AgentFramework.Observability" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Melic.AgentFramework.Observability" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Melic.AgentFramework.Observability" />
                    
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 Melic.AgentFramework.Observability --version 0.1.0
                    
#r "nuget: Melic.AgentFramework.Observability, 0.1.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 Melic.AgentFramework.Observability@0.1.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=Melic.AgentFramework.Observability&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Melic.AgentFramework.Observability&version=0.1.0
                    
Install as a Cake Tool

Melic.AgentFramework.Observability

OpenTelemetry-native observability for the Microsoft Agent Framework (MAF). Adds session identity tracking, per-session token aggregation, custom business tags, optional session-scoped parent spans, tool-call span enrichment, and export-boundary telemetry redaction — all without modifying MAF internals.

Packages

Package Purpose
Melic.AgentFramework.Observability Recommended metapackage — installs Sessions, Tools, and Redaction together
Melic.AgentFramework.Observability.Abstractions Shared attribute constants (SessionAttributeNames, ToolAttributeNames) and adapter contracts
Melic.AgentFramework.Observability.Sessions Session lifecycle tracing — enriches every invoke_agent span with genai.session.* tags
Melic.AgentFramework.Observability.Tools Tool-call tracing — enriches MAF execute_tool spans with bounded payload and retry attributes
Melic.AgentFramework.Observability.Redaction Export-boundary trace redaction — masks selected sensitive span attributes before export

Quick Start

using Melic.AgentFramework.Observability.Redaction;
using Melic.AgentFramework.Observability.Sessions;
using Melic.AgentFramework.Observability.Tools;
using OpenTelemetry;
using OpenTelemetry.Trace;

// Register the middleware (order matters: UseOpenTelemetry must be outermost)
var agent = new AIAgentBuilder(innerAgent)
    .UseOpenTelemetry()       // outermost — creates the invoke_agent span
    .UseSessionTelemetry()    // innermost — enriches the open span
    .UseToolTelemetry()       // enriches execute_tool spans for tools
    .Build();

// Each AgentSession gets a stable, auto-generated session ID automatically.
// Optionally assign your own:
session.AssignSessionId("order-42");

// Optionally attach business context tags:
session.SetSessionTag("tenant.id", "contoso");
session.SetSessionTag("user.tier", "premium");

using var tracerProvider = Sdk.CreateTracerProviderBuilder()
    .AddSource("Experimental.Microsoft.Agents.AI")
    .AddSource("Melic.AgentFramework.Observability.Sessions")
    .AddSource("Melic.AgentFramework.Observability.Tools")
    .AddTelemetryRedaction()
    .AddConsoleExporter()
    .Build();

Installing the metapackage is the recommended entrypoint for most consumers. If you only want part of the suite, you can still install Sessions, Tools, and Redaction individually.

Key Features

  • Zero-config session IDs — every session gets a stable genai.session.id automatically
  • Token aggregationgenai.session.input_tokens and genai.session.output_tokens accumulate across all turns
  • Custom tags — attach arbitrary genai.* business context to every span in a session
  • Mode B tracing — opt-in explicit parent span via BeginSessionTrace() for visual trace trees
  • Tool-call enrichment — adds stable genai.tool.* attributes to MAF execute_tool spans
  • Payload diagnostics — optional valid-JSON input and output capture with bounded size
  • Retry detection — repeated tool call ids are marked with retry attributes within the current invocation
  • Telemetry redaction — selected high-risk tool and GenAI attributes can be masked before export
  • OTel-only dependencies — depends only on OpenTelemetry.Api, no MAF internals

Documentation

Full technical documentation — including deployment patterns, stateless REST API guidance, public API reference, and the complete telemetry schema — lives in the GitHub repository:

There are no supported framework assets in this 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.1.0 235 7/5/2026