Langfuse — Open Source LLM Observability
Langfuse is an open-source LLM engineering platform for tracing, prompt management, evaluation, and debugging AI apps. 24.1K+ GitHub stars. Self-hosted or cloud. MIT.
Installation agent prête
Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.
npx -y tokrepo@latest install 49a8eb0b-b44b-46c2-b3c8-b54e55fb224f --target codexÀ exécuter après confirmation du plan en dry-run.
What it is
Langfuse is an open-source LLM engineering platform that provides observability for AI applications. It traces every LLM call, tracks token usage and latency, manages prompt versions, and supports evaluation workflows. You integrate it with a few lines of code and get a dashboard showing how your AI application performs in production.
Langfuse targets AI engineers, ML teams, and product developers who build LLM-powered applications and need to understand cost, quality, and performance. It is available as a cloud service or self-hosted under the MIT license.
How it saves time or tokens
Without observability, debugging LLM applications means adding print statements, manually counting tokens, and guessing why outputs degrade. Langfuse automatically traces every call, records inputs/outputs, measures latency, and calculates costs. Prompt management lets you version and A/B test prompts without code changes. This visibility helps you identify expensive or slow calls and optimize them, directly reducing token waste.
How to use
- Install the SDK:
pip install langfuse openai
- Add tracing with a one-line import swap:
from langfuse.openai import openai
client = openai.OpenAI()
response = client.chat.completions.create(
model='gpt-4o',
messages=[{'role': 'user', 'content': 'Hello'}]
)
- View traces in the Langfuse dashboard at
cloud.langfuse.comor your self-hosted instance.
- Use the prompt management UI to version and deploy prompts without redeploying code.
Example
from langfuse import Langfuse
langfuse = Langfuse()
# Create a trace for a multi-step workflow
trace = langfuse.trace(name='rag-pipeline')
# Span for retrieval step
retrieval = trace.span(name='retrieval')
# ... your retrieval logic ...
retrieval.end(output={'docs_found': 5})
# Generation span for LLM call
generation = trace.generation(
name='answer-generation',
model='gpt-4o',
input=[{'role': 'user', 'content': 'question'}]
)
# ... your LLM call ...
generation.end(output='answer text', usage={'input': 150, 'output': 200})
Related on TokRepo
- Langfuse on AI Gateway -- Langfuse as an observability layer
- Monitoring Tools -- Observability and monitoring tools
Common pitfalls
- Tracing adds a small latency overhead per call. For latency-sensitive applications, use async flushing (enabled by default) and batch spans.
- Self-hosted Langfuse requires PostgreSQL and ClickHouse. Plan for database maintenance and storage growth as trace volume increases.
- Prompt management works best when prompts are fetched at runtime. Hardcoded prompts in code bypass the versioning system entirely.
Questions fréquentes
Langfuse is open source under the MIT license. Self-hosting is completely free. The cloud-hosted version has a free tier with usage limits and paid plans for higher volume.
Langfuse integrates with OpenAI, Anthropic, Google, AWS Bedrock, Azure OpenAI, and any provider via the generic SDK. Framework integrations exist for LangChain, LlamaIndex, and Haystack.
Yes. Langfuse provides Docker images and Helm charts for self-hosting. It requires PostgreSQL and ClickHouse. The self-hosted version has full feature parity with the cloud version.
LangSmith is LangChain's proprietary observability platform. Langfuse is open source, framework-agnostic, and self-hostable. If you use LangChain exclusively, LangSmith has deeper integration. If you want vendor independence, Langfuse is the better choice.
Yes. Langfuse supports manual annotation, model-based evaluation, and custom scoring functions. You can define evaluation criteria and score traces programmatically or through the UI.
Sources citées (3)
- Langfuse GitHub— Open-source LLM engineering platform, MIT license
- Langfuse Documentation— Tracing, prompt management, and evaluation features
- Anthropic Observability Guide— LLM observability best practices
En lien sur TokRepo
Source et remerciements
Created by Langfuse. Licensed under MIT. langfuse/langfuse — 24,100+ GitHub stars
Fil de discussion
Actifs similaires
Grafana — Open Source Data Visualization & Observability
Grafana is the leading open-source platform for monitoring and observability. Visualize metrics, logs, and traces from Prometheus, Loki, Elasticsearch, and 100+ data sources.
SigNoz — Open Source APM & Observability Platform
SigNoz is an open-source Datadog/New Relic alternative with logs, traces, and metrics in one platform. Native OpenTelemetry support, ClickHouse backend, and powerful dashboards.
Langfuse Python SDK — Trace LLM Apps
Langfuse Python SDK adds tracing and observability to any LLM app via decorators or low-level calls, so you can track latency, cost, and prompts.
Istio — Open Source Service Mesh for Microservices
Istio is the leading open-source service mesh. Connect, secure, control, and observe services with mTLS encryption, traffic management, and observability — all without changing application code.