pypi / langfuse
langfuse
What changed in langfuse 3 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
56 breaking1 security3 deprecations43 new APIs and options2 performance17 behavior and defaults1 tooling101 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initlangfuse 567 changes
Breaking changes 33
The skills API moves to a stable namespace.
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.
The SDK requires Python 3.11 or later; installing it on Python 3.10 installs the latest v4 instead.
fetch_trace_fields is renamed to fields, which defaults to core,basic,io,metadata.
The filter must now be a v2 filter JSON array.
The ingestion batch method is removed; use SDK tracing through OpenTelemetry for traces and api.scores.create for scores.
The api.legacy namespace is removed; use the listed observations, metrics, and scores API replacements.
This method is gone; create scores with api.scores.create(request=[...]) instead.
This method moves to api.scores.delete(score_id=...).
The scores_v3 namespace no longer exists; use api.scores.get_many with the same arguments and response.
Score creation now takes a list of CreateScoreRequest objects as request=; partial acceptance returns accepted and rejected counts and errors.
This method now behaves like scores_v3.get_many_v3; filter by id= for comma-separated score IDs instead of score_ids=.
The sessions API methods are removed; retrieve observations with api.observations.get_many(session_id=...).
Removed; retrieve trace observations with api.observations.get_many(trace_id=...).
This Langfuse argument is removed; combine should_export_span with the default filter instead.
The GenAI check requires the gen_ai. prefix including its dot, so attributes such as gen_ai_custom no longer count.
The dataset run helper is removed; list experiment items and delete their traces with api.trace.delete_multiple instead.
The dataset run helper is removed; use the experiments API instead.
The dataset run helper is removed; use the experiments API instead.
The LangChain integration requires langchain-core 1 or later; importing it with an older version raises ModuleNotFoundError.
The SDK supports Langfuse Cloud or self-hosted Langfuse v4.59.0 or later; self-hosted v3 and older v4 releases are unsupported.
Now points to the Metrics v2 endpoint; use the legacy v1 namespace when querying a self-hosted Langfuse v3 server.
Now points to the Observations v2 endpoint; use the legacy v1 namespace when querying a self-hosted Langfuse v3 server.
The v2 score resource is now exposed as
langfuse.api.scores; the v2 alias was removed.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.
The OpenAI integration requires openai 1.0 or later and no longer supports pre-1.0 SDKs.
V4 resume tokens cannot be reused, and resuming with a different filter raises ValueError.
_additional_trace_tags is removed.
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.
Batched evaluation now reads from the v2 observations API and evaluates observations only; scope is removed.
The trace input/output setter is removed; set input and output on the root observation instead.
The trace input/output setter is removed; set input and output on the root observation instead.
Set trace input and output on the root observation using span.update(input=..., output=...).
New APIs and options 9
Adds a helper for iterating observation pages in observations v2.
The API adds score metadata and provenance blob export field groups.
Skills gain discovery and availability tracing.
Accepts a caller-supplied experiment_id when running an experiment.
Set this environment variable to none if a proxy rejects gzip-compressed span batches.
Dataset versions are recorded on experiment items, including items from local-data runs.
Nested objects can be filtered by dotted path. Metadata values remain strings, so numeric and boolean comparisons are not supported yet.
Experiment results now expose an experiment ID that links directly to the experiment comparison view.
Experiment results now expose a URL that links directly to the experiment comparison view.
Performance 1
Tracing skips span attribute limit checks when the span has room, reducing unnecessary checks.
Behavior and default changes 8
Pending scores are sent immediately when flush() is called.
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.
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.
Pass a list of CreateScoreRequest objects as request; responses include accepted and rejected counts and errors when some scores are rejected.
The handler now imports only from langchain_core, so the langchain meta-package is no longer needed; its import path and usage are unchanged.
Correlating attributes propagate to every observation instead of living only on the trace, enabling single-table queries without expensive joins.
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.
Metadata sent with v5 preserves numeric and boolean types, and nested objects can be filtered by dotted path.
Fixes and other changes 16
The API specification was updated from langfuse/langfuse; the notes do not specify which API details changed.
Observation page fetches use a 60 s timeout.
Batch evaluation keeps paging past empty observation pages.
OpenAI provider responses now preserve audio data.
Langfuse prompts are deregistered when a chain run errors.
Message names are retained in generation input.
Explicit parents are preserved for child events.
Root trace attributes are propagated to child runs under ainvoke.
No skills are returned when the skills directory cannot be read.
flush() no longer hangs after repeated shutdown() calls.
flush() works under gevent.
shutdown() works under gevent.
The streaming run memo is cleaned up on error.
The mapper receives an observation whose input and output are raw strings.
Set otel_compression to none if a proxy rejects gzip-compressed span batches.
Use the default sample_rate=1.0 client for complete experiments.
langfuse 4105 changes
Breaking changes 19
The environment template now uses LANGFUSE_BASE_URL.
The LangChain handler's
update_traceparameter no longer exists; passing it raises aTypeError.Use the Experiment SDK method to run dataset experiments; it handles propagation of experiment attributes and dataset item linking.
The dataset item
run()method was removed; usedataset.run_experiment()to run experiments and handle experiment attribute propagation.Set this environment variable to provide the release value; the
releaseargument toupdate_current_trace()was removed.This type is no longer re-exported from
langfuse.types; import it fromlangfuse.modelinstead.This TypedDict was removed from
langfuse.types.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.Use this context manager to apply correlating attributes to the current observation and all child observations created within its scope.
Propagated metadata must be
dict[str, str]; non-string values are coerced to strings, and values over 200 characters are dropped with a warning.The SDK now requires Pydantic v2; applications still using Pydantic v1 must use the
pydantic.v1compatibility shim.Use this method to set the current trace's public flag, replacing
update_current_trace(public=True).Use this observation method to set the trace's public flag, replacing
span.update_trace(public=True).Observation-level trace updates are decomposed into
propagate_attributes(),set_trace_io(), andset_trace_as_public().This unified context-managed API replaces separate current-span and current-generation methods; use
as_typeto specify the observation type.Use startObservation and related functions from @langfuse/tracing in place of langfuse.trace(), langfuse.span(), and langfuse.generation().
This TypedDict was removed from
langfuse.types.Trace updates are decomposed: use
propagate_attributes()for correlating attributes,set_current_trace_io()for legacy trace I/O, andset_current_trace_as_public()for the public flag.Values are validated as strings with a maximum length of 200 characters; longer values are dropped with a warning.
Security 1
The serializer now masks Pydantic secret values.
Deprecations 3
This option still works but is deprecated; migrate its denylist behavior to a
should_export_spancallback.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.
This observation method is deprecated; set input and output on the root observation directly for new code.
New APIs and options 16
Adds opt-in gzip compression for the default OTLP exporter.
The OpenAI integration captures service_tier in model_parameters.
Supports prompt linking via propagate_attributes.
Tracing now allows custom OpenTelemetry ID generators.
Dataset items can now be multimodal.
Score data now supports the CORRECTION data type.
OTEL spans can be masked at the export stage.
Tracing adds media detection.
Adds RunnerContext for the experiment GitHub Action.
The client adds support for custom span exporters.
Import this helper from
langfuse.span_filterto compose custom span filters with the default export behavior.Set the tracing environment via the LANGFUSE_TRACING_ENVIRONMENT environment variable.
Use this namespace for legacy v1 metrics queries, including when a Python SDK v4 client temporarily queries a self-hosted Langfuse v3 server.
Use this namespace for legacy v1 observation queries, including when a Python SDK v4 client temporarily queries a self-hosted Langfuse v3 server.
Use this namespace for legacy v1 score queries.
Set this Langfuse client option to control which spans are exported, including preserving export-all behavior or composing a custom filter with the default.
Performance 1
Span processing skips span_formatter when debug logging is off, avoiding unnecessary formatting work.
Behavior and default changes 7
Default exporter batches are capped at 64 MiB.
Tool definitions are normalized to OpenAI function format.
Tracing now propagates environment attributes.
Span processing now marks app root spans, making them identifiable in trace data.
Span processing recognizes expanded LLM scopes.
LangChain root observations are now marked in metadata.
Values are validated as strings with a maximum length of 200 characters; longer values are dropped with a warning.
Tooling 1
Adds RegressionError for the experiment GitHub Action.
Fixes and other changes 57
Dataset JSON-schema response fields are typed as objects.
Read-side metadata is typed as optional objects.
Langfuse now captures reasoning_effort in model parameters.
Langfuse now captures verbosity in model parameters.
NaN/Inf values nested in converted containers are now sanitized during serialization.
The API specification was updated from upstream Langfuse changes.
The API specification was updated; the notes do not specify which API details changed.
Fixed a memory leak in OTEL traces.
The API specification was updated from two Langfuse revisions; the notes do not describe the specific changes.
Serialization now handles NaN and Inf floats nested in Pydantic models.
Media data URIs now support URL-safe Base64.
OpenAI Omit sentinels are treated like NotGiven when logging.
Masking batches now keep the last duplicate span.
The legacy score create alias is preserved for compatibility.
Run metadata precedence is preserved.
A zero sample rate is preserved.
Span ending is deferred when cancellation occurs and the generator is never resumed.
LiteLLM raw spans are excluded from application roots.
Task and evaluator latency are separated in experiments.
LangChain integration handles a nested dict for Anthropic cache_creation in usage.
Handles null choices in chat completion responses.
Raw API responses are now parsed, and a flag was added to skip tracing them.
Model names are now extracted for ChatHuggingFace.
Consumer threads are reinitialized after os.fork().
Structured tool inputs are no longer duplicated in metadata.
The API spec was updated from the Langfuse repository.
Handled LangChain tool errors are now marked as errors.
LangChain now prefers structured tool inputs.
Preserves Responses tools and streamed tool calls in the OpenAI integration.
The API spec was updated from langfuse/langfuse; the notes do not specify the individual API changes.
Correctly serializes float('-inf') as "-Infinity".
Preserves the current observation type when a span is updated.
Handles prompt_tokens_details when it is a dict in _parse_usage_model.
Coerces propagated metadata values.
Supports wrapt 2.x.
A depth limit prevents EventSerializer from hanging on complex objects.
Handles Azure stream chunks that lack delta fields.
Propagated metadata is now flattened in experiments.
LangGraph control flow traces are preserved.
The native v1 stream contract is preserved for OpenAI.
Streaming context is preserved when output capture is disabled.
The API specification was updated; the notes do not specify which API details changed.
The LangChain integration now propagates trace name metadata.
The API spec was updated from langfuse/langfuse; the notes do not specify which API details changed.
Fixed unstable local experiment IDs for local data.
The LangChain propagation context now exits gracefully.
Handles asyncio.CancelledError in exception blocks.
Maintains propagated context in async experiments.
Corrects token details field names for Response API usage.
Includes responses instructions in the captured prompt.
Correctly parses the session ID for scores.
Stricter early routing for base64 media prevents SSE data truncation.
CallbackHandler now handles invalid tool calls.
Escaped newlines are replaced with actual newlines in format output.
Priority-tier keys are skipped when subtracting token detail counts.
Media requests reuse the httpx client.
Failed media uploads are retried.
langfuse 352 changes
Breaking changes 4
Running experiments requires Langfuse v3.151.0 as of this release.
The client moved to LANGFUSE_BASE_URL for configuring the base URL.
Support for Python 3.9 was dropped because it reached end of life.
On Langfuse Cloud, this endpoint stops accepting everything except scores on November 16, 2026; custom integrations need to migrate.
New APIs and options 18
Langfuse v3 supports text scores.
The LangChain root metadata flag is backported to v3-stable.
Batch evaluation rolls scores up to the trace.
Batch evaluation adds trace tags, allowing developers to tag traces during evaluation.
Supports running versioned experiments.
Batch evaluation accepts a fields parameter for more efficient trace fetching.
Adds a metadata parameter to score_current_span.
Adds a metadata parameter to score_current_trace.
The Langfuse client gains methods to fetch and delete dataset runs.
Span client score methods accept a score metadata argument.
Trace names can now be propagated through the client.
Score creation accepts an optional timestamp parameter.
Added a comment field to Langfuse Evaluation using autoevals metadata.
LangchainCallbackHandler now allows injecting trace_context.
Adds schema arguments to create_dataset.
Adds run_batched_evaluation for running batched evaluations.
Support for LangChain v1 was added.
A new OTEL-based Langfuse Python SDK is available.
Behavior and default changes 2
Trace attributes are propagated onto all child spans when updated.
Langfuse observe now handles starlette.StreamingResponse.
Fixes and other changes 28
Experiment run item requests omit the dataset version when it is None.
Parses finish_reason from chat completion streams.
The API specification was updated, which may affect the API definitions available to developers.
Usage details are now parsed from response API response chunks.
The API specification was updated; the notes do not specify which API details changed.
Passes the trace ID when creating a score with scope set to observations.
Trace URL generation is skipped when tracing is disabled.
Evaluations are moved to the root experiment span.
get_client reuses the httpx client.
Prompt linking now works with LangChain v1 create_agent.
The client now flushes on shutdown.
A provided custom tracer provider is now flushed.
OpenAI handling now supports non-integer parsed_n values.
Defines tracer_provider when tracing_enabled=False.
Corrected Gemini input token calculation when an implicit cache is hit using LangChain.
Reinitialization now reuses a passed tracer provider.
Metadata can be supplied as a Pydantic BaseModel.
The prompt cache is evicted when a NotFound error occurs.
Dataset names are now URL-encoded, so names containing URL-sensitive characters can be handled correctly.
The API spec was updated, which may affect the API surface available to developers.
Evaluations are moved out of the root span.
Handles update_current_trace gracefully on non-recorded spans.
The API spec was updated from the langfuse/langfuse repository; the notes do not specify which API details changed.
The API spec was updated from the langfuse/langfuse repository; the notes do not specify which API details changed.
Avoids an empty status message when the observe decorator captures an exception.
The API spec was updated in three changes, which may affect the client API available to developers.
HTTP headers are concatenated by dashes instead of snakecase.
The API specification was updated, which may affect developers relying on the Langfuse API.