freshcrate
Skin:/
Home > AI Agents > logfire

logfire

AI observability platform for production LLM and agent systems.

Why this rank:Strong adoptionRecent releaseHealthy release cadence

Description

AI observability platform for production LLM and agent systems.

README

Pydantic Logfire — Know more. Build faster.

CI codecov pypi license versions Join Slack

From the team behind Pydantic Validation, Pydantic Logfire is an observability platform built on the same belief as our open source library — that the most powerful tools can be easy to use.

What sets Logfire apart:

  • Simple and Powerful: Logfire's dashboard is simple relative to the power it provides, ensuring your entire engineering team will actually use it.
  • Python-centric Insights: From rich display of Python objects, to event-loop telemetry, to profiling Python code and database queries, Logfire gives you unparalleled visibility into your Python application's behavior.
  • SQL: Query your data using standard SQL — all the control and (for many) nothing new to learn. Using SQL also means you can query your data with existing BI tools and database querying libraries.
  • OpenTelemetry: Logfire is an opinionated wrapper around OpenTelemetry, allowing you to leverage existing tooling, infrastructure, and instrumentation for many common Python packages, and enabling support for virtually any language. We offer full support for all OpenTelemetry signals (traces, metrics and logs).
  • Pydantic Integration: Understand the data flowing through your Pydantic Validation models and get built-in analytics on validations.

See the documentation for more information.

Feel free to report issues and ask any questions about Logfire in this repository!

This repo contains the Python SDK for logfire and documentation; the server application for recording and displaying data is closed source.

Using Logfire

This is a very brief overview of how to use Logfire, the documentation has much more detail.

Install

pip install logfire

(learn more)

Authenticate

logfire auth

(learn more)

Manual tracing

Here's a simple manual tracing (aka logging) example:

from datetime import date

import logfire

logfire.configure()
logfire.info('Hello, {name}!', name='world')

with logfire.span('Asking the user their {question}', question='age'):
    user_input = input('How old are you [YYYY-mm-dd]? ')
    dob = date.fromisoformat(user_input)
    logfire.debug('{dob=} {age=!r}', dob=dob, age=date.today() - dob)

(learn more)

Integration

Or you can also avoid manual instrumentation and instead integrate with lots of popular packages, here's an example of integrating with FastAPI:

from fastapi import FastAPI
from pydantic import BaseModel

import logfire

app = FastAPI()

logfire.configure()
logfire.instrument_fastapi(app)
# next, instrument your database connector, http library etc. and add the logging handler


class User(BaseModel):
    name: str
    country_code: str


@app.post('/')
async def add_user(user: User):
    # we would store the user here
    return {'message': f'{user.name} added'}

(learn more)

Logfire gives you a view into how your code is running like this:

Logfire screenshot

Contributing

We'd love anyone interested to contribute to the Logfire SDK and documentation, see the contributing guide.

Reporting a Security Vulnerability

See our security policy.

Logfire Open-Source and Closed-Source Boundaries

The Logfire SDKs (we also have them for TypeScript and Rust) are open source, and you can use them to export data to any OTel-compatible backend.

The Logfire platform (the UI and backend) is closed source. You can self-host it by purchasing an enterprise license.

Release History

VersionChangesUrgencyDate
v4.35.0* Add support for new `/v2/query` endoint by @Viicos in [#1897](https://github.com/pydantic/logfire/pull/1897) This introduces changes to the `LogfireQueryClient` (and its `AsyncLogfireQueryClient` async variant), that are backwards compatible. However, a couple deprecations were introduced: * The `query_json()` method was deprecated. Use `query_json_rows()` instead. * Using the `query_json_rows()` / `query_arrow()` / `query_csv()` methods without providing a `min_timestamp` is depHigh6/2/2026
v4.34.0* Add `logfire.forward_export_request` and `forward_export_request_starlette` methods by @alexmojaki in [#1974](https://github.com/pydantic/logfire/pull/1974) * Forward telemetry in a separate thread by @alexmojaki in [#1973](https://github.com/pydantic/logfire/pull/1973) * Drop Python 3.9 support by @alexmojaki in [#1919](https://github.com/pydantic/logfire/pull/1919) * Managed variables: Propagate variable version in baggage alongside label by @dmontagu in [#1927](https://github.com/pydantiHigh5/26/2026
v4.33.0CLI: * feat: gateway cli command by @ddanielcruzz in [#1915](https://github.com/pydantic/logfire/pull/1915) * CLI: Use remote MCP server by @jirikuncar in [#1884](https://github.com/pydantic/logfire/pull/1884) * refactor: reuse AI tool MCP setup in prompt CLI by @ddanielcruzz in [#1921](https://github.com/pydantic/logfire/pull/1921) * Avoid raising error on `prompt` command without `--project` by @Kludex in [#1912](https://github.com/pydantic/logfire/pull/1912) Integrations: * SupporHigh5/13/2026
v4.32.1* Support OpenTelemetry SDK 1.40.0 by @alexmojaki in [#1861](https://github.com/pydantic/logfire/pull/1861) * Do row→column transformation client-side in query client by @adriangb in [#1862](https://github.com/pydantic/logfire/pull/1862) * Mark various genai attributes as safe from scrubbing by @alexmojaki in [#1863](https://github.com/pydantic/logfire/pull/1863) High4/15/2026
v4.32.0* Add `push_dataset` helpers to the experimental API client by @dmontagu in [#1848](https://github.com/pydantic/logfire/pull/1848) High4/10/2026
v4.31.2* fix: Show token badges for OpenAI streaming logs by @alexmojaki in [#1857](https://github.com/pydantic/logfire/pull/1857) * fix: OTel warning during tail sampling buffer replay by @cyberksh in [#1632](https://github.com/pydantic/logfire/pull/1632) Medium4/10/2026
v4.31.1* Capture token usage and cost attributes in OpenAI streaming logs by @alexmojaki in [#1846](https://github.com/pydantic/logfire/pull/1846) * Capture token usage and cost attributes in Anthropic streaming logs by @alexmojaki in [#1850](https://github.com/pydantic/logfire/pull/1850) * Capture `operation.cost` for OpenAI embeddings by @alexmojaki in [#1843](https://github.com/pydantic/logfire/pull/1843) * Capture `gen_ai.usage.raw` for Anthropic by @alexmojaki in [#1847](https://github.com/pydaMedium4/9/2026
v4.31.0* Add `logfire.instrument_claude_agent_sdk()` by @alexmojaki in [#1799](https://github.com/pydantic/logfire/pull/1799) * feat: add `logfire.url_from_eval(report)` method by @Kludex in [#1694](https://github.com/pydantic/logfire/pull/1694) * fix: include cached tokens in `gen_ai.usage.input_tokens` for Anthropic by @alexmojaki in [#1812](https://github.com/pydantic/logfire/pull/1812) * fix: handle bare MCP request types for fastmcp 3.x compatibility by @alexmojaki in [#1813](https://github.comMedium3/27/2026
v4.30.0* Add `logfire auth logout` command by @ai-man-codes in [#1781](https://github.com/pydantic/logfire/pull/1781) * Remove Rich link styling from project URL output by @ameenalkhaldi in [#1784](https://github.com/pydantic/logfire/pull/1784) * Fix push_config() to push labels and versions by @dmontagu in [#1785](https://github.com/pydantic/logfire/pull/1785) * Merge `export_dataset` into `get_dataset` with `include_cases` parameter by @Kludex in [#1792](https://github.com/pydantic/logfire/pull/17Medium3/23/2026
v4.29.0* Add `gen_ai.usage.raw` attribute to OpenAI Responses spans by @alexmojaki in [#1777](https://github.com/pydantic/logfire/pull/1777) Low3/13/2026
v4.28.0* Handle anthropic beta messages and refactor by @alexmojaki in [#1774](https://github.com/pydantic/logfire/pull/1774) * Delete redundant `logfire.experimental.datasets` package by @alexmojaki in [#1763](https://github.com/pydantic/logfire/pull/1763) * Change `logfire_pytest` fixture scope to session by @jirikuncar in [#1758](https://github.com/pydantic/logfire/pull/1758) Low3/11/2026
v4.27.0* Add `gen_ai.system` attribute to anthropic spans, enabling token/cost badges by @alexmojaki in [#1760](https://github.com/pydantic/logfire/pull/1760) * Set `operation.cost` attribute on anthropic spans when `genai-prices` is installed by @alexmojaki in [#1761](https://github.com/pydantic/logfire/pull/1761) Low3/6/2026
v4.26.0* feat: add browser proxy helpers: `forward_export_request` and `logfire_proxy` by @AlanPonnachan in [#1697](https://github.com/pydantic/logfire/pull/1697) * Handle pickling errors in `dataclasses.asdict` by @alexmojaki in [#1756](https://github.com/pydantic/logfire/pull/1756) * Use additionalProperties for homogeneous dict schemas by @adriangb in [#1738](https://github.com/pydantic/logfire/pull/1738) Low3/6/2026
v4.25.0* Add experimental datasets package by @dmontagu in [#1711](https://github.com/pydantic/logfire/pull/1711) * Extract langsmith provider name by @alexmojaki in [#1720](https://github.com/pydantic/logfire/pull/1720) Low2/19/2026
v4.24.0* Add managed variables by @dmontagu in [#1691](https://github.com/pydantic/logfire/pull/1691) Low2/13/2026
v4.23.0* feat: Add `logfire.db_api` — PEP 249 DB API 2.0 interface by @dmontagu in [#1692](https://github.com/pydantic/logfire/pull/1692) * Add semantic convention message attributes to LLM integrations by @dmontagu in [#1705](https://github.com/pydantic/logfire/pull/1705) * Fix some attributes in langsmith and openai_agents spans @alexmojaki in [#1696](https://github.com/pydantic/logfire/pull/1696) * feat: support for pytest-xdist traceparent propagation by @jirikuncar in [#1701](https://github.comLow2/12/2026
v4.22.0* feat: Add multi-token support for project migration by @adriangb in [#1672](https://github.com/pydantic/logfire/pull/1672) * Fix google_genai integration crash when Gemini returns parts=None by @alexmojaki in [#1678](https://github.com/pydantic/logfire/pull/1678) Low2/4/2026
v4.21.0* feat: Add OTel Gen AI semantic convention scalar attributes by @brightsparc in [#1657](https://github.com/pydantic/logfire/pull/1657) * Handle langchain reasoning summaries by @alexmojaki in [#1665](https://github.com/pydantic/logfire/pull/1665) * Fix Responses API streaming error handling to not mask original errors by @jordanhboxer in [#1668](https://github.com/pydantic/logfire/pull/1668) * Only patch `os.exit` once by @alexmojaki in [#1663](https://github.com/pydantic/logfire/pull/1663) Low1/28/2026
v4.20.0* feat: pytest integration by @jirikuncar in [#1648](https://github.com/pydantic/logfire/pull/1648) * fix: anthropic response data should include tool call id by @mathislucka in [#1636](https://github.com/pydantic/logfire/pull/1636) Low1/26/2026
v4.19.0* Add DSPy integration to logfire by @bdsaglam in [#1625](https://github.com/pydantic/logfire/pull/1625) * Set log level based on HTTP status code, create issues for handled exceptions in FastAPI when the status code is 5xx by @alexmojaki in [#1628](https://github.com/pydantic/logfire/pull/1628) * Add OTel GenAI semantic convention attributes to LLM instrumentations by @jimilp7 in [#1619](https://github.com/pydantic/logfire/pull/1619) * Minor optimization: move tweaking of ASGI send/receive sLow1/16/2026
v4.18.0* Adds `aiohttp` request body capture. by @adtyavrdhn in [#1595](https://github.com/pydantic/logfire/pull/1595) * Claude SDK instrumentation by @alexmojaki in [#1618](https://github.com/pydantic/logfire/pull/1618) Low1/12/2026
v4.17.0* `logfire.instrument_surrealdb` by @alexmojaki in [#1573](https://github.com/pydantic/logfire/pull/1573) * feat(config): allow custom Views in MetricOptions by @cyberksh in [#1552](https://github.com/pydantic/logfire/pull/1552) * Handle unpicklable configuration in `ProcessPoolExecutor` patch #1556 by @pipinstalled in [#1567](https://github.com/pydantic/logfire/pull/1567) * Maintain original LLM request context when logging the streaming response by @yiphei in [#1566](https://github.com/pydaLow1/7/2026
v4.16.0* Support OpenTelemetry 1.39.0, drop support for earlier versions, stop using the OTel events API/SDK by @alexmojaki in [#1562](https://github.com/pydantic/logfire/pull/1562) * Add `new_trace` parameter to `logfire.instrument` by @njz-cvm in [#1499](https://github.com/pydantic/logfire/pull/1499) * Fix JSON serialization error with `instrument_google_genai` by @alexmojaki in [#1551](https://github.com/pydantic/logfire/pull/1551) * Support kwargs in `ProxyLogger` `emit()` by @qianl15 in [#1561]Low12/4/2025
v4.15.1* Make `logfire.instrument`ed functions cloudpicklable by @alexmojaki in [#1542](https://github.com/pydantic/logfire/pull/1542) Low11/20/2025
v4.15.0* Limit retried exports based on total size, not number by @alexmojaki in [#1527](https://github.com/pydantic/logfire/pull/1527) * More tweaks to retrying exports by @alexmojaki in [#1531](https://github.com/pydantic/logfire/pull/1531) Low11/19/2025
v4.14.2* Ensure `OTEL_EXPORTER_OTLP_HEADERS` doesn't override logfire token by @alexmojaki in [#1500](https://github.com/pydantic/logfire/pull/1500) Low10/24/2025
v4.14.1* Skip recording exceptions on `NonRecordingSpan` by @alexmojaki in [#1497](https://github.com/pydantic/logfire/pull/1497) Low10/22/2025
v4.14.0* Support OpenTelemetry 1.38, fix `instrument_google_genai` and `instrument_langchain` by @alexmojaki in [#1495](https://github.com/pydantic/logfire/pull/1495) Low10/21/2025
v4.13.2* Comply with opencode MCP format by @Kludex in [#1488](https://github.com/pydantic/logfire/pull/1488) Low10/13/2025
v4.13.1* Add "type" keyword on opencode MCP settings by @Kludex in [#1486](https://github.com/pydantic/logfire/pull/1486) Low10/13/2025
v4.13.0* Store OpenAI Responses streaming response in events format understood by UI by @alexmojaki in [#1479](https://github.com/pydantic/logfire/pull/1479) * Add `output` option to `logfire.ConsoleOptions`, e.g. to log to stderr instead of stdout by @stevenh in [#1477](https://github.com/pydantic/logfire/pull/1477) * Update `logfire.instrument_pydantic_ai()` parameters by @alexmojaki in [#1480](https://github.com/pydantic/logfire/pull/1480) Low10/9/2025
v4.12.0* Record response when streaming OpenAI Responses API by @stevenh in [#1457](https://github.com/pydantic/logfire/pull/1457) * Record `operation.cost` span attribute on OpenAI spans by @alexmojaki in [#1468](https://github.com/pydantic/logfire/pull/1468) Low10/8/2025
v4.11.0* Add experimental `exception_callback` configuration by @alexmojaki in [#1355](https://github.com/pydantic/logfire/pull/1355) * Support Instrumenting Async SqlAlchemy Engines by @dhruv-ahuja in [#1425](https://github.com/pydantic/logfire/pull/1425) * Always collect `operation.cost` metric in spans by @alexmojaki in [#1435](https://github.com/pydantic/logfire/pull/1435) * Update `pyproject.toml` to be PEP639 compliant by @Kludex in [#1429](https://github.com/pydantic/logfire/pull/1429) * ImpLow10/3/2025
v4.10.0* Trigger `auth` command from `prompt` by @Kludex in [#1423](https://github.com/pydantic/logfire/pull/1423) * Remove conditional check on OTEL version for `Gauge` import by @Viicos in [#1426](https://github.com/pydantic/logfire/pull/1426) Low9/24/2025
v4.9.0* Fix Root Model Not Rendering As Expected by @dhruv-ahuja in [#1396](https://github.com/pydantic/logfire/pull/1396) * Use `=` instead of `:` in codex setup by @Kludex in [#1420](https://github.com/pydantic/logfire/pull/1420) * Add support for OpenCode on the `prompt` command by @Kludex in [#1421](https://github.com/pydantic/logfire/pull/1421) Low9/23/2025
v4.8.0* Allow capturing headers and response body with `logfire.instrument_aiohttp_client()` by @adtyavrdhn in [#1405](https://github.com/pydantic/logfire/pull/1405) and [#1409](https://github.com/pydantic/logfire/pull/1409) Low9/18/2025
v4.7.0* Update to OpenTelemetry SDK 1.37.0, drop support for <1.35.0 by @alexmojaki in [#1398](https://github.com/pydantic/logfire/pull/1398) Low9/12/2025
v4.6.0* Fix: check `LOGFIRE_IGNORE_NO_CONFIG` from environment when needed by @Lftobs in [#1379](https://github.com/pydantic/logfire/pull/1379) * Expand scrubbing whitelist, especially for `gen_ai` messages by @alexmojaki in [#1392](https://github.com/pydantic/logfire/pull/1392) * Print project link eagerly from credentials file if possible by @alexmojaki in [#1393](https://github.com/pydantic/logfire/pull/1393) * Fix: Only list orgs in CLI where projects can be created by @alexmojaki in [#1391](htLow9/10/2025
v4.5.0* Export `attach_context` and `get_context` directly from `logfire` module, not just `logfire.propagate` by @dhruv-ahuja in [#1385](https://github.com/pydantic/logfire/pull/1385) * Only list writeable projects from CLI by @alexmojaki in [#1386](https://github.com/pydantic/logfire/pull/1386) * Add `ensure_ascii=False` to `json.dumps` calls by @qiangxinglin in [#1381](https://github.com/pydantic/logfire/pull/1381) * Remove unused `stack_offset` from `with_settings()` by @LucasSantos27 in [#1380Low9/9/2025
v4.4.0* Add `logfire.instrument_print()` by @alexmojaki in [#1368](https://github.com/pydantic/logfire/pull/1368) * Record response on 'MCP server handle request' span by @alexmojaki in [#1362](https://github.com/pydantic/logfire/pull/1362) * Handle MCP request metadata being a dict by @alexmojaki in [#1360](https://github.com/pydantic/logfire/pull/1360) * fix: handle optional args in `logfire.instrument` by @stevenh in [#1337](https://github.com/pydantic/logfire/pull/1337) * Add `logfire_token` tLow9/5/2025
v4.3.6* Add specific code agent options for `logfire prompt` by @Kludex in [#1350](https://github.com/pydantic/logfire/pull/1350) Low8/26/2025
v4.3.5* Add `--base-url` to CLI by @Kludex in [#1345](https://github.com/pydantic/logfire/pull/1345) * Don't require stream kwarg in OpenAI methods by @alexmojaki in [#1348](https://github.com/pydantic/logfire/pull/1348) Low8/22/2025
v4.3.4* `logfire.instrument_google_genai()` fixes for `response_schema` and elided content by @alexmojaki in [#1342](https://github.com/pydantic/logfire/pull/1342) * Fix `enable_commenter` and `commenter_options` args of `instrument_sqlalchemy` by @alexmojaki in [#1335](https://github.com/pydantic/logfire/pull/1335) * Fix LangChain instrumentation by @alexmojaki in [#1319](https://github.com/pydantic/logfire/pull/1319) * Suppress `urllib3` logs while checking token by @alexmojaki in [#1341](https:/Low8/21/2025
v4.3.3* Ensure `logfire_api.LogfireSpan.context` and other attrs are None by @alexmojaki in [#1317](https://github.com/pydantic/logfire/pull/1317) Low8/13/2025
v4.3.2* Able to see output from token selection by @Kludex in [#1312](https://github.com/pydantic/logfire/pull/1312) * Remove trailing `/` from prompts call by @Kludex in [#1314](https://github.com/pydantic/logfire/pull/1314) * Change get read token info endpoint by @hramezani in [#1309](https://github.com/pydantic/logfire/pull/1309) Low8/13/2025
v4.3.1* Fix `logfire_api` requiring OpenTelemetry SDK by @alexmojaki in [#1310](https://github.com/pydantic/logfire/pull/1310) Low8/12/2025
v4.3.0* Closes logfire_api.LogfireSpan should support ReadableSpan attributes #989 by @RichardMarto in [#1288](https://github.com/pydantic/logfire/pull/1288) * Create read tokens via CLI by @Kludex in [#1306](https://github.com/pydantic/logfire/pull/1306) * Retrieve the prompt to fix issues via CLI by @Kludex in [#1307](https://github.com/pydantic/logfire/pull/1307) Low8/12/2025
v4.2.0* Handle wrong JSON schema in console exporter by @alexmojaki in [#1294](https://github.com/pydantic/logfire/pull/1294) * Move creation of span down on cli by @Kludex in [#1298](https://github.com/pydantic/logfire/pull/1298) * Allow to set `instrument_httpx(capture_all=True)` via env var by @Kludex in [#1295](https://github.com/pydantic/logfire/pull/1295) Low8/6/2025
v4.1.0* Add `min_level` argument to `logfire.configure` by @alexmojaki in [#1265](https://github.com/pydantic/logfire/pull/1265) Low8/4/2025
v4.0.1* Handle cyclic references in exceptions by @alexmojaki in [#1284](https://github.com/pydantic/logfire/pull/1284) * Support OpenTelemetry 1.36.0 by @alexmojaki in [#1285](https://github.com/pydantic/logfire/pull/1285) Low7/31/2025
v4.0.0**BREAKING CHANGES**: * Remove extra FastAPI spans by default by @alexmojaki in [#1268](https://github.com/pydantic/logfire/pull/1268) * Stop implicitly emitting deprecated process runtime metrics by @alexmojaki in [#932](https://github.com/pydantic/logfire/pull/932) Low7/22/2025
v3.25.0* Use local timezone in console logging by @fswair in [#1255](https://github.com/pydantic/logfire/pull/1255) * Add `logfire run` command by @Kludex in [#1139](https://github.com/pydantic/logfire/pull/1139) * Allow removing extra FastAPI spans by @alexmojaki in [#1258](https://github.com/pydantic/logfire/pull/1258) * Fix `litellm` instrumentation by @alexmojaki in [#1249](https://github.com/pydantic/logfire/pull/1249) * Add `logfire.exception.fingerprint` attribute to spans with exceptions byLow7/18/2025
v3.24.2* Fix auto-tracing Python 3.12 ParamSpec syntax by @alexmojaki in [#1247](https://github.com/pydantic/logfire/pull/1247) Low7/14/2025

Dependencies & License Audit

Loading dependencies...

Similar Packages

SurfSenseAn open source, privacy focused alternative to NotebookLM for teams with no data limit's. Join our Discord: https://discord.gg/ejRNvftDp9v0.0.26
claude-ruby-grape-railsClaude Code plugin for Ruby, Rails, Grape, PostgreSQL, Redis, and Sidekiq developmentv1.16.13
taijiAI-powered self-learning OS with I Ching philosophy | 融合易经哲学的自学型 AI 操作系统v0.2.0
tracerootTraceRoot - open-source observability and self-healing layer for AI agents. YC S25v0.2.0
git-notes-memory🧠 Store and search your notes effectively with Git-native memory storage, enhancing productivity for Claude Code users.main@2026-06-06

More from pydantic

pydantic-aiAI Agent Framework, the Pydantic way

More in AI Agents

hermes-agentThe agent that grows with you
awesome-copilotCommunity-contributed instructions, agents, skills, and configurations to help you make the most of GitHub Copilot.
CopilotKitThe Frontend Stack for Agents & Generative UI. React + Angular. Makers of the AG-UI Protocol
e2bE2B SDK that give agents cloud environments