Learning resourcesReviewed · Langfuse

Langfuse: What does a good trace look like? (observability best practices)

This is a vendor documentation guide for developers who send LLM application and agent traces to Langfuse, explaining how to scope, nest, name and annotate traces; its main catch is that it is Langfuse-specific, assumes you already know Langfuse terms, and gives rules rather than a worked setup. It covers one trace per unit of work, correct observation types (generation, tool, agent, span), stable verb-first names, meaningful root input/output, and attributes such as metadata, model/usage/cost, tags, environment, user ID and session ID.

Researched 13 Nov 2026

In short.

This is a single Langfuse documentation page for developers who send LLM application or agent traces to Langfuse. It teaches how to make traces useful for debugging, evaluation and cost tracking. Its main catch is that it is vendor-specific guidance that assumes Langfuse concepts and gives no end-to-end SDK setup walkthrough or measured results. The page argues that trace structure is not cosmetic, because LLM-as-a-judge evaluators, dashboards, dataset experiments and saved views all depend on observation names, types and input/output. Its advice: make one trace per self-contained unit of work (a chatbot turn, an agent run, a pipeline execution) and group multiple traces with sessions; give LLM calls the generation type and tool calls the tool type; nest tools under the orchestrating agent or span; avoid wrapping an agent loop in a single generation; capture model thinking on each generation; filter out noisy HTTP and database spans; name observations with stable, verb-first, low-cardinality names; set root input/output deliberately; and use metadata, model/usage/cost fields, tags, environment, user ID and session ID. Nothing on the page was executed or tested for this report, and the page states no pricing, licence, version or publication date.

Researched and written by an AI model and checked by a second AI model. How it works

The scope is the complete selected page at [https://langfuse.com/docs/observability/best-practices.md]. Pages it links to (data model, observation types, instrumentation, evaluation, sessions, token and cost tracking, FAQs, integrations, API reference, CLI, Agent Skill and others) are excluded and were not read. Images are referenced by path, but their content was not captured. The page carries no licence notice, price, version or publication date, so rights, cost and age are reported as unknown. Nothing was executed or tested: Langfuse, its SDKs and its UI were not run, and all behavioural statements are the page's own claims.

The overview

What this resource is

The resource is one Langfuse documentation page titled What does a good trace look like? (sidebar title Best Practices). It was captured from the Markdown address [https://langfuse.com/docs/observability/best-practices.md]. Its description says it covers best practices for structuring Langfuse traces (scope, nesting, naming, input/output and attributes) so that debugging, evaluation and cost tracking work well.

It is a guide, not software, a dataset or an agent definition. It teaches how to apply Langfuse's tracing data model to an LLM application. The page ends with a block of instructions for AI agents. That block points to Langfuse's Markdown docs, a semantic doc-search endpoint, an index of pages (llms.txt), an installable Langfuse Agent Skill, an API reference and a CLI. These are only pointers on the page; this report did not examine what they contain.

Overall assessment

Based on reading the page text, it is a focused and practical guide. Most rules come with a reason tied to a specific Langfuse feature: names are targeted by evaluators and dashboards, root input/output feeds the tracing table and experiments, tags cannot change after creation, and the model name drives automatic cost lookup. That makes it more useful than a generic list of tips.

Its weaknesses are the ones you would expect from vendor documentation. It describes Langfuse behaviour only. The page includes a curl documentation-search example and CLI command syntax, but no complete tracing implementation, and it gives no measurements of how much better traces become when you follow it. The agent graph, the session view and the rendering of tool calls as cards are described directly in the page text, but the referenced images and the live UI behaviour remain unverified. Nothing was run, so every behavioural statement here is the page's own claim.

Who it is for

The main audience is developers and teams who already send, or are about to send, traces from an LLM application, RAG pipeline, chatbot or agent to Langfuse and want to know whether the result is well structured. It also suits people who set up LLM-as-a-judge evaluators, dashboards or dataset experiments and need the underlying traces to be consistent.

Beginners can follow the main ideas, such as one trace per turn, descriptive names and meaningful input and output. The page uses Langfuse terms (observation, generation, span, agent, tool, session, score, evaluator, dataset experiment) but links to other pages instead of defining them all. A newcomer will probably need the linked data model and observation-type pages, which are outside the captured scope. Experienced developers get the most from the naming, nesting and agent-loop guidance.

What it helps you do

Scope: it defines a trace as one self-contained unit of work and a session as a group of several traces, for example one trace per chatbot turn and one session per conversation. It explains that the per-turn model works because you do not know in advance when a conversation ends, and because it keeps traces small.

Inspect a trace tree: LLM calls should appear as generation observations (which can carry cost, token usage and model information) and tool calls as tool observations. A tool call should nest under the agent or span that orchestrates it, as a sibling of the generation that requested it. Avoid one parent generation that wraps the whole agent loop, because that hides the decision after each tool result, the thinking, and which tool call inflated the context window. The page also says to capture thinking (reasoning) on each generation and to filter out noisy HTTP, database and framework spans.

Name things: use verb-first names such as classify-intent, retrieve-context, generate-response and summarize-results. Keep run-specific values like order numbers or retry counts out of names and put them in metadata. Do not name observations after the model, since the model is its own attribute on a generation.

Choose input/output: give the root observation the most care, because trace-level input and output are derived from it. For a chatbot, use the user message and assistant response, and put raw payloads in metadata. Use OpenAI-style role and content messages so they render as a conversation. Tool calls belong in an assistant message's tool_calls array, with each call's arguments as a JSON-encoded string.

Add attributes: metadata (evaluation, request, retrieval, raw-payload and annotation context), model name plus usage details and optional cost details on generations, tags for business-level dimensions, prompt linking when prompts are managed in Langfuse, environment (production, staging, development), user ID and session ID. For sessions it adds three instrumentation rules: put the same session ID on every trace, repeat the conversation history in each later generation's input, and use matching IDs for tool calls and their results. It also says user images go in the user message of a generation's input and model-generated images in the output, using a supported content part or a Langfuse media reference.

Using it

What you need to use it

To read the guide you only need the page. To act on it you need an application that sends data to Langfuse, either through a framework integration or through manual instrumentation. The page mentions the SDK parameters as_type (Python) and asType (JS/TS), and says framework integrations typically set observation types and nesting automatically.

The page does not state which Langfuse versions, SDK versions, hosting option (cloud or self-hosted), account type or plan the advice assumes. Some features it refers to, such as LLM-as-a-judge evaluators, custom dashboards, agent graphs and prompt management, may depend on version or plan. The page does not establish this, so it is unknown. A self-hosting index is mentioned only in the footer of agent pointers, without detail.

How the advice works

The page rests on Langfuse's data model: observations (individual steps) are grouped into traces by a trace_id, and traces can be grouped into sessions by a session_id. The recommendations follow from which features read which fields. LLM-as-a-judge evaluators target observations by name and type and read their input and output. Dashboards filter and aggregate by trace and observation names. Dataset experiments compare trace input and output across runs. Saved views reference names and attributes.

From that, the page draws its central rule: treat names like an API, because renaming an observation silently stops evaluators, dashboard queries and saved filters from matching. It cites OpenTelemetry's low-cardinality guidance for span names as the same principle.

For cost, Langfuse uses the model name on a generation to look up pricing in its model pricing table. If the name does not match, cost cannot be calculated automatically. Usage details (input, output and optionally cached tokens) power the token views, and cost details can override automatic pricing, for example under a custom pricing agreement. Tags are immutable and must be set when the observation is created, so labels added after the fact, such as an evaluator's verdict, should be scores instead.

Setup

The page has no end-to-end SDK setup walkthrough. It works mainly as a checklist for traces you already see in Langfuse: open a trace, look at the tree and agent graph, and compare them with the page's criteria. It does contain some concrete instrumentation guidance. It names the observation-type parameters for manual instrumentation (as_type in Python, asType in JS/TS). It gives a three-part checklist for instrumenting sessions: set the same session ID (session_id in Python, sessionId in JS/TS) on every trace in a conversation, repeat the earlier conversation history as role-labeled messages in each later generation's input, and give each tool call a unique ID that is repeated with its result. Its closing block of agent instructions recommends installing the Langfuse Agent Skill before writing Langfuse code.

For other manual instrumentation it points to separate pages on nesting observations, observation types, token and cost tracking, metadata, tags, environments, users, sessions and multi-modality. Those pages were not captured, so their steps are unknown here. The page does not cover authentication, project keys, SDK installation commands or exporter configuration.

Illustrative example

The page includes a curl documentation-search example and CLI command syntax, but no complete tracing implementation. Here is an illustration built only from the page's own examples and rules. One chatbot turn could be a single trace whose root observation has the user message as input and the assistant reply as output. Under it could sit steps named classify-intent, retrieve-context and generate-response, with the model call typed as a generation carrying the model name and token usage. If the model requested a tool, the tool observation would nest under the orchestrating agent or span as a sibling of that generation. Run-specific details such as a request ID or app version would go in metadata. The traffic source (for example web or api) would go in a tag set at creation, the environment would be set to production, and the same session ID would be reused for every turn of the conversation.

The anti-pattern the page shows with screenshots is an agent loop collapsed into one generation, which gives only aggregated cost and the final output. The recommended form has one generation per model invocation, interleaved with the tool calls it requested, so thinking, tokens and cost are visible after each step.

Assessment & evidence

Limitations and risks

The guidance is specific to Langfuse's data model and UI. Observation types, the agent graph, the session view and the evaluator variable mapping are Langfuse features, so the advice does not transfer one-to-one to other tools. The general ideas of scoping, stable low-cardinality names and meaningful input and output apply more widely, but that is this report's reading, not something the page claims about other tools.

The page is a set of recommendations, not a specification. It provides no quantitative thresholds, benchmarks or measured benefits, but it does explain failure cases, such as mismatched model names preventing automatic cost calculation and renamed observations breaking name-based filters. It does not discuss privacy, data protection or retention, even though it recommends capturing thinking, full conversation history, user IDs and raw payloads in metadata. If you apply it to sensitive data, you need to decide separately what to record and what to mask. Some advice, such as always capturing thinking, depends on the model and integration exposing reasoning, which the page does not discuss.

Screenshots are referenced by path but their content was not captured, so UI details are known only from the surrounding text. The page links to many other pages for definitions and procedures, and those are excluded from this report. Nothing was run, so nothing here confirms that Langfuse behaves as the page describes.

Why the conclusions follow

The assessment rests on how directly the page ties each recommendation to a mechanism. For instance, it explains why a single generation around an agent loop is harmful: you lose the decision after each tool result, the thinking, and the identity of the tool call that blew up the context window. It also explains why dynamic values in names are harmful: every trace produces new names, so you cannot group, filter or target them. These explanations are internally consistent, and you can check them against the tool's own behaviour if you use it.

This is Langfuse's own documentation; the text identifies no individual author. It is authoritative about Langfuse's intended use but not independent. Its claims that good structure improves debugging, evaluation and cost tracking are plausible given the mechanisms described, but the page offers no data. This report therefore calls it solid guidance, not proven guidance.

The page justifies using sessions for multi-turn conversations, with each turn as its own trace, on two grounds: conversation length is unknown in advance, and small traces are easier to navigate. That reasoning comes from the page and was not independently verified.

Alternatives and related options

The page does not compare Langfuse with other tools and names no competitors, so the evidence supports no comparison. It does cite OpenTelemetry's recommendation for low-cardinality span names, which suggests its naming rule follows a wider tracing convention.

If you use a different LLM observability or tracing tool, the page's general principles may still work as a checklist, but its feature-specific advice may not map to that tool. For Langfuse itself, the page points to its documentation on observation types, the data model, instrumentation, token and cost tracking, sessions and evaluation, which would be the next things to read. Those pages were not captured, so they are not summarised here.

Evidence base

The report is based on the complete text of the selected page at [https://langfuse.com/docs/observability/best-practices.md], captured on 2026-11-13. This includes its front matter (title, sidebar title, description), body sections and the closing block of agent pointers.

Coverage is text only: referenced screenshot images were not analysed, and linked pages were excluded. No code, SDK, Langfuse instance or linked page was fetched, run or tested. All behavioural statements in this report are the page's own claims.

Access & freshness

Costs

The page states no price for Langfuse, its hosting options, any plan or the documentation itself. The cost of using the guidance is therefore unknown from this evidence.

The page does discuss tracking what your own LLM usage costs, by model, user and feature. That is the cost of the models your application calls, not a Langfuse fee. The page does not say whether more granular traces (for example one generation per model call, captured thinking, or repeated conversation history in each generation input) increase data volume, storage or billing in Langfuse. That impact is not assessed here.

Rights and reuse

The captured page contains no licence statement, copyright notice or reuse terms. This evidence therefore does not establish any right to copy, adapt or redistribute the text or its screenshots. Treat it as material to read and apply, and link to it at [https://langfuse.com/docs/observability/best-practices.md] instead of republishing it.

The page says it is published as plain Markdown for AI agents, and that every page is available as Markdown by appending .md to its URL or by sending an Accept: text/markdown header. That describes access, not a licence.

Freshness

The page was captured on 2026-11-13 (07:47 UTC). It shows no publication date, last-updated date, version number or changelog, so its age and the Langfuse version it describes are unknown.

Documentation can change. Re-read the live page before relying on details such as parameter names (as_type, asType, session_id, sessionId) or UI behaviour.

Suggested next steps

If you use Langfuse, open a recent trace and go through the page's questions in order. Are the right steps present with the right types? Is each tool call nested under the step that ran it? Does each model invocation have its own generation with model, usage and thinking? Is noise from HTTP or database spans filtered out? Then check names for dynamic values or model names, check that the root observation's input and output read well in the tracing table, and confirm that environment, tags, user ID and session ID are set where they apply.

Before renaming existing observations, note the page's warning that evaluators, dashboard queries and saved filters that target the old name silently stop matching. Check what you record (conversation history, thinking, raw payloads, user IDs) against your own data-handling rules, since the page does not cover this. For manual instrumentation details, read the linked Langfuse pages and the API reference the page points to, and verify endpoints and parameters there instead of inferring them from this guide.

Evidence for this report

selected-page.txtselected · checked 2026-11-13