Langfuse JS/TS SDKs
    Preparing search index...

    Function setActiveTraceIO

    • Set trace-level input and output for the currently active trace.

      This function finds the currently active OpenTelemetry span and sets trace-level input/output on it. If no active span is found, a warning is logged.

      Parameters

      Returns void

      This is a legacy function for backward compatibility with Langfuse platform features that still rely on trace-level input/output (e.g., legacy LLM-as-a-judge evaluators). It will be removed in a future major version.

      For setting other trace attributes (userId, sessionId, metadata, tags, version), use propagateAttributes instead.

      import { setActiveTraceIO } from '@langfuse/tracing';

      // Inside an active span context
      setActiveTraceIO({
      input: { query: 'user question' },
      output: { response: 'assistant answer' }
      });