pypi / logfire
logfire
What changed in logfire 4 to 5, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
53 breaking5 security4 deprecations44 new APIs and options3 performance64 behavior and defaults10 tooling95 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initlogfire 5142 changes
Breaking changes 34
Requires pydantic-monty-client>=1.6.0, which sends the first request without waiting for the Configure reply and raises typed connection and configuration errors.
Returns a plain pydantic_monty.AsyncMontyRemote instead of the AgentSandboxPool wrapper, allowing it to be passed to code typed against Monty.
Azure content filter chunks are skipped in OpenAI streams.
Levels above CRITICAL are mapped to fatal.
Structlog critical events are logged at the fatal level.
AWS security tokens are scrubbed by default.
Incoming context is dropped when distributed tracing is disabled.
Project credentials are required before SDK configuration.
SpanLevel compares equal to the string 'warning'.
Telemetry is sent with the API key when no write token is configured.
Dataclass types are logged using their repr instead of their default field values.
The console exporter formats an empty set as set().
The console exporter prints generator attributes using their repr.
OAuth-style access token values are scrubbed by default.
Bearer token values are scrubbed by default.
Formats range attributes in console output.
HMAC key values are scrubbed by default.
OAuth-style ID token values are scrubbed by default.
Automatically instruments Starlette apps when run with logfire run.
Suppresses native FastAPI telemetry.
Passphrase values are scrubbed by default.
Signing key values are scrubbed by default.
Raises an error when SQLAlchemy instrumentation is skipped.
Treats logfire.tags passed through structlog as log tags.
HTTP span messages use stable HTTP semantic convention attributes.
Integers below the int64 minimum are converted to strings when used as span attributes.
The deprecated Flask exclude_urls argument has been removed.
The Logfire token check is skipped inside AWS Lambda.
The deprecated CLI option --logfire-url has been removed.
Third-party Pydantic models are no longer instrumented by default.
The Pydantic integration's OTel instrumentation scope is now logfire.pydantic.
Managed variable pushes are strict by default.
Buffers are kept until every span in the trace has ended.
OpenAI and Anthropic instrumentation now defaults to version 2, changing the format of recorded attributes.
Security 3
Remote strings in log messages are hardened.
OAuth-style refresh token values are scrubbed by default.
Distrusts compromised eMudhra chains.
New APIs and options 9
Agent sandboxes connect over gRPC with pydantic-monty 1.5.0.
configure(fleet=...) manages the SDK from Logfire Fleet.
Adds agent_sandboxes() to Logfire.
Records why a run ended in error.
Adds the pending_spans option.
Adds a compression option, with experimental zstd support.
Console attributes can be shown without enabling verbose output.
Adds instrumentation for Litestar 2.11 and later.
The Gateway CLI now supports the LOGFIRE_BASE_URL environment variable.
Performance 1
Scrubbing is faster for simple types through a fast path.
Behavior and default changes 38
instrument_sqlite3 and instrument_mysql now return the connection.
SpanLevel is hashed by name, and hashing it is discouraged with a warning.
Agent Sandboxes errors now include actionable hints.
The explanation of an Anthropic refusal is recorded as output text.
Content blocks sent back as input messages are converted.
configure() returns a Logfire instance when the SDK is not installed.
logfire run falls back to OpenTelemetry instrumentors.
Legacy function calls in input messages are recorded.
Audio responses and legacy function calls are recorded.
Custom tool calls from the OpenAI Responses API are recorded.
Variable overrides and targeting context are carried into thread pools.
Anthropic document and file-backed image input blocks are converted to semconv parts.
Custom tool calls from OpenAI chat completions are recorded.
Errors raised during LLM stream consumption are recorded.
OpenAI chat spans record max_completion_tokens as the requested maximum token count.
OpenAI cache write tokens are recorded on spans.
All pathlib.Path variants are serialized as plain strings.
Binary attributes are kept out of the secret scrubber.
Records cache token usage.
Records response IDs and finish reasons.
Formats bytearray attributes in console output.
Reads stable database semantic convention attributes when building messages.
Automatically instruments FastAPI apps when run with logfire run.
Automatically instruments Flask apps when run with logfire run.
Treats logfire.tags passed through logging as log tags.
Treats logfire.tags passed through loguru as log tags.
Records response IDs and finish reasons.
Records response IDs and finish reasons for streamed calls.
Records refusals in gen_ai.output.messages.
Records finish reasons for API calls.
Records streamed responses that end as incomplete or failed.
Records refusals as text in gen_ai.output.messages.
Records cached prompt tokens.
Includes the dataset in links when the report has one.
The CLI base URL defaults to the value of
LOGFIRE_BASE_URL.Query client errors expose RFC 9457 problem details.
Anthropic Bedrock calls are priced under the aws provider.
Logs produced with logfire.instrument_pydantic(record='failure') now record input_data.
Tooling 4
Isolates CLI diagnostic logging from application logging.
Excludes the working directory from sys.path while instrumenting packages.
Makes eval setup executable for Python and Node.js.
Recommends Logfire extras when missing instrumentation packages are detected.
Fixes and other changes 53
Formats non-string DataFrame indices in console output.
Logged DataFrames preserve integer precision.
Decoded JSON containers are scrubbed without a regex prefilter.
The JSON schema type for enums no longer depends on the order of the member set.
Preserves exceptions in instrumented async context managers.
Reports failures through handleError instead of raising them.
NumPy scalar attributes are recorded as numbers rather than their repr.
The current trace and span are reset when a generator is closed.
The shim shutdown now returns success.
The console exporter no longer crashes on attributes that format to an empty string.
Dictionary-valued case fields are serialized.
An invalid non-numeric value now identifies the setting in its error.
Duplicate console output from Loguru is avoided.
Empty items in comma-separated include/exclude settings are skipped.
Saving a read token works on Windows, where os.fchmod does not exist.
A span status set by the exception callback is preserved.
Streamed responses remain iterable when recording them fails.
Exceptions are recorded even when their __str__ method raises.
Non-string messages no longer break exporters.
SQL summaries count only top-level CTE names.
The duplicated tool call is removed from message content.
Unbalanced braces are treated as a formatting failure.
Preserves all tool result content parts.
Fixes DataFrame labels being cut off below pandas display limits.
Avoids sending empty schemas when pushing a dataset typed with Any.
Uses exception callback levels when setting span status.
Prevents CLI tracing from replacing the global provider.
Prevents routing errors from escaping span naming.
Handles zero-dimensional NumPy arrays in console formatting.
Records the response model for streamed calls.
Returns the provider response when recording it fails.
Keeps the parent context for spans started while instrumentation is suppressed.
Updates Anthropic instrumentation.
Logging respects
repr=Falseon attrs fields.Non-retryable DiskRetryer responses are no longer treated as success.
Fixes handling of explicit context for Logfire metrics.
Prevents duplicate telemetry from FastAPI instrumentation.
Fixes an issue when Logfire accesses a file without permission.
Updates Google GenAI instrumentation.
Logfire supports OpenTelemetry 1.45.
Fixes retries for OTLP byte POST requests made through Session.request.
Keeps the span message synchronized with its name after
update_name.Logfire's HTTP sessions enable TCP keepalive and recycle idle connections.
Project setup now handles accounts without organizations.
Prevents OpenTelemetry logging from deadlocking during force_flush().
Preserves the selected region or custom base URL throughout setup.
Requires directory boundaries when identifying non-user code paths.
Continues project selection and verification after browser authentication.
Failures from every force_flush pipeline are reported.
Project setup can finish without a TTY.
OpenAI cost is preserved on deduplicated Agents spans.
Supports opentelemetry-instrumentation-google-genai 1.0 and later.
Span exports now handle backend 413 responses.
logfire 4136 changes
Breaking changes 19
Limits HTTP connection attempts to three seconds.
Warns when a token's region is unrecognised instead of silently defaulting to US, including outside configuration.
Removed logfire.variables_clear because it is for tests, not users.
Transient variables-refresh failures are logged as warnings instead of errors.
Marks recommendations in run summaries that are ambiguous.
Disables console logging for the 'Logfire configured' log.
Call
logfire.configure()before using lazy remote variables.Python 3.9 is no longer supported.
Drops support for Python versions below 3.9.2.
export_dataset is merged into get_dataset.
Project URLs are no longer styled as Rich links in output.
The
logfire_pytestfixture scope changed to session.The redundant
logfire.experimental.datasetspackage was deleted.Handled exceptions in FastAPI create issues when the status code is 5xx.
Support OpenTelemetry 1.39.0 and drop support for earlier versions.
Retried exports are limited based on total size rather than the number of exports.
Exceptions are no longer recorded on NonRecordingSpan instances.
Extra FastAPI spans are no longer emitted by default.
Deprecated process runtime metrics are no longer emitted implicitly.
Security 2
The default scrubbing patterns now include
pylf_v\d+_.The cf-connecting-ip header is now stripped in forward_export_request.
Deprecations 4
Calling query_arrow() without providing min_timestamp is deprecated.
Calling query_csv() without providing min_timestamp is deprecated.
The query_json() method is deprecated; use query_json_rows() instead.
Calling query_json_rows() without providing min_timestamp is deprecated.
New APIs and options 35
Adds a non-interactive CLI option.
Adds a JSON output option to the projects list command.
Adds the system.cpu.load_average.1m metric.
Adds the system.process.count metric.
Adds TypedDict types and TypeAdapter validation to the datasets API client.
Adds the resource_attributes option to logfire.configure.
Adds the resource_detectors option to logfire.configure.
Adds support for content parts in the OpenAI Responses API.
Composition and templating are available with native handlebars.
LogfireQueryClient and AsyncLogfireQueryClient support the new /v2/query endpoint with backwards-compatible changes.
Adds a Starlette method for forwarding export requests.
Adds a method for forwarding export requests.
Exposes the reason on ResolvedVariable.
Adds support for capturing parameters in the asyncpg integration.
A configuration log can optionally be emitted after logfire.configure().
The Datasets SDK can upload dataset-level evaluators.
Adds a level parameter to @logfire.instrument().
The Datasets SDK can upload report-level evaluators.
Adds support for TaskSpanData from openai-agents 0.14.
Adds push_dataset helpers to the experimental API client.
Adds an instrumentation function for the Claude Agent SDK.
Adds a method that derives a URL from an evaluation report.
Merges export_dataset into get_dataset, adding the include_cases parameter.
Adds a browser proxy helper for forwarding export requests.
Adds a browser proxy helper.
An experimental datasets package was added.
Managed variables are now available.
Adds a PEP 249 DB API 2.0 interface for using Logfire with database APIs.
Logfire adds a DSPy integration for instrumenting DSPy applications.
Adds request body capture for aiohttp requests.
Adds instrumentation for the Claude SDK.
Adds instrumentation for SurrealDB.
Allows custom Views in MetricOptions.
ProxyLogger emit() now supports kwargs.
Adds the new_trace parameter to logfire.instrument.
Performance 2
Speeds up default scrubbing pattern matching.
Avoids a full response model_dump during usage cost processing.
Behavior and default changes 26
Variable fetching uses ETags and conditional GET, handling 304 responses silently.
logfire.instrument_httpx() now supports httpx2.
Routes managed variables according to API key region.
Pre-populates host.* and os.* resource attributes.
Adds db.query.text to the scrubber's SAFE_KEYS.
Propagates the variable version in baggage alongside the label.
Telemetry is forwarded in a separate thread.
Adds logfire.version to resource attributes.
Adds support for TurnSpanData from openai-agents 0.14.
Various genai attributes are now safe from scrubbing.
Token badges are now shown for OpenAI streaming logs.
Anthropic streaming logs now capture token usage and cost attributes.
Anthropic instrumentation now captures gen_ai.usage.raw.
OpenAI streaming logs now capture token usage and cost attributes.
OpenAI embeddings now capture the operation.cost attribute.
OpenAI Responses spans now include the gen_ai.usage.raw attribute.
Anthropic spans now include the gen_ai.system attribute, enabling token and cost badges.
Anthropic spans include the operation.cost attribute when genai-prices is installed.
Uses additionalProperties for schemas representing homogeneous dictionaries.
Supports traceparent propagation with pytest-xdist.
Adds semantic convention message attributes to LLM integrations.
Project migration now supports multiple tokens.
Handles LangChain reasoning summaries.
Adds OTel Gen AI semantic convention scalar attributes.
Log levels are set based on HTTP status codes in FastAPI.
LLM instrumentations add OTel GenAI semantic convention attributes.
Tooling 6
Allows authentication to complete without a TTY.
Adds a projects status command that can work from a saved read token alone.
Adds a gateway CLI command.
The CLI can use a remote MCP server.
Adds a command to log out of Logfire authentication.
Adds pytest integration for Logfire.
Fixes and other changes 42
Fixes two races in tool-use hook instrumentation.
Bounds INSERT summary length like the SELECT path.
Keeps the data directory gitignored after running the clean command.
Adds a timeout to outbound HTTP session requests.
Parents slow-async-callback spans to the running task.
Fixed a circular reference in the span event body for google-genai.
Fixed three SSE reliability gaps in the remote variable provider.
Fixed the metric resource PID after a fork.
Logfire supports OpenTelemetry SDK 1.44.0.
Prevents ConnectionErrors from being retried twice.
Supports using logfire.instrument as a bare decorator.
Guards against None text in Anthropic TextBlock during streaming.
Handles non-finite floats in JSON encoding.
Avoids truncating rich console arguments.
The token pattern now accepts organization IDs for API keys.
Logfire supports OpenTelemetry SDK 1.42.
Handles errors raised by traceback.format_exception.
Adds support for OTel 1.41.0.
Open spans end earlier during process shutdown to prevent dangling pending spans.
Running the prompt command without --project no longer raises an error.
Updates the integration for SurrealDB 2.x.
Surfaces the X-Logfire-Warning header.
Logfire supports OpenTelemetry SDK 1.40.0, which may affect which SDK version developers can use.
Fixes an OTel warning during tail sampling buffer replay.
Patching of sys.stdout is handled better.
Handles bare MCP request types for fastmcp 3.x compatibility.
Anthropic input token usage now includes cached tokens.
Fixes push_config() so it pushes labels and versions.
Anthropic beta messages are handled.
Handles pickling errors raised in dataclasses.asdict.
Fixes some attributes in spans for langsmith and openai_agents.
Re-attaches OTel span context in pytest async test functions.
Fixes a crash in the google_genai integration when Gemini returns parts=None.
Fixes streaming error handling so it does not mask original errors.
Anthropic response data now includes the tool call ID.
Maintains the original LLM request context when logging the streaming response.
Handles unpicklable configuration in the ProcessPoolExecutor patch.
Fixes a JSON serialization error with instrument_google_genai.
Functions instrumented with logfire.instrument are now cloudpicklable.
Headers from OTEL_EXPORTER_OTLP_HEADERS no longer override the Logfire token.
Fixes instrument_google_genai.
Adds support for OpenTelemetry 1.38.