← Back to posts

Tracing LLM Pipelines: From Bug Report to Root Cause

The fastest way I've found to debug an LLM app is to open its trace first. A good trace shows where the chain broke and which inputs triggered it. What the model returned is right there too.

Tracing started to matter once the offer-bundling assistant was serving real users. When a production incident came in, the trace was where I found the cause.

On that project, the workflow below takes about 10 minutes, and its four steps don't depend on how the pipeline is built.

In 30 seconds

  • Traces beat logs because they show the full run tree and inputs/outputs.
  • Workflow: reproduce -> locate the failing node -> compare good/bad runs -> fix.
  • In each trace, look for the first run where the wrong value appears.
  • Use tags and metadata so you can slice failures fast.

Why traces beat logs

Logs give you strings. A trace is a tree of runs with their inputs, outputs, latency, and metadata. A wrong bundle recommendation affects pricing or compliance (sometimes both), so I need to see which step failed.

In the offer-bundling assistant, a single request can touch catalog lookup, prompt assembly, model inference, and output validation. Each of those steps shows up as its own run inside one trace.

Minimal setup

You need only two things:

  1. LangSmith API key
  2. One place where your app sends runs

In the offer-bundling assistant, I set these in .env so every run is traced automatically.

LANGSMITH_TRACING=true
LANGSMITH_API_KEY=<your-api-key>
LANGSMITH_PROJECT=langsmith-offer-bundles

Trace anatomy

Every trace has:

  • A root run (the overall request)
  • Child runs (each step or node)
  • Inputs, outputs, and metadata

Think of it like a stack trace for LLM workflows.

The 10-minute debugging workflow

Here is the exact loop I follow:

  1. Reproduce

    • Run the same request with the same inputs.
    • Tag the run (for example: issue:bundle-missing-sku).
  2. Locate

    • Open the trace tree.
    • Find the node where the output changes or fails validation.
  3. Compare

    • Grab a good run and a bad run.
    • Compare inputs and outputs side by side.
  4. Fix

    • Fix the prompt, schema, or data issue.
    • Rerun the same input to confirm.

This takes minutes if your traces are clean.

What failures look like in traces

Common root causes in the offer-bundling assistant:

  • Missing field in the model output (schema mismatch)
  • Wrong region selected due to metadata drift
  • Over-budget recommendation because price fields were missing

For these three, I look for the first run in the trace where the wrong value appears.

A simple checklist I keep

  • Can I reproduce the failure with the same input?
  • Which node produced the wrong output?
  • Is the output invalid, or just wrong content?
  • Did a prompt or schema change recently?
  • Can I compare a good run vs a bad run?

The request path

User request -> catalog lookup -> prompt -> model -> validator -> result

Using this without LangSmith

The same workflow also works with custom tracing or internal observability tooling. The root cause will usually show up once you put a good trace next to a bad one.


Profile picture

Written by Florin — full-stack & AI engineer.