LangfuseTelemetry
NexusLabs.Needlr.AgentFramework.Langfuse¶
LangfuseTelemetry Class¶
Entry point for exporting Needlr agent telemetry to Langfuse without requiring a generic host. Designed for evals, console apps, and test fixtures that build telemetry by hand.
Inheritance System.Object 🡒 LangfuseTelemetry
Remarks¶
Start(LangfuseOptions) constructs standalone OpenTelemetry tracer and meter
providers that subscribe to Needlr's gen_ai activity source and meters and export them
to Langfuse over OTLP/HTTP. Dispose the returned ILangfuseSession to flush and
tear them down.
For ASP.NET Core / generic-host applications that already call AddOpenTelemetry(), use
AddNeedlrLangfuse(this IServiceCollection, Action<LangfuseOptions>)
instead so the providers participate in the host lifecycle.\<example>
\<code>
using var langfuse = LangfuseTelemetry.Start(LangfuseOptions.FromEnvironment());
using (LangfuseTrace.BeginScenario("trip-planner: NYC -> Tokyo", sessionId: runId))
{
var run = await runner.RunAsync(...);
// ... evaluate and record scores ...
}
\</code>
\</example>
Methods¶
LangfuseTelemetry.Start(LangfuseOptions) Method¶
Starts a Langfuse export session for the supplied options.
public static NexusLabs.Needlr.AgentFramework.Langfuse.ILangfuseSession Start(NexusLabs.Needlr.AgentFramework.Langfuse.LangfuseOptions options);
Parameters¶
options LangfuseOptions
The export configuration. When IsConfigured is false (for example, missing credentials), a disabled no-op session is returned so callers never need to branch on configuration state.
Returns¶
ILangfuseSession
An ILangfuseSession that exports telemetry until disposed.