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.
This prompt was copied from the Pydantic Logfire website. Set up Logfire in this repository end to end and confirm that fresh data reaches the intended Logfire project. Keep the user informed with short progress updates, but continue through ordinary, reversible setup work without asking for approval. Do not require a clean Git working tree, a new branch, commits, a detailed task list, plan approval, or commands the user could run only because you chose not to run them. Preserve existing work and follow the repository's instructions. Pause only for a real decision or boundary: interactive browser authentication, a genuinely ambiguous application or target project after inspection, enabling capture of potentially sensitive AI content, materially increasing production telemetry or cost, deployment or infrastructure changes, or destructive, irreversible, or unrelated work. Ask one concrete question when you need to pause. ## Goal Get one representative runnable service sending useful traces, logs, or metrics to the exact Logfire project, then verify the first fresh signal. In a monorepo or multi-service system, prove this loop for one service before offering to expand to the rest. ## 1. Understand the repository 1. Read the applicable `AGENTS.md`, `CLAUDE.md`, `README.md`, contribution guidance, and existing setup or deployment files. 2. Identify the language, runtime, package manager, runnable application entry point, and one representative request, job, or agent run to exercise. If this is a library with no application entry point, do not put SDK configuration in library code; use an existing example application or ask one focused question about what should run. 3. Look for existing OpenTelemetry, tracing, logging, sampling, redaction, and exporter configuration. Reuse that telemetry path instead of creating a competing provider or duplicate exporter. Preserve existing scrubbing, sampling, and logging behavior. 4. Inspect the working tree so you do not overwrite the user's changes, but do not make cleanliness, branching, or commits prerequisites for setup. ## 2. Authenticate and select the exact project Determine the target project's region from its URL or the user's context before authenticating. Run the Logfire CLI yourself from the application directory. Use `uvx logfire` for project authentication and selection regardless of the application's language or package manager; this is a setup tool, not an application dependency. If `uv` is unavailable, install it from https://docs.astral.sh/uv/getting-started/installation/, then use this sequence: ```bash uvx logfire auth uvx logfire projects list uvx logfire projects use <project-name> uvx logfire whoami ``` 1. Run the `auth` command. Let the user complete the browser sign-in if prompted, then continue as soon as the CLI succeeds. The region flag is global and must come immediately after `logfire`, for example `uvx logfire --region eu auth`. Use the same placement on project commands when the target region is known. If it is unknown, omit the flag and let `auth` ask. 2. Run `projects list`. Select the organization and project established by the user's URL or context. If exactly one project is available, use it. If several projects are plausible and repository evidence does not identify the target, ask the user one concise project-selection question. If no projects exist, ask for the project name and run `uvx logfire projects new <project-name>` instead of stopping at an empty list. 3. If local `.logfire` credentials or `LOGFIRE_TOKEN` already exist, run `whoami` before creating another token. Reuse them only when they identify the exact intended project and region. 4. Otherwise, from the application root, run `projects use <project-name>` (add `--org <organization-name>` when needed). This creates `.logfire/logfire_credentials.json` plus `.logfire/.gitignore` with a project-scoped write token for local Python and Node.js development. 5. Run `whoami` and record the exact organization, project, region, and project URL. `LOGFIRE_TOKEN` takes precedence over local credentials, so correct or remove a mismatched ambient token before exercising the app. Authentication alone is not enough: credentials, instrumentation, verification, and every link you give the user must all refer to this same project. Never silently substitute a latest-project redirect or a different convenient project. Never ask the user to paste a token into chat, and never print, log, hard-code, or commit one. Run local Python and Node.js workloads from the directory containing `.logfire`, or set `LOGFIRE_CREDENTIALS_DIR` when their working directory differs. For Rust, Workers, deployed applications, and generic OpenTelemetry setups that do not read local CLI credentials, transfer the CLI-created token without displaying it into the runtime's existing gitignored local secret mechanism: `LOGFIRE_TOKEN` for Rust and Workers, or the documented OTLP authorization header for generic clients. Put it in a local environment file only when the application already loads that file safely; use the deployment platform's secret manager for production. Browser code must send through an authenticated same-origin backend proxy and must never contain a write token. If a static browser app has no backend or proxy, do not use it as the first proof path. ## 3. Install and instrument Use persistent dependency commands that match the repository, such as `uv add`, `pnpm add`, or `cargo add`, rather than a one-off global install. Before editing instrumentation, fetch and read the official Logfire setup guide for coding agents at https://raw.githubusercontent.com/pydantic/logfire/refs/heads/main/logfire/.agents/skills/logfire-instrumentation/SKILL.md, then read the references it links for the representative service's language and frameworks. Use it to find the right runtime guidance, but verify exact APIs and dependency versions against the current linked documentation and installed package types rather than copying version literals. - Python: install `logfire` with the relevant extras, such as `logfire[fastapi]`, and configure it once at application startup. For a long-running Python service, include system metrics with the repository's dependency command, for example `uv add 'logfire[system-metrics]'` plus detected framework extras, or `uv add 'logfire[fastapi,system-metrics]'`; then call `logfire.instrument_system_metrics()` after `configure()` so the Hosts view works. Skip it for serverless or short-lived workloads and when an existing OpenTelemetry Collector already sends host metrics; do not use `base='full'` without explicit approval. - Node.js: use `@pydantic/logfire-node`. - Browser: use `@pydantic/logfire-browser` with the documented backend `traceUrl` proxy. - Cloudflare Workers: use `@pydantic/logfire-cf-workers` and `logfire`, with the token stored as a Worker secret. - Rust: use the `logfire` crate and read `LOGFIRE_TOKEN` from the environment. - Go, Java, .NET, Ruby, PHP, Elixir, and other languages: use the standard OpenTelemetry SDK and the relevant guide at https://pydantic.dev/docs/logfire/guides/alternative-clients/. Read https://pydantic.dev/docs/logfire/resources/languages/ and the applicable pages under https://pydantic.dev/docs/logfire/integrations/. For Python, run `logfire inspect` inside the application's own environment after installing Logfire, for example `uv run logfire inspect`; do not use the isolated `uvx` environment for package detection. Prefer supported integrations for the frameworks, databases, HTTP clients, task queues, and AI libraries already used by the representative service. Add a stable service name. If no integration produces an identifiable operation, add one small, useful manual span around the representative request or job rather than scattering instrumentation through the codebase. For AI instrumentation, begin in metadata-only or no-content mode: record timing, model/provider, token usage, tool names, status, and errors without prompts, responses, tool arguments, tool results, or binary content. Do not assume an instrumentor's default is content-safe and do not rely on scrubbing for AI message attributes. Use explicit documented controls, including `logfire.instrument_pydantic_ai(include_content=False, include_binary_content=False)` for Pydantic AI and `recordInputs: false, recordOutputs: false` with Vercel AI SDK telemetry. If an integration has no documented content-disable control, do not enable that integration on the initial pass; use a small metadata-only manual span or ask for explicit approval. After the first signal is verified, explain the debugging benefit and privacy tradeoff of content capture and enable it only with explicit user approval. Make the smallest useful setup change. Do not refactor unrelated code, instrument every service before the first success, change production sampling, or deploy anything as part of the initial proof. ## 4. Exercise and verify 1. Run the relevant format, lint, typecheck, and focused tests for the files you changed. Distinguish pre-existing or unrelated failures from regressions caused by the setup; report them, but do not misrepresent them as a Logfire failure. 2. Start the real application or workload from the credential-aware working directory and trigger one representative request, job, or agent run. Note an identifiable service name and operation that should appear. If system metrics were enabled, keep the process alive long enough for at least one collection interval. 3. Check for startup, credential, and exporter errors, but do not treat their absence as success. 4. Confirm that fresh data appears in the exact project reported by `whoami`. Use available Logfire MCP, API, or signed-in browser capabilities to search for the service and operation yourself; the CLI can verify credentials but cannot prove ingestion. Ask the user to check the exact Live view only when you genuinely cannot access a verification path. If system metrics were enabled and you can access the UI or API, also confirm the host or a fresh `system.*` metric. If data does not appear, trace the path in order: application startup and configuration, exact project credentials and region, integration registration, the exercised code path, exporter errors or flushing, and ingestion. Make the smallest safe correction, rerun the workload, and verify again. Report one specific blocker if you cannot complete the loop; do not return a generic troubleshooting checklist. Success means fresh telemetry from the exercised workload was observed in the intended project. Summarize what you changed, what you ran, the exact project used, and the signal you verified. If system metrics were enabled, link to that exact project's Hosts view, offer the `Basic System Metrics (Logfire)` dashboard, and state whether host data was observed or is still awaiting its first collection. Then offer relevant next steps such as expanding to other services, production credential wiring, dashboards, alerts, additional integrations, or opt-in AI content capture. Offer commits or a pull request if useful, but do not make them a prerequisite and do not create a PR unless the user asks.
Companies who trust Pydantic Logfire


Understanding
What is an AI observability platform?
An AI observability platform is a tool that 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.
The Full Picture
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 & general observability for your entire application
What others show you
- ✗ LLM request/response only
- ✗ Missing context on performance bottlenecks
- ✗ No visibility into retrieval quality
- ✗ Separate tools for app monitoring
Evals
Evals that live inside the trace, not in a tool beside it
Airbnb published the clearest public account of evaluating generative AI at scale: read real outputs first, then build evaluators for the failures you actually found, in three layers. Logfire runs all three, and the score lands on the span it scored, beside the database query, the tool call, and the retry that explain it.
01
Programmatic checks
Failures code can identify exactly: malformed JSON, a missing citation, a tool called with the wrong arguments, a response over the length budget. Cheap, deterministic, and they run on every case.
Writing evals02
LLM judges, one job each
For the qualities code cannot check: is the tone right, does the answer follow from the retrieved context, is it actually responsive to the question. A judge with one narrow job is far more reliable than one asked to grade everything.
Datasets and experiments03
Human review as ground truth
People settle the disputed cases and calibrate the judges, so you know how far to trust an automated score before you gate a release on it.
Human reviewThen close the loop
Run the same evaluators offline against a dataset to compare a prompt or model change, and live against production traffic to catch what your dataset never contained. Production failures become the next dataset case, and the loop starts again.
Because a score is just an attribute on a span, you can query your evals and the rest of your telemetry together with the same PostgreSQL-compatible SQL, and evals bill as ordinary records rather than carrying a separate per-score fee.
The Pydantic Stack
From prompt to validated output in one trace
See how Pydantic AI, AI Gateway, and Logfire work together. Define your schema with Pydantic models, extract structured data with an AI agent, route through Gateway for model flexibility, and observe the entire flow in Logfire.
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
See your entire application: LLM calls, agent reasoning, database queries, API requests, vector searches, business logic, JS/TS frontend.
Logfire Acts as an MCP Server
Use your favorite coding assistant (like Claude Code, Open Code, and Cursor) to talk directly to your Logfire data inside your code editor.
Integrated Evaluation Framework
Use Pydantic 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 in real-time. Identify expensive prompts, optimize model selection, and set budget alerts. See exactly where your AI spending goes.
Pydantic AI & AI Gateway Integration
Natively integrates with Pydantic AI and Pydantic AI Gateway for model routing & budget control across all major LLM providers.
From Local Dev to Production
See all app traces in real-time as you code. Catch bugs in development, carry the same observability through to production. No tool switching, no friction.
First-Party SDKs for Python, JS/TS, Rust
Full SDKs for Python (AI frameworks), JavaScript/TypeScript (Node.js, Next.js, browsers, Cloudflare Workers, Deno), and Rust. Plus any OTel language.
Query Your Data with SQL
Drill down into your traces with SQL and use Natural Language Processing (NLP) to auto-generate your SQL queries.
Need self-hosting, SSO, or custom data retention? Talk to our team
Open Standards
Monitor your stack with OpenTelemetry
Logfire is built on OpenTelemetry, giving you a unified view of logs, traces, and metrics with no vendor lock-in. Our SDKs for Python, Rust, and TypeScript make instrumentation simple, and power features like live spans that render before they complete.
Logs
Structured and automatically redacted, with every log (span) linked to its trace. Search instantly or query with SQL.
Traces
One end-to-end timeline that combines APIs, databases, third-party calls, LLMs, and AI agents in one view.
Metrics
Track what matters to you: latency, errors, performance, cost, or any trend across your system. Set custom SLOs and alerts to keep your application reliable.
Multi-Language Support
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
See your agents and Next.js frontend in unified traces. Track requests from browser to AI model and back.
Microservices in Multiple Languages
Python, Go, Java, Node.js - one dashboard, complete visibility. Trace requests across service boundaries automatically.
Edge + Backend
Cloudflare Workers or Vercel Edge to Python backend, traced end-to-end. See latency at every hop.
Build with Vercel and trace with Logfire
Logfire works seamlessly with the Vercel ecosystem. Use @vercel/otel automatic server-side tracing, or our browser SDK for client-side visibility. The Vercel AI SDK has built-in OTel support - just enable it.
Integrations
Logfire works with your entire stack
Observability should not require a rewrite of your codebase. Built on open standards (OTel) with SDKs for Python, Javascript/Typescript, and Rust, Logfire supports auto-instrumentation for AI frameworks, web frameworks, databases, background workers, browsers, and more.
Python
JavaScript / TypeScript
✨ Vercel AI SDK has built-in OTel support—no special integration needed
Any Language via OpenTelemetry
Logfire is built on OpenTelemetry. Any framework with OTel instrumentation works automatically — no special integration needed. Our listed integrations are convenient wrappers, not requirements.
Insights
Query your data with full SQL
Query your data with full Postgres flavored SQL — all the control and (for many) nothing new to learn. Even if you don't like writing SQL, LLMs do, so SQL plus an MCP server lets your IDE use Pydantic Logfire as a window into your app's execution. Search for obstacles and opportunities, as you (or the AI) writes code.
With Proprietary DSLs
- • Limited to anticipated queries
- • AI assistants struggle with unfamiliar syntax
- • Constrained analysis capabilities
- • Vendor lock-in
With Logfire SQL
- • Ask any question, get any answer
- • AI assistants write excellent SQL
- • Full analytical power—JOINs, aggregations, CTEs
- • Familiar syntax—no new query language to learn
Enterprise Ready
Enterprise-level AI observability
AI applications often process sensitive user data. As a result, enterprise-level AI observability platforms need to meet strict security, compliance, and data privacy standards. Pydantic Logfire is architected to meet the rigorous governance standards of enterprise engineering teams.
Data sovereignty & self-hosting
Industries with strict data residency requirements (Finance, Healthcare, Legal) can make use of our fully self-hosted enterprise plan.
SOC2 Type II certified
Logfire is SOC2 Type II certified. We did not receive any exceptions in our report. A copy is available upon request.
HIPAA compliant
Logfire is HIPAA compliant. We are able to offer Business Associate Agreements (BAAs) to customers on our enterprise plans.
GDPR compliance & EU data region
Pydantic is fully GDPR compliant. For customers who need data kept in the EU, we offer an EU Data Region.
Logfire is already making developers' lives easier
Compare Logfire
See how Logfire compares to other observability and LLM monitoring tools.
Ready to see your complete AI application?
Start monitoring your LLMs, agents, and entire application stack in minutes. 10 million free spans, logs, and metrics per month. No credit card required.
Frequently asked questions
What is AI observability?
What is the difference between APM and AI Observability?
How does Logfire help with RAG (Retrieval-Augmented Generation)?
Does Logfire work with LangChain and LlamaIndex?
Does Logfire support AI Agents?
Is Logfire OpenTelemetry-native?
Do I need special Logfire integrations for my framework?
How does Logfire handle security, privacy, and PII?
Can Logfire help control and reduce the cost of running AI and LLMs?
Is Logfire only for Python applications?
What exactly is Logfire and how is it different from other observability tools?
How does Logfire compare to LangSmith / Langfuse?
Does Logfire only work with Pydantic AI, or can I use it with other frameworks?
How do I get started / how much code does it take?
pip install logfire for Python, or npm install @pydantic/logfire-node for JavaScript/TypeScript), 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.What does it cost? Is it really free?
Can I self-host Logfire?
Logfire's has SDKs for Python, TypeScript/JavaScript, and Rust. The Python SDK is open source under the MIT license and wraps the OpenTelemetry Python package. By default, it will send data to the Logfire platform but you could send data to any OpenTelemetry Protocol (OTLP) compliant endpoint.