LangChain says layered context boosted self-serve analytics questions 40x
LangChain's analytics engineering team has described how a layered context system for its AI analytics agent produced a 40x increase in self-serve analytics questions. Emily Hawkins, head of...
LangChain's analytics engineering team has described how a layered context system for its AI analytics agent produced a 40x increase in self-serve analytics questions. Emily Hawkins, head of analytics engineering, and analytics engineer Logan Cochran explained the approach at dbt Summit 2026.
The team's premise is that an agent only knows what its context tells it, since a language model has no built-in grasp of a company's data, business rules or internal vocabulary. The first layer is the dbt project: table and column descriptions sync into BigQuery, so tools like Hex inherit them. That pushed the team to write sharper documentation - not just "the status of the account" but an explanation of lifecycle stages in Salesforce, including what active, churned and prospect mean. The Hex agent also reads the dbt repo and DAG directly, so it can reason about dependencies and the SQL behind a model.
Three more layers sit inside Hex. Workspace guides are markdown files covering concepts such as how ARR is measured and internal product vocabulary; they are written in the dbt repo and imported via a GitHub Action to stay version-controlled. A semantic layer defines metrics and join relationships in code so revenue questions resolve consistently. Endorsements flag trusted mart models and dashboards, kept deliberately selective, with data team review required before an endorsed dashboard change publishes.
The setup changed the data team's role: instead of answering every question, it owns the context that lets other departments query the agent directly. The team said this works even when the business outpaces documentation, such as a pricing change rippling across domains, and that a domain doesn't need airtight metric definitions before an agent becomes useful. Context is treated as something documented continuously, not a project with an end date. The 40x growth came from ongoing documentation, user education and measuring impact to find missing context. Next on the roadmap: evals and using Hex's CLI to enrich context further.
Source: dbt Labs Blog
Ready to Modernize Your Business?
Get your AI automation roadmap in minutes, not months.
Analyze Your Workflows →