Skip to content
derpx06Notes on systems, models & learning
8. Production, Evaluation & Governance · lesson 63 of 68 · 1 min · January 10, 2026

Tracing with LangSmith

X-Rays for your AI. Seeing inside the black box.

You run your chain. It outputs "I don't know." Why?

  • Did the retriever search fail?
  • Did the retrieval return documents, but they were irrelevant?
  • Did the LLM ignore the documents (Hallucination)?
  • Did the output parsing fail?

Without Tracing, you are guessing.

LangSmith (by LangChain) acts like "DataDog for LLMs." It visualizes the Tree of Execution.

  • Root: The Chat Chain
    • Child 1: Retriever (Input: "Query", Output: [Doc A, Doc B])
    • Child 2: Prompt Builder (Input: Docs, Output: Full String)
    • Child 3: LLM Call (Input: Full String, Output: "I don't know")

By looking at Child 1, you can instantly see: "Ah! The retriever returned 0 documents. That is the bug."

It is built into LangChain. Just set environment variables.

enable_tracing.sh
export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_API_KEY=ls__...

Tracing isn't just for debugging. It is for Data Collection. You can button click on a "Good Run" in LangSmith and say "Add to Dataset." Now you have a Golden Example for future testing.

If you deploy to production without tracing, you are flying blind. You will never know why your users are unhappy.

Key Intuition: "You cannot fix what you cannot see."