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
<PackageReference Include="Melic.AgentFramework.Observability" Version="0.1.0" />
<PackageVersion Include="Melic.AgentFramework.Observability" Version="0.1.0" />
<PackageReference Include="Melic.AgentFramework.Observability" />
paket add Melic.AgentFramework.Observability --version 0.1.0
#r "nuget: Melic.AgentFramework.Observability, 0.1.0"
#:package Melic.AgentFramework.Observability@0.1.0
#addin nuget:?package=Melic.AgentFramework.Observability&version=0.1.0
#tool nuget:?package=Melic.AgentFramework.Observability&version=0.1.0
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.idautomatically - Token aggregation —
genai.session.input_tokensandgenai.session.output_tokensaccumulate 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 MAFexecute_toolspans - 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:
Links
Learn more about Target Frameworks and .NET Standard.
-
net10.0
- Melic.AgentFramework.Observability.Redaction (>= 0.1.0)
- Melic.AgentFramework.Observability.Sessions (>= 0.1.0)
- Melic.AgentFramework.Observability.Tools (>= 0.1.0)
-
net8.0
- Melic.AgentFramework.Observability.Redaction (>= 0.1.0)
- Melic.AgentFramework.Observability.Sessions (>= 0.1.0)
- Melic.AgentFramework.Observability.Tools (>= 0.1.0)
-
net9.0
- Melic.AgentFramework.Observability.Redaction (>= 0.1.0)
- Melic.AgentFramework.Observability.Sessions (>= 0.1.0)
- Melic.AgentFramework.Observability.Tools (>= 0.1.0)
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 |