Dataherald cuts LLM costs by 83% by detecting uncapped token growth with LangSmith
Dataherald's NL-to-SQL engine required GPT-4–32K for accuracy, making token costs a central concern. Their manual tracking approach via MongoDB could not identify which agent tools were driving costs, and a bug in the few-shot retriever caused token usage to grow practically uncapped over time.
Their prior monitoring stack — TikToken library and LangChain callback handlers written to MongoDB — required manual queries in MongoDB Compass to aggregate costs, gave no per-tool visibility, and caused them to miss a growing bug in the few-shot retriever.
Within hours of setting up LangSmith, Dataherald identified a bug causing the few-shot retriever to consume about 150,000 tokens per query.
After a hotfix and additional fixes, token usage dropped to approximately 25,500 tokens per query, slashing costs by 83%. The team now shares LangSmith execution run links via Slack and Jira for rapid production debugging.
Frequently asked questions
What did this team achieve with this AI workflow?
Within hours of setting up LangSmith, Dataherald identified a bug causing the few-shot retriever to consume about 150,000 tokens per query.
What tools did this team use?
LangSmith, LangChain, RAG, GPT-4–32K, vector DB, TikToken, MongoDB Compass, Slack, Jira.
What results were reported?
LLM cost reduction: 83%; Tokens per query before fix: 150,000; Tokens per query after fix: 25,500; Bug identification and triage time: fraction of the time (source-reported, not independently verified).
What failed first in this deployment?
Their prior monitoring stack — TikToken library and LangChain callback handlers written to MongoDB — required manual queries in MongoDB Compass to aggregate costs, gave no per-tool visibility, and caused them to miss…
How is this back office ops AI workflow structured?
Plain English query via API → RAG agent reasons with LLM → LangSmith captures execution metrics → Bug detected: uncapped token growth → Hotfix reduces token usage by 83% → Run links shared for ongoing debugging.