← all posts
// observability · langsmith

LangSmith traces: the first honest look at my own pipeline

By mid-April the compliance assistant from the RAG pipeline piece was live, the client was happy, and I had confident opinions about its performance backed by no data at all. Then their ops lead asked, reasonably, why some answers took twelve seconds. Finding out meant two environment variables and a restart:

export LANGSMITH_TRACING=true
export LANGSMITH_API_KEY=...

the first trace was a confession

The first waterfall I opened showed the retriever running twice per request. Identical query, identical results, about 900 milliseconds and an embedding call each time.

The culprit was a helper I'd added in early March to generate related-question suggestions. Instead of accepting the context we'd already retrieved, it invoked the full chain again. Code review missed it. I missed it. The answers stayed correct, so nothing ever surfaced: five weeks in production doing every retrieval twice (call it ten thousand pointless vector queries, give or take) and most of a second of latency I had been blaming on the model provider.

Nobody notices a pipeline doing twice the work as long as the answers keep coming back right.

Ten minutes of tracing found what five weeks of operating hadn't.

prompt bloat only shows up rendered

Templates look small in git; rendered prompts are what the model reads. The traces showed our assembled system prompt landing around 6,100 tokens, more than half of it few-shot examples I'd added back in February to stabilize output formatting: a problem structured output had long since solved. Nobody rereads the assembled prompt because nobody ever sees it; review happens on templates, and the concatenation happens at runtime. I cut it to roughly 2,300 tokens with no drop we could measure on the golden set, and input cost per request fell by about a third.

evals grow where the traces live

The workflow that stuck: every thumbs-down in the client's UI annotates its trace, once a month I sweep the annotated ones into a dataset, and that dataset became the regression suite that runs under an LLM judge before any prompt or retriever change ships. Eval sets built from real failing traffic beat anything I've invented at a whiteboard, and keeping traces and datasets in one place is the part of LangSmith I'd pay for without complaint.

the lock-in paragraph

Now the uncomfortable bit. Traces contain fragments of a compliance client's internal documents, and shipping those to a third-party SaaS triggered a data-residency review that ate three weeks and some goodwill. Self-hosting exists, at enterprise pricing I won't pretend to know. Open alternatives, Langfuse, or plain OpenTelemetry with a decent UI bolted on, cover most of the day-to-day tracing, with more assembly required. My split, three months in: pay for the trace viewer and the dataset-and-eval glue, build alerting and cost dashboards yourself, because a cron job and three SQL queries genuinely cover those. The vendor-neutral version of this reasoning lives in agent observability, and graph runtimes bring tracing wrinkles of their own.

Turn tracing on before you think you need it. The shame is much cheaper early.

#langsmith#observability#tracing