Fifteen Langfuse decisions you only learn in production

What only shows up once real customers are on the other end of your agents, and how to check for it before they find it for you.

For weeks, several of the agents we run for Ruby were making things up, and nothing on any dashboard said so.

A web lookup inside each run was failing. The scraper sent back a healthy status code with a body that said the scrape had failed, so the step showed green. The agent reasoned over the empty result and filled the gap with something plausible. No error was raised anywhere. We only caught it when we pointed a properly built judge at a real batch of runs and watched every affected agent score close to zero.

Agents rarely crash. They hand back an answer that reads well and is wrong, or one that cost eight times what it should have. Tracing is supposed to catch that, but a careless setup just gives you a busy screen that says nothing true. Which of the two you end up with comes down to about fifteen decisions.

I've spent most of 2026 running Langfuse underneath Ruby's 48 agents. They do the research a sales engineer would do before a meeting and write the results into customers' Salesforce and HubSpot, so a wrong answer means a wrong number in somebody's pipeline. We've already written up how that setup fits together. Below is what I'd tell any team putting agents on Langfuse, in roughly the order you'll run into each decision.

Each practice ends with a test you can run this week, and the tests are the part I'd most want you to try. Everything here is checked against Langfuse v4, which went generally available in August. The docs are good, but most of this isn't in them, because it only shows up under real traffic.

If tracing is new to you

Normal software breaks loudly. You get an error and you fix it. Software built on language models gives you a confident, on-time answer that happens to be wrong. Or the answer is fine but came from a prompt someone edited last Tuesday, and nobody remembers who.

Langfuse records what your AI actually did. Each job becomes a trace, the full record of that one job from request to final answer. It holds every model call, every tool the agent used, what went in, what came out, and what it all cost. When a customer asks why the agent said something, you open the trace and have the answer in a minute rather than a day of guessing.

Everything below is about making that minute reliable, and about getting the traces to flag problems before a customer does.

Decisions that are expensive to undo

1. Your run id is your trace id

Every job your system runs already has an id, usually a database row. Make that the trace id. Langfuse can derive a valid trace id from any seed string, and the same seed always produces the same id, so the row and the trace become one object without an extra column or a mapping table.

That pays off in more places than you'd expect. A batch job that only knows the database id can attach a quality score later. A thumbs-down in the product lands on the exact run it refers to, and an internal dashboard can link straight into a trace, all without extra plumbing.

The test: go from a support ticket to its trace without searching by timestamp and user. If you can't, fix this first.

2. Give sessions a business meaning

A session groups traces together. Most examples use it for a chat conversation, which is the least useful thing it can be. For Ruby, a session is a deal: every agent that touched that deal, over weeks, in one view. Open it and you read the deal's history as the system saw it.

Use the unit your users already think in. In a support product that's a ticket. In a research product it's an account. The session id is any short string, so pass your own business id. A session that only means "one chat window" tells you nothing a timestamp doesn't.

3. Record model calls in exactly one place

Agents call models from all over: the main loop, retries, streaming, workers running in parallel. Instrument each spot separately and you'll miss one, and it will be the expensive one.

We route every model call through a single layer, and that layer is the only code that records anything. Each call becomes a Langfuse generation with its prompt, output, tokens, cost and latency. The rest of the codebase has no idea tracing exists.

One detail for the engineers: do the recording in the async layer, not in the thread making the network request. Parent and child links ride on Python context variables, and those only follow your code into parallel tasks and thread pools if they're set in the async task. Get it right and worker agents nest under their parents on their own, so the graph view shows the real shape of the work.

The test: spawn a worker that makes three model calls. If the trace shows three separate traces instead of three children under one parent, context isn't travelling.

A Langfuse trace of one agent run: the agent at the top, with its model calls and tool calls nested underneath in order, each with its duration, tokens and cost

One agent run: twelve model calls and twenty-five tool calls, each nested under the agent that made them.

4. Mask personal data in the client, and document the one field you keep

Traces hold whatever users typed and whatever agents found, which means names, emails and phone numbers. Langfuse accepts a masking function on the client, so redaction happens inside your process before anything leaves, and every code path that records data is covered without knowing it. In v4 the hook is mask_otel_spans. The older mask still works.

Ours strips email addresses, phone numbers, and anything stored under a key that looks personal.

Then choose, on purpose, what survives. We keep the user id, because a trace you can't attribute to anyone is a trace nobody can act on. Write that exception down where people will see it. A mask with undocumented gaps is worse than no mask at all, because people trust it.

Getting data in without hurting the product

5. Tracing can never be allowed to fail a run

If I could push only one practice, it would be this one, and it's the dullest of the fifteen. Tracing is a side effect. When the tracing service is slow, down or misconfigured, your agent should finish exactly as it would have without it.

In practice: every tracing function catches every error and returns quietly. When tracing is switched off in config, every function becomes a no-op. And flush on shutdown, so a worker that's told to stop doesn't drop its last thirty seconds of traces.

Without that rule, an outage at your observability vendor takes your product down with it, and the one tool you'd use to understand why is the one that's down.

The test: point the client at a dead host and run the full test suite. Everything should pass. Then delete the keys and run it again.

6. Set the run's identity before anything is sent

A trace is built from observations, one per step: a model call, a tool call, a worker agent. In v4, user, session and tags live on each observation rather than on the trace as a whole. Langfuse's upgrade guide is explicit that setting them later won't re-tag observations already sent.

So set name, user, session and tags at the very start of a run, before the first model call, and emit one small observation straight away so they land. Skip this and the opening calls of every run arrive with no owner, permanently.

We found it on a cost chart, where a sizeable slice sat under no name at all. On the hosted service data usually shows up within seconds, but the trace record itself can take fifteen to thirty seconds to become queryable, and anything emitted before its identity was set gets filed under nobody.

The test: filter cost by trace name and user. If any share of spend has no owner, your identity is arriving late.

7. If your provider isn't in the price table, decide who does the pricing

Langfuse prices a call by matching the model name against its table of known models. Run models through a gateway such as AWS Bedrock and the names won't match. Langfuse's own guidance is to either add your models and prices in project settings or send usage and cost yourself with each call. Whatever you send wins over what it would infer.

We send it ourselves. Our billing prices cache reads and cache writes differently from ordinary tokens, and we want the trace to show what the invoice will show. So every generation's cost comes from the same function billing uses.

Once cost is right, tracing pays for itself within a week. The first thing ours surfaced was a single agent making thirty-four model calls in one run. It had been doing that for months, and nobody knew.

The test: take one real run and check that the trace total and the database total agree to the cent. Ours match exactly, and that's the only reason anyone at the company trusts either figure. Two cost numbers that are four percent apart are two numbers nobody believes.

8. Serve prompts from Langfuse by label, and rehearse the fallback

Prompts live in Langfuse and get fetched at run time. Each edit creates a numbered version, and labels like staging and production point at a version. Your code asks for the label. Moving the label is the release, with no deploy, and every trace records which version produced the answer.

The SDK caches each prompt for sixty seconds by default, refreshes in the background, and keeps serving the cached copy if Langfuse is unreachable. Pass a fallback prompt too, because a fresh process with an empty cache and no fallback will fail instead of running.

Then run the fallback on purpose, on a schedule, which almost nobody does. Variable names drift and templates change, so a fallback that hasn't run in six months is probably broken, and you find out during the outage it was meant to cover.

The test: a nightly job that renders every fallback and fails loudly if one breaks. It takes about an hour to write.

Making the data say something

9. Check every run cheaply, judge a sample expensively

An evaluator is anything that puts a score on a run. There are two kinds, and they fail in different ways.

Code checks are free, exact and narrow. Did the output parse? Is the confidence field filled in? Did internal markup leak into text a customer will read? Run these on every run.

A judge is a second model that grades the first one's answer against a rubric. It's slower, it costs real money, and it's the only way to score questions like "is every claim here backed by the evidence?" In v4, judges attach to observations rather than whole traces. Filter them to the agents whose output customers actually see, and set a sampling rate. Ours score within thirty seconds of a run finishing.

Out of roughly five thousand runs a month, the grounding judge reads about fifteen hundred and the wrong-entity judge about three hundred. That's enough to spot drift within a day and cheap enough to leave running.

Watch for scores that never move. One of ours had returned the same value on every run since the day it was written, which looked like a permanent all-clear.

The test: once a month, look at the distribution of every score, not just its average.

10. Show the judge what the agent saw

A judge grades an answer against context, and the obvious context is the user's original request. For an agent that's the wrong context. Agents fetch their evidence mid-run, through tools, and the judge never sees any of it.

We watched a judge give a good answer 0.2, a fail. The agent had made thirteen tool calls, and every claim in its answer came from one of them. The judge had only the original question, none of the tool results, and concluded, correctly, that the claims weren't supported by anything it had been shown.

The fix: collect what the tools return while the run is going. When it finishes, attach that evidence to the trace next to the original request, capped at a sensible size, and point the judge at both.

The test: re-judge a low-scoring run with its evidence attached. Ours went from 0.2 to 0.95, with eighteen of nineteen claims supported, and the one flagged claim really wasn't in any tool result. The judge had been grading correctly all along; we'd given it the wrong material.

The Scores tab of a run in Langfuse, with the grounding judge's comment open, listing each claim it checked as supported

The judge's comment on one run. It lists every claim it checked and which tool result supported it.

11. Anchor the rubric, and define zero

Ask a judge to "rate how grounded this is, from 0 to 1" and you get numbers that drift with its mood. The same answer scores 0.6 one day and 0.8 the next, and neither is wrong.

Instead, make the judge list the specific claims first, mark each one supported or not with a reference, and calculate the score from that list. Give it six fixed bands, each with an example. Then define the bottom on purpose. Ours says zero means the agent's research failed and it stated facts anyway. That's the failure that matters most, so it gets its own name.

The test: write eight planted cases, one for each band plus the edges, and run the judge on them before you trust a single production number. Ours placed all eight correctly. If yours can't, nothing built on its scores means much.

12. Scope each check to the agent it was written for

A check that's right for one agent is noise on another. We wrote one to catch internal ids leaking into customer-facing text by looking for long hexadecimal strings. It fired on every run. The strings were signed storage links inside perfectly legitimate URLs, and the check had no concept of a link.

Attach every check and every judge to named agents, never to the whole fleet by default.

The test: before switching on a new check, run it over a few hundred past traces and read what it flags. The first time we did this properly, across all 136 production runs of one agent, it turned up a real failure no existing score had caught, a dead score, and a telemetry gap on two thirds of runs. It took one afternoon. Every check I'd written before that exercise had been a false positive.

13. Plant a trap in every golden set

A golden set is a saved collection of real inputs with known good answers. Before shipping a prompt change or a new model, you run it against the set and the judges score the results. It's the regression test for behaviour you can't unit test.

Put at least one item in it that's designed to fail. Ours has no context at all and asks for a specific revenue figure. The honest answer is that the number isn't available. A model that makes one up should score low.

The test: watch that item's score. In our runs it gets 0.4 while the honest items get 1.0. If it ever reaches 1.0, either the evaluator broke or the model got better at lying, and you want to know either one before a customer does.

A note on experiments. The runner takes a function that receives a dataset item and returns an output, and the docs are right that your own application logic can go inside it. The hard part is on our side. A real agent is a stateful pipeline with tool loops, database writes and workers, so to test one inside an experiment we swap the model in our registry, run the actual agent, and rebuild the trace afterwards. It works, though it isn't pretty.

What only appears once you're live

14. Decide what "no data" means before your first quiet hour

Monitors watch a metric over a time window and post to a channel when it crosses a threshold. Two settings turned out to matter much more than the thresholds.

The first is the window. A day-long window evaluates too slowly to page anyone while it's still useful. Ours are one hour: more than five errors, a grounding average below 0.4, or a wrong-entity average below 0.8.

The second is what a monitor does when there's nothing to measure. Langfuse gives you four options: treat missing data as zero, hold the previous severity, show a no-data state, or alert only once no-data has lasted a while. For a quality score, missing must never mean zero, or every quiet hour reads as a total collapse and the channel learns to ignore you. For an error count, zero is exactly right.

The test: fire every monitor on purpose with seeded data, and watch it recover, before you believe it.

A Langfuse alert set to fire when the average grounding score drops below 0.4 over one hour, with a live preview of the score and a Slack notification

The grounding alert: average below 0.4 over a one-hour window, posting to Slack.

15. Error levels lie, so read the tool output

Every tool call in a trace carries a level, and the instinct is to filter for errors. Don't rely on it. A tool that fails will often report success at the network layer and put the failure in its response text. The step shows green, and the agent, with no instruction telling it otherwise, invents something plausible to fill the gap.

When you audit runs, search the tool output text for failure phrases rather than the level field. Then make sure your judge's rubric defines inventing facts after a failed lookup as the bottom of the scale (practice 11), so the audit and the judge catch the same failure from opposite directions.

The test: search a week of tool outputs for phrases like "failed", "error" and "not found" on steps marked successful. This is how we traced the problem at the start of this post: our first judged batch put several agents near zero, and the tool output showed why.

What the fifteen have in common

Count where the failures in this post actually were. Nearly all of them sat in the instruments watching the agents: a judge reading the wrong context, a score that never moved, a check that couldn't tell a link from a leak, a monitor that read silence as collapse, and a green step hiding a failed lookup.

An observability setup is a set of measuring instruments, and an untested instrument still produces confident numbers. That's worse than having no numbers, because people act on them. It's why every practice here ends with a test, and why the tests are the part I'd keep if you forgot the rest.

Two things I'd still like from Langfuse: first-class pricing for gateway providers like Bedrock, so teams don't each maintain their own table for cache tokens, and an experiment runner that can wrap a run with side effects and vary one setting, so practice 13 no longer needs a workaround.

If you're putting agents in front of customers and want this running on your own production traffic, that's what our Langfuse engagement does: fixed scope, fixed price, and a runbook at the end. You can see the result in the Ruby case study, or book an architecture review and we'll look at your setup.

About the author

Haris Farooq is an AI & Data Engineer at Bonneville Data. He built the agent platform behind Ruby and runs the Langfuse layer that traces it, which is where he learned everything in this post. He writes up what breaks in production when the docs didn't warn him. An earlier version of this piece appeared on his Substack.

Numbers and versions

Figures come from Ruby's production traffic over about thirty days: roughly 5,000 agent runs, over 90,000 observations and over 400 million tokens. About 1,500 runs were judged for grounding (average 0.84) and about 300 for wrong entity (average 0.97). Product behaviour is described against Langfuse v4, generally available since 17 August 2026, checked against the official documentation and changelog on 23 September 2026, using Python SDK 4.14.

See what fast looks like on your stack.

A review of your current setup, with a phased path to ClickHouse that's live in weeks.