Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
d8d46d2
feat(tracing)!: remove trace-level input/output setters
cursoragent Oct 6, 2026
d74d5b7
Merge branch 'lfe-17058-python-sdk-v5-rework-batch-evaluation-for-lan…
cursoragent Oct 6, 2026
2ac8aa2
test: read e2e assertions through the v4 observations API
cursoragent Oct 6, 2026
2ec7149
ci: run e2e against an events_only server
cursoragent Oct 6, 2026
d2ca89a
test: pin that create_score logs invalid input without enqueueing
cursoragent Oct 6, 2026
350b84b
test: remove the v3 wait_for_trace helper
cursoragent Oct 6, 2026
ac540d1
Merge branch 'lfe-17076-python-sdk-v5-remove-trace-level-inputoutput-…
cursoragent Oct 7, 2026
042c67e
Merge branch 'lfe-17058-python-sdk-v5-rework-batch-evaluation-for-lan…
cursoragent Oct 7, 2026
0c39181
test: keep scalar text IO as strings and read full response_format
cursoragent Oct 7, 2026
3816713
Merge branch 'lfe-17058-python-sdk-v5-rework-batch-evaluation-for-lan…
cursoragent Oct 7, 2026
8da2887
Merge branch 'lfe-17076-python-sdk-v5-remove-trace-level-inputoutput-…
cursoragent Oct 7, 2026
0e505a0
Merge branch 'lfe-17058-python-sdk-v5-rework-batch-evaluation-for-lan…
cursoragent Oct 7, 2026
0aaddc3
Merge branch 'lfe-17076-python-sdk-v5-remove-trace-level-inputoutput-…
cursoragent Oct 7, 2026
12fdcd9
test: dedupe observation rows and assert streamed text as a string
cursoragent Oct 7, 2026
716fd8f
Merge branch 'lfe-17058-python-sdk-v5-rework-batch-evaluation-for-lan…
cursoragent Oct 7, 2026
38be28c
Merge branch 'lfe-17076-python-sdk-v5-remove-trace-level-inputoutput-…
cursoragent Oct 7, 2026
0b672b8
Merge branch 'lfe-17058-python-sdk-v5-rework-batch-evaluation-for-lan…
cursoragent Oct 7, 2026
20861a2
Merge branch 'lfe-17076-python-sdk-v5-remove-trace-level-inputoutput-…
cursoragent Oct 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions .github/langfuse-v4-dual-write.override.yml

This file was deleted.

2 changes: 0 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,6 @@ jobs:
LANGFUSE_SERVER_SHA="$(git ls-remote https://github.com/langfuse/langfuse.git HEAD | cut -f1)"
curl -fsSL "https://raw.githubusercontent.com/langfuse/langfuse/${LANGFUSE_SERVER_SHA}/docker-compose.yml" \
-o ./langfuse-server/docker-compose.yml
cp ./.github/langfuse-v4-dual-write.override.yml \
./langfuse-server/docker-compose.override.yml
echo "${LANGFUSE_SERVER_SHA}"

- name: Run langfuse server
Expand Down
6 changes: 0 additions & 6 deletions langfuse/_client/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ class LangfuseOtelSpanAttributes:
TRACE_TAGS = "langfuse.trace.tags"
TRACE_PUBLIC = "langfuse.trace.public"
TRACE_METADATA = "langfuse.trace.metadata"
TRACE_INPUT = "langfuse.trace.input"
TRACE_OUTPUT = "langfuse.trace.output"

# Langfuse-observation attributes
OBSERVATION_TYPE = "langfuse.observation.type"
Expand Down Expand Up @@ -76,13 +74,9 @@ class LangfuseOtelSpanAttributes:

def create_trace_attributes(
*,
input: Optional[Any] = None,
output: Optional[Any] = None,
public: Optional[bool] = None,
) -> dict:
attributes = {
LangfuseOtelSpanAttributes.TRACE_INPUT: _serialize(input),
LangfuseOtelSpanAttributes.TRACE_OUTPUT: _serialize(output),
LangfuseOtelSpanAttributes.TRACE_PUBLIC: public,
}

Expand Down
52 changes: 1 addition & 51 deletions langfuse/_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
_agnosticcontextmanager,
)
from packaging.version import Version
from typing_extensions import deprecated

from langfuse._client.attributes import (
LangfuseOtelSpanAttributes,
Expand Down Expand Up @@ -213,7 +212,7 @@ class Langfuse:
release (Optional[str]): Release version/hash of your application. Used for grouping analytics by release.
media_upload_thread_count (Optional[int]): Number of background threads for handling media uploads. Defaults to 1. Can also be set via LANGFUSE_MEDIA_UPLOAD_THREAD_COUNT environment variable.
sample_rate (Optional[float]): Sampling rate for traces (0.0 to 1.0). Defaults to 1.0 (100% of traces are sampled). Can also be set via LANGFUSE_SAMPLE_RATE environment variable.
mask (Optional[MaskFunction]): Function to mask sensitive data synchronously when Langfuse SDK attributes are created. This applies only to data set through Langfuse SDK APIs such as `start_observation()`, `update()`, and `set_trace_io()`.
mask (Optional[MaskFunction]): Function to mask sensitive data synchronously when Langfuse SDK attributes are created. This applies only to data set through Langfuse SDK APIs such as `start_observation()` and `update()`.
mask_otel_spans (Optional[MaskOtelSpansFunction]): Synchronous export-stage hook for masking raw OpenTelemetry span attributes before this Langfuse client sends them to Langfuse. Use this for spans created by third-party OpenTelemetry instrumentations, or when you need to inspect final span attributes after export filtering and Langfuse media handling. It does not modify spans already exported through other OpenTelemetry exporters.

The hook receives one OpenTelemetry export batch. A batch is not guaranteed to contain a complete trace, request, or Langfuse observation tree. The hook usually runs on the OpenTelemetry batch span processor worker thread; during `flush()` and shutdown it may run on the caller thread. Keep it synchronous, deterministic, and fast.
Expand Down Expand Up @@ -1534,55 +1533,6 @@ def update_current_span(
status_message=status_message,
)

@deprecated(
"Trace-level input/output is deprecated. "
"For trace attributes (user_id, session_id, tags, etc.), use propagate_attributes() instead. "
"This method will be removed in a future major version."
)
def set_current_trace_io(
self,
*,
input: Optional[Any] = None,
output: Optional[Any] = None,
) -> None:
"""Set trace-level input and output for the current span's trace.

.. deprecated::
This is a legacy method 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 (user_id, session_id, metadata, tags, version),
use :func:`langfuse.propagate_attributes` (top-level import) instead.

Args:
input: Input data to associate with the trace.
output: Output data to associate with the trace.
"""
if not self._tracing_enabled:
langfuse_logger.debug(
"Operation skipped: set_current_trace_io - Tracing is disabled or client is in no-op mode."
)
return

current_otel_span = self._get_current_otel_span()

if current_otel_span is not None and current_otel_span.is_recording():
span_class = self._get_span_class(
self._get_observation_type_from_otel_span(current_otel_span)
)
span = span_class(
otel_span=current_otel_span,
langfuse_client=self,
environment=self._environment,
release=self._release,
)

span.set_trace_io(
input=input,
output=output,
)

def set_current_trace_as_public(self) -> None:
"""Make the current trace publicly accessible via its URL.

Expand Down
48 changes: 0 additions & 48 deletions langfuse/_client/span.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
if TYPE_CHECKING:
from langfuse._client.client import Langfuse

from typing_extensions import deprecated

from langfuse._client.attributes import (
LangfuseOtelSpanAttributes,
Expand Down Expand Up @@ -226,53 +225,6 @@ def end(self, *, end_time: Optional[int] = None) -> "LangfuseObservationWrapper"

return self

@deprecated(
"Trace-level input/output is deprecated. "
"For trace attributes (user_id, session_id, tags, etc.), use propagate_attributes() instead. "
"This method will be removed in a future major version."
)
def set_trace_io(
self,
*,
input: Optional[Any] = None,
output: Optional[Any] = None,
) -> "LangfuseObservationWrapper":
"""Set trace-level input and output for the trace this span belongs to.

.. deprecated::
This is a legacy method 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 (user_id, session_id, metadata, tags, version),
use :func:`langfuse.propagate_attributes` (top-level import) instead.

Args:
input: Input data to associate with the trace.
output: Output data to associate with the trace.

Returns:
The span instance for method chaining.
"""
if not self._otel_span.is_recording():
return self

media_processed_input = self._process_media_and_apply_mask(
data=input, field="input", span=self._otel_span
)
media_processed_output = self._process_media_and_apply_mask(
data=output, field="output", span=self._otel_span
)

attributes = create_trace_attributes(
input=media_processed_input,
output=media_processed_output,
)

self._otel_span.set_attributes(attributes)

return self

def set_trace_as_public(self) -> "LangfuseObservationWrapper":
"""Make this trace publicly accessible via its URL.

Expand Down
2 changes: 0 additions & 2 deletions langfuse/_client/span_exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

_INPUT_MEDIA_ATTRIBUTE_KEYS = frozenset(
{
LangfuseOtelSpanAttributes.TRACE_INPUT,
LangfuseOtelSpanAttributes.OBSERVATION_INPUT,
"ai.prompt.messages",
"ai.prompt",
Expand All @@ -54,7 +53,6 @@

_OUTPUT_MEDIA_ATTRIBUTE_KEYS = frozenset(
{
LangfuseOtelSpanAttributes.TRACE_OUTPUT,
LangfuseOtelSpanAttributes.OBSERVATION_OUTPUT,
"ai.response.text",
"ai.result.text",
Expand Down
Loading
Loading