---
title: 'Pydantic Logfire: AI Observability for LLMs, Apps & RAG'
description: 'Pydantic Logfire: Production-grade AI & general observability built on OpenTelemetry. Works with Python, JavaScript/TypeScript, Rust, Go, Java, and any OTel-compatible language. For LLMs, Agents, API & Apps. Distributed tracing, evals & cost tracking'
canonical: https://pydantic.dev/logfire
last-reviewed: '2026-07-14'
---

> Markdown version of [Pydantic Logfire](https://pydantic.dev/logfire) — the canonical HTML page.
>
> Site index: [/llms.txt](https://pydantic.dev/llms.txt)

---

# AI Observability Platform for LLMs, Apps & AI Agents

Monitor your entire AI application stack, not just the LLM calls. Logfire is a production-grade observability platform for AI and general applications. See LLM interactions, agent behavior, API requests, and database queries in one unified trace. With SDKs for Python, JavaScript/TypeScript, and Rust, Logfire works with all OpenTelemetry-compatible languages.

Get started free at [logfire.pydantic.dev](https://logfire.pydantic.dev/) — 10 million free spans per month, no credit card required — or [contact us](https://pydantic.dev/contact).

## What is an AI observability platform?

An AI observability platform provides advanced features beyond traditional monitoring. While standard monitoring tells you that a system failed, an observability tool allows you to identify the underlying causes. In the era of Large Language Models (LLMs) and autonomous agents, this distinction is critical. An effective AI observability platform allows engineering teams to trace the lifecycle of a prompt, analyze token usage and latency per step, and benchmark model responses against groundedness and toxicity metrics.

## Break down silos: one tool for both AI and general observability

Most engineering teams are forced to use one observability tool for their backend application and a completely separate one for their LLMs. However, problems in production AI applications rarely come from the LLM alone. They hide in the seams: slow database queries that delay context retrieval, API timeouts during agent tool calls, inefficient vector searches, or memory leaks in background tasks. You need visibility across your entire application stack, not just the LLM calls.

**What Logfire shows you:** complete application traces from request to response; database queries, API calls, and business logic; dashboards and application metrics — one platform with first-class AI and general observability for your entire application.

**What LLM-only tools show you:** LLM request/response only, missing context on performance bottlenecks, no visibility into retrieval quality, and separate tools for app monitoring.

## From prompt to validated output in one trace

Define your schema with Pydantic models, extract structured data with a Pydantic AI agent, route through AI Gateway for model flexibility, and observe the entire flow in Logfire:

```python
import logfire
from pydantic import BaseModel
from pydantic_ai import Agent

logfire.configure()
logfire.instrument_pydantic_ai()

class City(BaseModel):
    name: str
    country: str
    population: int
    tourist_population: int
    landmarks: list[str]

agent = Agent(
    'gateway/openai:gpt-5',
    output_type=City,
    instructions='Extract information about the city',
)
result = agent.run_sync(
    'London is home to over nine million people, making it the largest city in the United Kingdom.'
    ' Around thirty million tourists visit each year, drawn by landmarks like Big Ben, the Tower'
    ' of London, and Buckingham Palace.'
)

logfire.info(f'Here is the output: {result.output=}')
```

## Why Logfire for AI observability?

- **OpenTelemetry-native** — any framework with OTel instrumentation works automatically. No special Logfire integration needed. Vercel AI SDK, LangChain, FastAPI: enable OTel, point to Logfire, done.
- **Complete application traces** — LLM calls, agent reasoning, database queries, API requests, vector searches, business logic, JS/TS frontend.
- **Logfire acts as an MCP server** — use your coding assistant (Claude Code, Open Code, Cursor) to [talk directly to your Logfire data](https://pydantic.dev/articles/logfire-mcp-is-awesome) inside your editor.
- **Integrated evaluation framework** — use [Pydantic Evals](https://pydantic.dev/docs/logfire/evaluate/evals/) to continuously evaluate LLM outputs in production, curate datasets from production traces, and catch regressions before users do.
- **Real-time cost tracking** — track [LLM API costs](https://pydantic.dev/docs/logfire/observe/llm-panels/) in real time, identify expensive prompts, optimize model selection, and set budget alerts.
- **Pydantic AI & AI Gateway integration** — natively integrates with [Pydantic AI](https://pydantic.dev/docs/ai/overview/) and [Pydantic AI Gateway](https://pydantic.dev/ai-gateway) for model routing and budget control across all major LLM providers.
- **From local dev to production** — see all app traces in real time as you code; carry the same observability through to production.
- **First-party SDKs** — [Python](https://github.com/pydantic/logfire), [JavaScript/TypeScript](https://github.com/pydantic/logfire-js) (Node.js, Next.js, browsers, Cloudflare Workers, Deno), and [Rust](https://docs.rs/logfire/latest/logfire/). Plus any OTel language.
- **Query your data with SQL** — drill into your [traces with full Postgres-flavored SQL](https://pydantic.dev/docs/logfire/reference/sql/), or let AI assistants auto-generate queries. No proprietary DSL, no vendor lock-in.

## Monitor your stack with OpenTelemetry

Logfire is built on OpenTelemetry, giving you a unified view of **logs** (structured and automatically redacted, every log linked to its trace), **traces** (one end-to-end timeline combining APIs, databases, third-party calls, LLMs, and AI agents), and **metrics** (latency, errors, performance, cost — with custom SLOs and alerts). No vendor lock-in.

## Built for polyglot architectures

Real applications are rarely single-language. Your Python AI backend talks to a TypeScript frontend, Go microservices, and Java legacy systems. Logfire traces them all in unified, correlated views — Python AI + TypeScript frontend, microservices in multiple languages, edge (Cloudflare Workers, Vercel Edge) to backend. The Vercel AI SDK has built-in OTel support — just enable it.

## Integrations

Auto-instrumentation across your stack — see [all integrations](https://pydantic.dev/docs/logfire/integrations/):

- **Python AI/LLM**: Pydantic AI, OpenAI, Anthropic, Google GenAI, LangChain, LlamaIndex, LiteLLM, Mirascope, MCP
- **Python web frameworks**: FastAPI, Django, Flask, Starlette, ASGI, WSGI
- **Databases**: PostgreSQL (Psycopg), SQLAlchemy, Asyncpg, PyMongo, Redis, MySQL
- **Other Python**: HTTPX, Requests, Celery, Loguru, Structlog, Stripe, AWS Lambda
- **JavaScript/TypeScript**: Vercel AI SDK, Browser, Next.js, Express, Node.js, Deno, Cloudflare Workers
- **Rust**: tracing, opentelemetry, log crate
- **Any language via OpenTelemetry**: Go, Java, .NET, Ruby, PHP, Erlang/Elixir, Swift, C++ — see [using standard OTel](https://pydantic.dev/docs/logfire/guides/alternative-clients/)

## Enterprise-level AI observability

- **Data sovereignty & self-hosting** — industries with strict data residency requirements (finance, healthcare, legal) can use the fully self-hosted enterprise plan.
- **SOC2 Type II certified** — no exceptions in our report; a copy is available on request.
- **HIPAA compliant** — Business Associate Agreements (BAAs) available on enterprise plans.
- **GDPR compliant, EU data region** — for customers who need data kept in the EU, there is an EU [data region](https://pydantic.dev/docs/logfire/manage/data-regions/).

See [security and compliance](https://pydantic.dev/security) and [enterprise plans](https://pydantic.dev/pricing#enterprise), or [book a discovery call](https://portal.usepylon.com/pydantic/forms/demorequest).

## Get started

```bash
pip install logfire
npm install @pydantic/logfire-node
```

Install the SDK, call `logfire.configure()`, and you're sending data. For AI frameworks like Pydantic AI, add one line — `logfire.instrument_pydantic_ai()` — to get full agent tracing automatically.

- Sign up: https://logfire.pydantic.dev
- Documentation: https://pydantic.dev/docs/logfire/get-started
- GitHub: https://github.com/pydantic/logfire
- Pricing: https://pydantic.dev/pricing (markdown: https://pydantic.dev/pricing.md) — free Personal plan includes 10M logs/spans/metrics per month; Team from $49/month, Growth from $249/month, with a price cap option on every paid plan.

## Compare Logfire

[vs LangSmith](https://pydantic.dev/logfire/vs-langsmith) · [vs Langfuse](https://pydantic.dev/logfire/vs-langfuse) · [vs Arize AX](https://pydantic.dev/logfire/vs-arize) · [vs Datadog](https://pydantic.dev/logfire/vs-datadog) · [vs Sentry](https://pydantic.dev/logfire/vs-sentry) · [vs SigNoz](https://pydantic.dev/logfire/vs-signoz) · [all alternatives](https://pydantic.dev/logfire/alternatives)

## FAQ highlights

**What is the difference between APM and AI observability?** Traditional APM focuses on system health metrics like CPU usage and request latency. AI observability extends this to LLM-specific metrics such as token usage, cost per request, prompt inputs/outputs, and hallucination detection.

**How does Logfire compare to LangSmith / Langfuse?** They focus primarily on LLM-layer tracing — prompt management, evaluation, model behavior. Logfire is built on OpenTelemetry and provides full-stack observability across your entire application, including AI components. If your question is "why is this request slow, where's the bottleneck, and what's it costing me?" — that's what Logfire is built for.

**Does Logfire only work with Pydantic AI?** No — any application with OTel instrumentation can send data to Logfire, including LangChain, LlamaIndex, Vercel AI SDK, FastAPI, Django, Express, and hundreds more. Likewise, Pydantic AI can send data to any OTel-compatible backend. There's no closed ecosystem.

**Can I self-host Logfire?** The SDKs are open source; the server and UI are closed source. Logfire offers EU and US hosting regions, and the Enterprise plan includes self-hosted deployment options.

## Related

- [Pydantic AI](https://pydantic.dev/pydantic-ai) — type-safe Python agent framework ([markdown](https://pydantic.dev/pydantic-ai.md))
- [Pydantic AI Gateway](https://pydantic.dev/ai-gateway) — one key for all your models ([markdown](https://pydantic.dev/ai-gateway.md))
- [Logfire section index](https://pydantic.dev/logfire/llms.txt)
- [Provisioning Logfire](https://pydantic.dev/logfire/provisioning.md) — LLM context for orchestrators and coding agents that create Logfire accounts and projects on a developer's behalf (Agentic Provisioning Protocol, including Stripe)
