Anvia
Integrations

Langfuse

Public exports from @anvia/langfuse.

Import from @anvia/langfuse.

LangfuseTracingOptions

type LangfuseTracingOptions = {
  publicKey?: string;
  secretKey?: string;
  baseUrl?: string;
  environment?: string;
  release?: string;
};

Purpose: configure Langfuse tracing and scoring.

Return behavior: consumed by langfuse.create(...).

Notable errors: scoring requires both publicKey and secretKey.

LangfuseTracing

type LangfuseTracing = AgentObserver & {
  flush(): Promise<void>;
  shutdown(): Promise<void>;
  score(args: AgentScoreArgs): Promise<void>;
};

Purpose: Agent observer with Langfuse lifecycle and scoring methods.

Return behavior: can be passed to AgentBuilder.observe(...).

Notable errors: score(...) throws without a trace id or credentials and rejects on Langfuse API failures.

langfuse

const langfuse: {
  create(options?: LangfuseTracingOptions): LangfuseTracing;
};

Purpose: factory for Langfuse tracing observers.

Return behavior: starts an OpenTelemetry SDK with a Langfuse span processor and returns an observer.

Notable errors: construction or later flush/shutdown can fail through OpenTelemetry or Langfuse dependencies.