Getting Started with Langfuse: A Comprehensive Guide to LLM Observability and Agent Evaluation

A complete guide to Langfuse's core capabilities for LLM observability, agent tracing, and evaluation.
This article provides a comprehensive introduction to Langfuse, an open-source LLMOps platform designed for LLM application observability. It covers Langfuse's core positioning, key capabilities including agent tracing, token cost analysis, prompt version management, automated and human evaluation, and its ecosystem integration with frameworks like LangChain and OpenAI Agent SDK. The article also clearly defines Langfuse's capability boundaries to help developers properly architect their systems.
Introduction: Why Agents Need a "Flight Recorder"
As LLM applications evolve from simple Q&A to complex multi-agent systems, a critical question emerges: When your agent calls multiple tools, sub-agents, and models, how do you know what it actually did? Which step went wrong? Which component took the longest? Where was the cost spent?
A Multi-Agent System refers to an architecture where multiple AI agents with independent reasoning capabilities collaborate to complete complex tasks. For example, one agent handles task decomposition and planning, another generates code, and a third performs quality review. The debugging difficulty of such architectures grows exponentially: a single user request may trigger dozens of model calls, multiple tool executions, and message passing between agents. Traditional logging systems can only record flat event sequences and cannot express these tree-like or graph-like call relationships—this is precisely why specialized tracing systems using hierarchical Span and Trace structures are needed to reconstruct the complete execution path.
This is the core topic of this article—agent tracing, evaluation, and observability practices based on the Langfuse platform. We'll focus on the first layer of essential knowledge: what Langfuse is and its positioning in enterprise-grade LLM applications.

What Exactly Is Langfuse
Official Definition and Plain-Language Explanation
Langfuse officially defines itself as "an open-source LLMOps platform." But this sentence alone doesn't convey its practical purpose.
First, let's understand the concept of LLMOps. LLMOps (Large Language Model Operations) is an emerging practice inspired by MLOps. While MLOps focuses on the full lifecycle management of traditional ML models—from training to deployment to monitoring—LLMOps addresses the unique characteristics of LLM applications, such as prompt engineering, token consumption management, context window optimization, and hallucination detection, proposing specialized engineering methodologies. As models like GPT-4, Claude, and Gemini are widely deployed in production, enterprises have discovered that traditional APM (Application Performance Monitoring) tools cannot effectively trace the non-deterministic outputs, chain-of-thought reasoning, and multi-turn conversation states unique to LLMs. This has given rise to dedicated LLMOps platforms like Langfuse, LangSmith, and Phoenix.
A more accurate description would be:
Langfuse is an open-source AI Engineering platform designed for LLM, RAG, and agent applications. Its primary functions include tracing execution processes, analyzing token costs and latency, managing prompts, collecting feedback, performing automated and human-annotated evaluations, and enabling continuous improvement through Datasets and Experiments.
This statement carries two layers of meaning:
- What it traces and evaluates: Langfuse specifically targets RAG or agent applications you've already built, collecting data, evaluating, and tracing them. RAG (Retrieval-Augmented Generation) is one of the most mainstream architecture patterns in enterprise LLM applications. Its core idea combines the generative capability of LLMs with the retrieval capability of external knowledge bases: first retrieving document chunks relevant to the user's question from a vector database, then injecting these chunks as context into the prompt, and finally having the LLM generate answers based on the retrieved content. This architecture effectively mitigates the knowledge cutoff and hallucination problems of LLMs, but also introduces new complexity—retrieval quality, chunking strategy, and re-ranking effectiveness all impact the final output, making observability for RAG systems particularly critical. Langfuse can also trace the LLM itself, and even AI coding agents like Claude Code and Codex—because they are essentially agents too.
- Core capabilities: Tracing execution processes, analyzing token costs and latency, managing prompts, collecting feedback, and performing various evaluations.
One important detail: Langfuse is a platform, not a development framework. When using it, you typically install its self-hosted service, then integrate it with your own LLM, RAG project, or agent project to achieve observability.
The concept of "observability" deserves further explanation here. Observability originates from control theory and refers to the ability to infer a system's internal state solely from its external outputs. The key difference from traditional monitoring is: monitoring focuses on known metrics (like CPU usage and request error rates), while observability emphasizes debugging capability when facing unknown problems. For LLM applications, this distinction is particularly important—LLM outputs are highly non-deterministic, and you cannot predefine all possible failure modes, so you need complete trace data, structured logs, and rich metadata to support post-hoc analysis. The three pillars of observability—Traces, Metrics, and Logs—all have corresponding implementations in Langfuse.

Understanding Langfuse's Positioning Through Analogy
If we compare an Agent to a digital AI employee who can research, use tools, and calculate, then Langfuse simultaneously plays four roles:
- Flight Recorder: Completely traces every step this digital employee takes;
- Quality Department: Evaluates the quality of AI-generated answers;
- Laboratory: When you modify prompts or switch models, you can run comparison tests here;
- Prompt Configuration Center: Centrally manages prompts and their versions.
This analogy clearly outlines Langfuse's positioning within the entire LLM application lifecycle.
Langfuse Tech Stack and Ecosystem Integration
Supported Programming Languages and Frameworks
Langfuse's top-level language support covers Python and TypeScript/JavaScript. You can also do limited secondary development on top of it, with Python or TypeScript recommended.
More importantly, it offers ecosystem integration capabilities. Langfuse supports seamless integration with mainstream agent and RAG development frameworks, including:
- LangChain / LangGraph
- DeepAgent
- LlamaIndex
- OpenAI Agent SDK
This means that regardless of which mainstream framework you use to build agents, you can integrate Langfuse's observability capabilities at low cost without restructuring your existing architecture.

The Hidden Value of Prompt Version Management
Many developers ask: "Can't I just write prompts directly in my project code? Why put them in Langfuse?"
The answer lies in version management and rollback. In software engineering, code version management has long been standard practice (e.g., Git), but prompt version management has been neglected for a long time. Prompts are essentially the "software" that controls LLM behavior—a tiny change in wording can cause significant fluctuations in output quality. In production environments, prompts are often modified far more frequently than code: product teams may tune prompts daily to improve performance in specific scenarios. Decoupling prompts from code and enabling hot reload rather than redeployment is a critical engineering practice for enterprise LLM applications. This is similar to the role of feature flags in traditional software, allowing dynamic adjustment of system behavior without releasing a new version.
Prompts inevitably get modified during operation, and no one can guarantee that every modification improves results. When performance degrades, you need to be able to:
- Quickly roll back to the last stable version;
- Complete the switch without restarting your RAG or agent project.
If prompts are hardcoded in your codebase, this is nearly impossible to achieve gracefully. Langfuse's prompt configuration center solves exactly this enterprise-level pain point—it's also one of its most underestimated yet critically important capabilities in real production environments.
Key Questions Langfuse Can Answer
After integrating Langfuse, you can clearly answer these questions that are crucial in production:
- What steps did this request go through?
- What did each agent do? Which tools and models were called?
- How long did each tool and model take to execute?
- Which version of the prompt and model was used?
- What are the input/output token counts, cost breakdown, and latency?
- Was the answer correct? Is there comprehensive accuracy data?
- Was the user satisfied (feedback collected through human annotation)?
- Is the new version better than the currently stable Baseline?
Token cost tracking deserves special emphasis. Tokens are the basic billing unit for LLM text processing—typically one English word corresponds to 1-2 tokens, and one Chinese character corresponds to 1.5-2 tokens. For enterprise applications, precise token cost tracking is crucial: taking GPT-4o as an example, input tokens and output tokens have different pricing, and a complex agent task may involve multiple rounds of internal reasoning and tool call result returns, with actual token consumption often far exceeding the visible input/output text volume. Without granular token statistics, enterprises may unknowingly generate enormous bills, especially in abnormal scenarios where agents enter infinite loops or repeatedly call models.

This complete set of observability metrics transforms the previously "black box" agent execution process into something transparent and controllable, providing the data foundation for continuous optimization.
Understanding Langfuse's Capability Boundaries
Understanding a tool means knowing not only what it can do, but also what it cannot do. This helps with proper division of responsibilities in architecture design.
What Langfuse Can Do
| Capability | Description |
|---|---|
| Observability | Records the complete call chain of models, tools, retrieval, and sub-agents |
| Evaluation & Feedback | Supports automated evaluation and human-annotated feedback |
| Prompt Management | Version control, rollback, centralized configuration |
| Metrics Analysis | Statistics for tokens, costs, latency, and other metrics |
What Langfuse Cannot Do
- Does not provide the agent framework itself: You need to build the agent architecture yourself;
- Does not provide LLMs: You need to supply your own models;
- Does not provide vector knowledge bases: The vector database for RAG must be implemented by you;
- Does not handle server operations and monitoring: Health checks and operational monitoring after deployment are outside its scope.
In other words, Langfuse focuses on four things: "observation, evaluation, feedback, and prompt management." It doesn't replace agents or RAG for business decisions—it exists as a specialized quality and observability hub.
Summary
For teams building enterprise-grade LLM applications, Langfuse provides a complete toolchain from tracing and debugging to evaluation and optimization. Its value lies not in replacing your agent framework, but in making your agents "visible, manageable, and optimizable."
In an era of increasingly complex multi-agent systems, an LLM application without observability is like a plane without a dashboard—once something goes wrong, you have nowhere to start. Langfuse is exactly that "flight recorder" that puts you back in control. Next, we'll dive deeper into how to integrate Langfuse into real projects to achieve end-to-end agent observability.
Related articles

Chain of Thought Isn't Just for AI: How Humans Can Use CoT to Improve Thinking Quality
Chain of Thought isn't just a prompt trick for large models. Starting from a Hacker News discussion, this article analyzes why CoT works for human thinking too, breaks down actionable ways to transfer it, and highlights the key differences between human CoT and machine CoT.
Cloudflare Teams Up with OpenAI: Closi…
Cloudflare Teams Up with OpenAI: Closing the Loop from Vulnerability Discovery to Defense with AI
Cloudflare uses OpenAI Daybreak to investigate security vulnerabilities and generate reviewable remediation plans, while developers use Codex to boost coding efficiency and quality.

Orca Multi-Agent Orchestration in Practice: A Guide to Parallel Collaboration with Claude and Codex
Orca is Stable AI's free open-source agent workbench supporting 34 agents like Claude Code and Codex in parallel. Learn its Git worktree isolation, multi-model orchestration, and mobile management.