All Tools
Langfuse logo

Langfuse

Langfuse is an open-source platform for observing and improving LLM applications, providing tracing, cost tracking, prompt management, and evaluation tools for AI teams building in production.

What is Langfuse?

Langfuse is an open-source AI engineering platform for observing, evaluating, and improving LLM applications. It captures every step of an LLM application’s execution — model calls, retrieval queries, tool invocations, and intermediate reasoning steps — as a structured trace, then gives you dashboards, evaluation tools, and prompt management to understand what is happening and make it better. For any team building AI applications in production, Langfuse provides the visibility that is otherwise impossible to get from logs alone.

How Langfuse works

Langfuse is built around the concept of a trace: a hierarchical record of a single user interaction or workflow run.

Tracing captures every step of your AI application as a tree of spans. A span is a single operation — an LLM call, a vector database query, a function execution — with its inputs, outputs, start time, duration, and metadata. The trace shows you the complete picture: what the user sent, what context was retrieved, what the model received, what it returned, and how long each step took. You instrument your application with the Langfuse SDK (Python or TypeScript) or by adding it as an integration to LangChain, LlamaIndex, OpenAI SDK, or LiteLLM — often just a few lines of code.

Token and cost tracking happens automatically for any generation span. Langfuse reads the model name and token counts from the LLM response, looks up the current price for that model, and records the cost per generation. You can then aggregate by user, session, prompt version, or date to understand where your inference budget is going and which parts of your application are most expensive to run.

Prompt management gives you a central registry for the prompts your application uses. You push prompt versions to Langfuse, pull them at runtime via the SDK (so changes take effect immediately without redeploying your app), and see which version was used in each trace. You can A/B test prompt versions by tracking their evaluation scores side by side.

Evaluations let you score LLM outputs against defined quality criteria. Langfuse supports LLM-as-a-judge (where a second LLM grades the output using a rubric), model-based evaluators (code that checks for specific patterns or structures), human annotation queues (where reviewers score outputs manually), and user feedback signals (thumbs up/down ratings from your end users). Scores appear on traces and aggregate on your dashboard.

Datasets and experiments allow you to run your current prompt or model configuration against a fixed set of test cases, compare the results to a previous run, and see whether a change improved or degraded quality. This is the standard workflow for validating a prompt change before deploying it to production.

Self-hosting is a first-class option. Langfuse ships as a Docker Compose setup and can be deployed to any server, Kubernetes cluster, or cloud provider. Self-hosting removes the per-trace cost and keeps all trace data inside your own infrastructure — important for teams handling sensitive data or operating in regulated industries.

What you can build with Langfuse

Production AI application monitoring. Instrument any LLM application with the Langfuse SDK and immediately gain visibility into latency by model and step, token usage and cost by user cohort, error rates by prompt version, and quality scores from automated evaluations. This is the baseline observability setup for any AI application with real users.

RAG pipeline debugger. For a retrieval-augmented generation system, Langfuse traces show you what chunks were retrieved, what the model was given, and what it returned — all in one view. When a user reports a bad answer, you trace the interaction directly, see whether the right content was retrieved, and identify whether the problem is in retrieval or generation. Without this, debugging RAG failures requires adding temporary logging to your codebase.

Prompt optimisation workflow. Maintain prompt versions in Langfuse, run each version against a dataset of test cases, and compare their evaluation scores. When a new version scores better on your rubric, promote it to production from the Langfuse dashboard. The SDK pulls the latest version at runtime — no code changes or redeployment needed.

LLM cost allocation system. Tag each trace with a user ID, organisation, or feature name, then use Langfuse’s analytics to produce per-customer or per-feature cost breakdowns. For multi-tenant AI products that need to track inference costs per customer for billing or budgeting purposes, Langfuse provides the attribution layer without custom database queries.

Human annotation pipeline. Set up an annotation queue where a portion of your production traces are routed to human reviewers for quality scoring. Feed those scores back into your evaluation dataset to fine-tune your LLM-as-a-judge evaluator over time and catch quality regressions that automated evaluators miss.

Is Langfuse free?

The Langfuse open-source project is free under the MIT license with no limits when self-hosted. The cloud version has a Hobby plan with 50,000 observation units per month at no cost — enough for development and low-traffic production applications. Core is $29/month for 100,000 units and unlimited users. Pro is $199/month for higher rate limits, 3-year data retention, and compliance reports (SOC2, ISO 27001, HIPAA BAA). Enterprise is custom pricing. Additional units cost $8 per 100,000 across all paid tiers. Teams with high trace volumes typically find self-hosting more cost-effective than the cloud tiers.

How to get started with Langfuse

Create a free account at langfuse.com and create a new project. Install the Python SDK with pip install langfuse. Add your public and secret keys as environment variables and wrap your first LLM call with @observe() decorator to start capturing traces. For LangChain, add CallbackHandler to your chain in one line and traces flow automatically. Open the Langfuse dashboard, run a query against your application, and inspect the trace. The documentation at langfuse.com/docs covers integrations for every major LLM framework.

For a hands-on path through building production AI systems with proper observability — Langfuse, Prometheus, Grafana, and LLM-specific instrumentation included — the BuildrLabs Agentic AI Bootcamp covers the full stack in person in Colombo over 16 weeks.

Key Features

  • End-to-end tracing that captures every LLM call, tool invocation, and retrieval step as a structured trace
  • Token and cost tracking per model, per session, per user, and per prompt version
  • Prompt management with versioning, A/B testing, and instant updates without redeployment
  • LLM-as-a-judge evaluations that score outputs automatically against defined criteria
  • Dataset and experiment management for systematically testing prompt and model changes
  • Self-hostable on your own infrastructure with Docker; cloud version available with no credit card required

FAQ

Is Langfuse free to use? +

Yes. The Langfuse open-source project is free under the MIT license and can be self-hosted with no limits. The cloud-hosted version has a Hobby plan at no cost, which includes 50,000 observation units per month, 30 days of data access, and support for 2 users — sufficient for solo developers and small projects. The Core plan is $29/month (100,000 units, unlimited users, 90-day access). Pro is $199/month (100,000 units included, 3-year data access, SOC2 and ISO 27001 reports, high rate limits, and HIPAA BAA available). Enterprise pricing is custom. Overage across all paid plans is $8 per 100,000 additional units.

What is a trace in Langfuse and why does it matter? +

A trace in Langfuse is the complete record of a single user interaction or workflow run — every step captured as a tree of spans. For a RAG application, a trace might include a retrieval span (the vector database query), a generation span (the LLM call with the retrieved documents), and a post-processing span (parsing the output). Each span records its inputs, outputs, latency, model name, token usage, and cost. Traces are the primary debugging tool for LLM applications — when a user reports a bad response, you look at the trace to see exactly what the model received, what it returned, and where time was spent.

How does Langfuse compare to LangSmith? +

Both tools solve the same problem — tracing and evaluating LLM applications — but differ in approach and pricing model. LangSmith is LangChain's commercial observability product, tightly integrated with the LangChain ecosystem and charged by trace volume with a free tier of 5,000 traces per month. Langfuse is framework-agnostic, open-source, and can be self-hosted, which matters for teams with data residency or cost constraints. Langfuse integrates with LangChain, OpenAI SDK, LlamaIndex, LiteLLM, and any other LLM framework via its Python SDK, TypeScript SDK, or OpenTelemetry-compatible API. Teams that are not using LangChain often prefer Langfuse for this reason, and self-hosting removes the per-trace cost entirely for high-volume applications.

Explore Similar AI Tools

Newsletter

The Twice-Monthly AI Briefing

Updates from the AI world — what shipped, what we’re using in production, and what’s worth your attention. Two emails a month, no spam.