Before an AI agent returns an answer, it stacks up model calls, retrievals, and tool executions. Langfuse is an open source platform that records that whole chain as a tree and lets you see, from a browser, how many tokens and how much time each step consumed. It is released under the MIT license, so you can run it on your own servers.
You Only See the Result, Never the Path
The hard part of agent-based applications is isolating the cause when the output goes wrong. Did the model reason badly, did retrieval pull the wrong documents, or did the agent pick the wrong tool? Staring at the returned text tells you none of that.
Cost has the same shape of problem. The bill arrives once a month, but unless your application recorded the breakdown, you cannot reconstruct which feature and which step it belongs to. A small change in how an instruction is phrased can push token consumption up sharply, and in production that gap matters.
Langfuse starts by storing that invisible middle layer in full, one execution at a time.
One Response, Saved as a Hierarchy
The central unit in Langfuse is the trace. A single trace covers everything from user input to final output, with model calls, retrievals, and tool executions nested inside it.
Each step keeps its inputs and outputs along with latency, token counts, and estimated cost. When a tool is called, the arguments passed and the results returned are stored as well. You can filter by user, session, or your own metadata, which makes it possible to go back and find a bug that only affects one customer, or a path with unusually high latency.
Collection is asynchronous and batched by design, so it never blocks the application. Version 4, released in August, reworked ingestion and display to run closer to real time, and the project says it can be up to 165 times faster under some conditions.
Not Just Observation, but the Loop Back to Improvement
What separates Langfuse from a plain logging tool is that the collected data feeds directly into improvement.
Prompts can be stored separately from code, with versioning and one-click rollback. Response quality can be scored by another model, by deterministic heuristics, or by human review. Production inputs can be turned into datasets so you can swap models or prompts and compare the results side by side. In late August the project added reusable evaluation rules and the ability to turn scores into dashboard charts.
Entry points for coding agents have also been filling in. A command line tool that exposes the full API reached version 1.0 on August 21, and an MCP server is available for IDE-based agents. An in-app assistant that investigates production data and carries out approved actions has been added as well.
OpenTelemetry Native, No Lock-In
The breadth of integrations stands out. Langfuse is OpenTelemetry native, so any language or framework with OTel instrumentation can be measured as is. Python and TypeScript have dedicated SDKs, while Go, Java, .NET, Ruby, PHP, and Swift work through OpenTelemetry.
More than 100 integrations ship with it. Agent frameworks such as LangChain, Vercel AI SDK, LiteLLM, Pydantic AI, Google ADK, and CrewAI; model providers including OpenAI, Anthropic, Google Gemini, Mistral AI, xAI, Amazon Bedrock, Groq, vLLM, and Ollama; and local tooling such as Dify, n8n, OpenWebUI, Cursor, and Claude Code. The stated policy of avoiding framework lock-in shows up directly in that list.
Getting data out is not restricted either. Everything is available through REST APIs, and there is a query SDK plus export to S3 compatible storage.
The Option to Keep It on Your Own Servers
All product features of Langfuse are published under the MIT license. The quickest way to try it is to bring the stack up with Docker, which takes cloning the repository and starting the containers.
git clone https://github.com/langfuse/langfuse.git
cd langfuse
docker compose up -d
For production there is a Helm chart for Kubernetes plus Terraform configurations for AWS, GCP, and Azure. Internally it uses ClickHouse as the analytical database, queues ingestion so it runs asynchronously, and offloads large payloads to object storage, a structure built to hold hundreds of millions of traces.
A hosted version exists too, with a free tier of 50,000 observations per month and no credit card required. On the security side it holds SOC 2 Type II and ISO 27001, and offers US, EU, and Japan data regions as well as a HIPAA-ready region for handling health information.
Langfuse itself is now part of ClickHouse. The project has passed 30,000 GitHub stars with more than 300 contributors, and the company reports processing over 10 billion observations per month for more than 2,300 customers.
Summary
Right after you wire up an agent, the only question that feels urgent is whether it works. Once it goes into production, what matters is whether you can explain why it behaved the way it did. Langfuse puts trace recording, evaluation, and prompt management on one foundation, and does it under a license that lets you keep the whole thing in house. If you cannot currently say what your agent is spending its tokens on, recording is the place to start.
