Observe
AI observability that traces below the model call
Trace every LLM call, tool invocation, and database query in one place, from local dev to production. Free for 10 million records a month.
Follow a request from API to code
Why observability
AI apps break quietly
Two failures can look identical to a user waiting on an answer. One agent stalls on a failed GitHub API request, another spends its whole runtime in a slow SELECT. The model call alone cannot explain either one.
Instrument the agent framework, HTTP client, and database driver, and Pydantic Logfire records the request, model, tool, external API, and database work as one trace. Degraded dependency is visible instead of inferred from timestamps across separate tools.
How it works
The trace is the shape of your code
-
Instrument
One line per library
logfire.instrument_openai() -
Nest
Each call opens a span inside the call that made it
-
Follow
One trace ID crosses services, queues and background tasks
-
Extend
Anything already speaking OpenTelemetry joins the same trace
What you get
Every run, end to end
-
Full-stack context
37 integrations: web frameworks, eight databases, HTTP clients, task queues, hosts, Kubernetes and Docker.
-
Dashboards and alerts
Prebuilt dashboards for cost, latency, and exceptions. Alert from a template for exceptions, 5xx, slow queries, or LLM errors, or customize with your own SQL.
-
Tokens and cost per model
Query tokens and cost by model, provider, and agent alongside latency, error rate, output tokens/sec, cache reads, and tool-call rate.
-
Live view with SQL search
Search the live stream with a WHERE clause, or ask in plain English and let AI write the query. Standard PostgreSQL over the same table your traces live in, so nothing new to learn.
-
Service levels
Set a target on availability, latency, LLM calls or AI quality. Logfire tracks the error budget and alerts on burn rate before you spend it.
-
Scrubbing on by default
18 patterns redact passwords, tokens, keys and PII before data leaves the machine. On by default.
Use cases
Questions you can finally answer
- Debug a slow tool call
Was it the tool or the model?
When an agent gives a bad answer, the model usually gets blamed. The trace shows the tool call, what returned, and where the run went wrong.
- Find the slow endpoint
Where is the time going?
Sort a slow run by duration, open the longest span, and follow it down to the exact SQL statement or API call behind it.
- Set up the MCP server
Ask your coding agent what broke
One command connects Claude Code or Cursor to the Logfire MCP server. It queries production itself and comes back with the trace.
Customer stories
Teams who stopped guessing
-
How Dosu cut time to root cause across 54 agents
90% Less debugging time, using the Logfire MCP
-
How AutonomyAI let its agents check their own work
“Most of our engineers and our internal systems now use the Logfire MCP for basically everything”
Tammuz Dubnov Co-founder & CTO
-
How Sophos surfaced silent production failures
“We can see the whole conversation thread, the LLM call, and every API hop, all in one go”
Peter Kim Principal Software Engineer
FAQs
How do I trace an AI agent end to end?
Install the Logfire SDK, call logfire.configure(), and instrument your framework — one line for Pydantic AI, LangChain, the OpenAI SDK, and 40+ others. From then on, every agent run is captured as a single trace: the model calls, tool calls, retrieval steps, and the database and API calls around them, nested in the order they ran. You watch it locally as you build and in production without changing the setup.
Does Logfire trace the whole request, or just the LLM call?
The whole request. Most LLM observability tools stop at the model call: prompt, response, tokens. Logfire traces the full application: the FastAPI request, the Postgres query, the vector search, the tool call, and the model call, in one waterfall. That matters because production failures usually aren't in the model call itself. They're in the retry logic, the query that fed the prompt, or the tool that timed out.
Do I still need Logfire if I already use Datadog or Sentry?
If you're shipping AI in production, yes. Logfire connects agent runs, model calls, tools, and application spans in one trace, with purpose-built AI views and SQL over the same data. Because it's OpenTelemetry-native, you can run it alongside Datadog or Sentry without changing your current instrumentation.
How does Logfire help with RAG pipelines?
RAG failures are rarely just the LLM's fault. They hide in retrieval: slow vector searches, mismatched embeddings, irrelevant context passed to the model. Because Logfire traces your full application, you can see retrieval latency, database queries, and LLM calls in the same trace, which makes it much easier to locate the real bottleneck.
How does Logfire handle sensitive data and PII?
Logfire automatically scrubs known sensitive fields such as passwords, tokens, keys, and common PII patterns, before data leaves your application. You can configure additional scrubbing rules for anything specific to your use case. For teams with stricter requirements, the enterprise self-hosted option keeps all data within your own infrastructure.
Does tracing add latency to my agents?
No. Spans are batched and exported asynchronously on a background thread, so instrumentation stays out of the request path. For high-volume services, head and tail sampling let you keep every failed or slow run while sampling the routine ones, so you control the data volume without losing the traces that matter.
Get started with Logfire for free
Sign up today and see your first trace in under 2 minutes
01 — Install
$ uv add logfire
Resolved 7 packages in 128ms
Installed 7 packages in 89ms
+ logfire 02 — Instrument
import logfire
logfire.configure()
logfire.info('Hello {name}', name='world') Free up to 10m records per month No credit card needed