unstale

pypi / langfuse

langfuse

What changed in langfuse 4 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-20.

66 breaking1 security7 deprecations21 new APIs and options2 performance10 behavior and defaults9 fixes and other

See which of these apply to your code, ranked, in your agent:

npx @unstale/cli init

@unstale/cli on npm

langfuse 563 changes

Breaking changes 39

  • Previously deprecated public API methods are removed, including api.trace.get/list, api.sessions.*, api.legacy.*, api.ingestion.batch, and several dataset and score methods; use the documented replacements.

    5.0.1release notes

  • The SDK requires Python 3.11 or later; installing it on Python 3.10 installs the latest v4 instead.

    5.0.1release notes

  • fetch_trace_fields is renamed to fields, which defaults to core,basic,io,metadata.

    5.0.1release notes

  • The filter must now be a v2 filter JSON array.

    5.0.1release notes

  • The ingestion batch method is removed; use SDK tracing through OpenTelemetry for traces and api.scores.create for scores.

    5.0.0upgrade guide

  • The api.legacy namespace is removed; use the listed observations, metrics, and scores API replacements.

    5.0.0upgrade guide

  • This method is gone; create scores with api.scores.create(request=[...]) instead.

    5.0.0release notesupgrade guide

  • This method moves to api.scores.delete(score_id=...).

    5.0.0release notesupgrade guide

  • The scores_v3 namespace no longer exists; use api.scores.get_many with the same arguments and response.

    5.0.0release notesupgrade guide

  • Score creation now takes a list of CreateScoreRequest objects as request=; partial acceptance returns accepted and rejected counts and errors.

    5.0.0upgrade guide

  • This method now behaves like scores_v3.get_many_v3; filter by id= for comma-separated score IDs instead of score_ids=.

    5.0.0release notesupgrade guide

  • The sessions API methods are removed; retrieve observations with api.observations.get_many(session_id=...).

    5.0.0upgrade guide

  • Removed; retrieve trace observations with api.observations.get_many(trace_id=...).

    5.0.0upgrade guide

  • This Langfuse argument is removed; combine should_export_span with the default filter instead.

    5.0.0release notesupgrade guide

  • The GenAI check requires the gen_ai. prefix including its dot, so attributes such as gen_ai_custom no longer count.

    5.0.0release notesupgrade guide

  • The dataset run helper is removed; list experiment items and delete their traces with api.trace.delete_multiple instead.

    5.0.0release notesupgrade guide

  • The dataset run helper is removed; use the experiments API instead.

    5.0.0release notesupgrade guide

  • The dataset run helper is removed; use the experiments API instead.

    5.0.0release notesupgrade guide

  • The LangChain integration requires langchain-core 1 or later; importing it with an older version raises ModuleNotFoundError.

    5.0.0release notesupgrade guide

  • The SDK supports Langfuse Cloud or self-hosted Langfuse v4.59.0 or later; self-hosted v3 and older v4 releases are unsupported.

    5.0.0release notesupgrade guide

  • Use this environment variable to set the release instead of the removed release trace attribute.

    5.0.0upgrade guide

  • Use this environment variable to set the tracing environment instead of the removed environment trace attribute.

    5.0.0upgrade guide

  • Now points to the Metrics v2 endpoint; use the legacy v1 namespace when querying a self-hosted Langfuse v3 server.

    4.0.0, 5.0.0upgrade guideupgrade guide

  • Now points to the Observations v2 endpoint; use the legacy v1 namespace when querying a self-hosted Langfuse v3 server.

    4.0.0, 5.0.0upgrade guideupgrade guide

  • The v2 score resource is now exposed as langfuse.api.scores; the v2 alias was removed.

    4.0.0, 5.0.0upgrade guideupgrade guide

  • Metadata attribute values, including strings, are JSON-encoded; exporters that read or write them should decode with json.loads and encode replacements with json.dumps.

    5.0.0release notesupgrade guide

  • Replaces setting trace publicity through .updateTrace().

    5.0.0upgrade guide

  • Propagated metadata must be a Record<string, string>; the migration checklist also specifies values of at most 200 characters.

    5.0.0upgrade guide

  • The OpenAI integration requires openai 1.0 or later and no longer supports pre-1.0 SDKs.

    5.0.0release notesupgrade guide

  • V4 resume tokens cannot be reused, and resuming with a different filter raises ValueError.

    5.0.0release notesupgrade guide

  • _additional_trace_tags is removed.

    5.0.0release notesupgrade guide

  • Evaluation now reads v2 observations only; fetch_trace_fields becomes fields, filter must be a v2 JSON array, and the mapper receives an observation with raw-string input and output.

    5.0.0upgrade guide

  • Batched evaluation now reads from the v2 observations API and evaluates observations only; scope is removed.

    5.0.0release notesupgrade guide

  • The trace input/output setter is removed; set input and output on the root observation instead.

    5.0.0release notesupgrade guide

  • Replaces setting the trace's public attribute through updateActiveTrace().

    5.0.0upgrade guide

  • OpenTelemetry spans are now filtered by default to Langfuse spans, spans with gen_ai.* attributes, and spans from known LLM instrumentation scopes.

    5.0.0upgrade guide

  • The trace input/output setter is removed; set input and output on the root observation instead.

    5.0.0release notesupgrade guide

  • Set trace input and output on the root observation using span.update(input=..., output=...).

    5.0.0upgrade guide

  • Trace updates are decomposed into attribute propagation, trace I/O setting, and trace-publicity APIs.

    5.0.0upgrade guide

Deprecations 2

  • Deprecated for backward compatibility with trace-level LLM-as-a-judge evaluators.

    5.0.0upgrade guide

  • Deprecated for backward compatibility with trace-level LLM-as-a-judge evaluators; new code should set input/output on the root observation.

    5.0.0upgrade guide

New APIs and options 10

  • Accepts a caller-supplied experiment_id when running an experiment.

    5.0.3release notes

  • Lets custom shouldExportSpan rules compose with the default span-filtering behavior.

    5.0.0upgrade guide

  • Set this environment variable to none if a proxy rejects gzip-compressed span batches.

    5.0.0release notesupgrade guide

  • Provides access to the legacy Metrics v1 API, including for self-hosted Langfuse v3 servers.

    5.0.0upgrade guide

  • Provides access to the legacy Observations v1 API, including for self-hosted Langfuse v3 servers.

    5.0.0upgrade guide

  • Provides access to the legacy Score v1 API.

    5.0.0upgrade guide

  • Dataset versions are recorded on experiment items, including items from local-data runs.

    5.0.0release notesupgrade guide

  • Wraps a callback so the current and child observations created within its scope inherit correlating attributes.

    5.0.0upgrade guide

  • Experiment results now expose an experiment ID that links directly to the experiment comparison view.

    5.0.0release notesupgrade guide

  • Experiment results now expose a URL that links directly to the experiment comparison view.

    5.0.0release notesupgrade guide

Performance 1

  • Tracing skips span attribute limit checks when the span has room, reducing unnecessary checks.

    5.0.2release notes

Behavior and default changes 8

  • Pending scores are sent immediately when flush() is called.

    5.0.3release notes

  • Metadata attribute values, including strings, are JSON-encoded; exporters that read or write them should decode with json.loads and encode replacements with json.dumps.

    5.0.1release notes

  • Scores are sent in batches; partial HTTP 207 rejections and other 4xx responses are logged without retry, while network errors, 429, and 5xx responses are retried with backoff.

    5.0.1release notes

  • Pass a list of CreateScoreRequest objects as request; responses include accepted and rejected counts and errors when some scores are rejected.

    5.0.0release notesupgrade guide

  • The handler now imports only from langchain_core, so the langchain meta-package is no longer needed; its import path and usage are unchanged.

    5.0.0release notesupgrade guide

  • Correlating attributes propagate to every observation instead of living only on the trace, enabling single-table queries without expensive joins.

    4.0.0, 5.0.0upgrade guideupgrade guide

  • Experiments are recorded through OpenTelemetry; sampled-out items and their scores do not reach Langfuse when sample_rate is below 1, while run-level scores are always stored.

    5.0.0release notesupgrade guide

  • Metadata sent with v5 preserves numeric and boolean types, and nested objects can be filtered by dotted path.

    5.0.0release notesupgrade guide

Fixes and other changes 3

  • The mapper receives an observation whose input and output are raw strings.

    5.0.1release notes

  • Set otel_compression to none if a proxy rejects gzip-compressed span batches.

    5.0.0release notesupgrade guide

  • Use the default sample_rate=1.0 client for complete experiments.

    5.0.0upgrade guide

langfuse 453 changes

Breaking changes 27

  • The LangChain handler's update_trace parameter no longer exists; passing it raises a TypeError.

    4.0.0upgrade guide

  • Use the Experiment SDK method to run dataset experiments; it handles propagation of experiment attributes and dataset item linking.

    4.0.0upgrade guide

  • The dataset item run() method was removed; use dataset.run_experiment() to run experiments and handle experiment attribute propagation.

    4.0.0upgrade guide

  • getTraceUrl is now asynchronous and returns a promise, so callers should await it.

    4.0.0upgrade guide

  • The package and LangfuseClient class are now for non-tracing features such as scoring, prompt management, and datasets.

    4.0.0upgrade guide

  • Import the Langchain integration from @langfuse/langchain.

    4.0.0upgrade guide

  • Import the OpenAI integration from @langfuse/openai.

    4.0.0upgrade guide

  • Set this environment variable to provide the release value; the release argument to update_current_trace() was removed.

    4.0.0upgrade guide

  • For Vercel AI SDK integration, replace LangfuseExporter from langfuse-vercel with LangfuseSpanProcessor from @langfuse/otel.

    4.0.0upgrade guide

  • This type is no longer re-exported from langfuse.types; import it from langfuse.model instead.

    4.0.0upgrade guide

  • Provided tool definitions to the LLM are now mapped to metadata.tools rather than input.tools, which matters when evaluating generations.

    4.0.0upgrade guide

  • This type is no longer re-exported from langfuse.types; import it from langfuse.model instead.

    4.0.0upgrade guide

  • This TypedDict was removed from langfuse.types.

    4.0.0upgrade guide

  • The SDK no longer exports all OpenTelemetry spans by default; it exports Langfuse-created spans, spans with gen_ai.* attributes, and spans from known LLM instrumentation scopes.

    4.0.0upgrade guide

  • This type is no longer re-exported from langfuse.types; import it from langfuse.model instead.

    4.0.0upgrade guide

  • Use this context manager to apply correlating attributes to the current observation and all child observations created within its scope.

    4.0.0upgrade guide

  • Propagated metadata must be dict[str, str]; non-string values are coerced to strings, and values over 200 characters are dropped with a warning.

    4.0.0upgrade guide

  • The SDK now requires Pydantic v2; applications still using Pydantic v1 must use the pydantic.v1 compatibility shim.

    4.0.0upgrade guide

  • Use this method to set the current trace's public flag, replacing update_current_trace(public=True).

    4.0.0upgrade guide

  • Use this observation method to set the trace's public flag, replacing span.update_trace(public=True).

    4.0.0upgrade guide

  • Observation-level trace updates are decomposed into propagate_attributes(), set_trace_io(), and set_trace_as_public().

    4.0.0upgrade guide

  • This unified context-managed API replaces separate current-span and current-generation methods; use as_type to specify the observation type.

    4.0.0upgrade guide

  • Use startObservation and related functions from @langfuse/tracing in place of langfuse.trace(), langfuse.span(), and langfuse.generation().

    4.0.0upgrade guideupgrade guide

  • This TypedDict was removed from langfuse.types.

    4.0.0upgrade guide

  • Trace updates are decomposed: use propagate_attributes() for correlating attributes, set_current_trace_io() for legacy trace I/O, and set_current_trace_as_public() for the public flag.

    4.0.0upgrade guide

  • Values are validated as strings with a maximum length of 200 characters; longer values are dropped with a warning.

    4.0.0upgrade guide

  • Pass version as an optional property in the options object to langfuse.prompt.get() instead of as a positional argument.

    4.0.0upgrade guide

Security 1

  • The serializer now masks Pydantic secret values.

    4.15.4release notes

Deprecations 5

  • This option still works but is deprecated; migrate its denylist behavior to a should_export_span callback.

    4.0.0upgrade guide

  • The Langfuse base URL environment variable is now LANGFUSE_BASE_URL; LANGFUSE_BASEURL remains backward compatible in v4 but will not work in future versions.

    4.0.0upgrade guide

  • LANGFUSE_BASEURL still works for backward compatibility in v4, but will not work in future versions.

    4.0.0upgrade guide

  • This method remains for backward compatibility with trace-level LLM-as-a-judge evaluators; new code should set input and output on the root observation.

    4.0.0upgrade guide

  • This observation method is deprecated; set input and output on the root observation directly for new code.

    4.0.0upgrade guide

New APIs and options 11

  • Adds opt-in gzip compression for the default OTLP exporter.

    4.17.0release notes

  • Import this helper from langfuse.span_filter to compose custom span filters with the default export behavior.

    4.0.0upgrade guide

  • The package is for tracing and provides the LangfuseSpanProcessor used with OpenTelemetry.

    4.0.0upgrade guide

  • The package is for tracing, including the replacement tracing functions.

    4.0.0upgrade guide

  • Set the tracing environment via the LANGFUSE_TRACING_ENVIRONMENT environment variable.

    4.0.0upgrade guideupgrade guide

  • Set the tracing release via the LANGFUSE_TRACING_RELEASE environment variable.

    4.0.0upgrade guide

  • Use this namespace for legacy v1 metrics queries, including when a Python SDK v4 client temporarily queries a self-hosted Langfuse v3 server.

    4.0.0upgrade guide

  • Use this namespace for legacy v1 observation queries, including when a Python SDK v4 client temporarily queries a self-hosted Langfuse v3 server.

    4.0.0upgrade guide

  • Use this namespace for legacy v1 score queries.

    4.0.0upgrade guide

  • Register LangfuseSpanProcessor with an OpenTelemetry NodeSDK to set up tracing in the v4 SDK.

    4.0.0upgrade guide

  • Set this Langfuse client option to control which spans are exported, including preserving export-all behavior or composing a custom filter with the default.

    4.0.0upgrade guide

Performance 1

  • Span processing skips span_formatter when debug logging is off, avoiding unnecessary formatting work.

    4.15.1release notes

Behavior and default changes 2

  • Default exporter batches are capped at 64 MiB.

    4.16.0release notes

  • Values are validated as strings with a maximum length of 200 characters; longer values are dropped with a warning.

    4.0.0upgrade guide

Fixes and other changes 6

  • Dataset JSON-schema response fields are typed as objects.

    4.18.0release notes

  • Read-side metadata is typed as optional objects.

    4.18.0release notes

  • Langfuse now captures reasoning_effort in model parameters.

    4.15.6release notes

  • Langfuse now captures verbosity in model parameters.

    4.15.6release notes

  • NaN/Inf values nested in converted containers are now sanitized during serialization.

    4.15.5release notes

  • The API specification was updated from upstream Langfuse changes.

    4.15.1release notesrelease notes