generate/stream calls. This guide covers dependency setup, processor initialisation, and agent-level configuration.
Dependencies
Environment variables
Initialise Langfuse
ensureLangfuseTelemetrydynamically loads@langfuse/otel, registers aNodeTracerProvider, and returns a reusable handle.autoFlushdefaults to"process":beforeExit,SIGINT, andSIGTERMtriggerflush()/shutdown()automatically.- Initialise as early as possible (server entrypoint, framework plugin, …).
Next.js example
Enable telemetry on an agent
telemetrymerges withexperimental_telemetry.- Overrides are ignored when the agent telemetry flag is off unless you explicitly set
experimental_telemetry.isEnabled.
Instrument workflows
Workflows use the same OTEL stack. See Workflow telemetry for configuration details (traceName, metadata, userId, …).